Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -domtree -instcombine -loops -S < %s | FileCheck %s
      2 ; Note: The -loops above can be anything that requires the domtree, and is
      3 ; necessary to work around a pass-manager bug.
      4 
      5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      6 target triple = "x86_64-unknown-linux-gnu"
      7 
      8 ; Function Attrs: nounwind uwtable
      9 define void @foo(i32* %a, i32* %b) #0 {
     10 entry:
     11   %ptrint = ptrtoint i32* %a to i64
     12   %maskedptr = and i64 %ptrint, 63
     13   %maskcond = icmp eq i64 %maskedptr, 0
     14   tail call void @llvm.assume(i1 %maskcond)
     15   %ptrint1 = ptrtoint i32* %b to i64
     16   %maskedptr2 = and i64 %ptrint1, 63
     17   %maskcond3 = icmp eq i64 %maskedptr2, 0
     18   tail call void @llvm.assume(i1 %maskcond3)
     19   br label %for.body
     20 
     21 ; CHECK-LABEL: @foo
     22 ; CHECK: load i32, i32* {{.*}} align 64
     23 ; CHECK: store i32 {{.*}}  align 64
     24 ; CHECK: ret
     25 
     26 for.body:                                         ; preds = %entry, %for.body
     27   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
     28   %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
     29   %0 = load i32, i32* %arrayidx, align 4
     30   %add = add nsw i32 %0, 1
     31   %arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
     32   store i32 %add, i32* %arrayidx5, align 4
     33   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 16
     34   %1 = trunc i64 %indvars.iv.next to i32
     35   %cmp = icmp slt i32 %1, 1648
     36   br i1 %cmp, label %for.body, label %for.end
     37 
     38 for.end:                                          ; preds = %for.body
     39   ret void
     40 }
     41 
     42 ; Function Attrs: nounwind
     43 declare void @llvm.assume(i1) #1
     44 
     45 attributes #0 = { nounwind uwtable }
     46 attributes #1 = { nounwind }
     47 
     48