31 lines · plain
1; RUN: llc -asm-verbose=false -mtriple=x86_64-apple-darwin -o - < %s | FileCheck %s2 3; LSR should leave non-affine expressions alone because it currently4; doesn't know how to do anything with them, and when it tries, it5; gets SCEVExpander's current expansion for them, which is suboptimal.6 7; CHECK: xorl %eax, %eax8; CHECK-NEXT: align9; CHECK-NEXT: BB0_1:10; CHECK-NEXT: movq %rax, (%rdx)11; CHECK-NEXT: addq %rsi, %rax12; CHECK-NEXT: cmpq %rdi, %rax13; CHECK-NEXT: jl14; CHECK-NEXT: imulq %rax, %rax15; CHECK-NEXT: ret16define i64 @foo(i64 %n, i64 %s, ptr %p) nounwind {17entry:18 br label %loop19 20loop:21 %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]22 store volatile i64 %i, ptr %p23 %i.next = add i64 %i, %s24 %c = icmp slt i64 %i.next, %n25 br i1 %c, label %loop, label %exit26 27exit:28 %mul = mul i64 %i.next, %i.next29 ret i64 %mul30}31