assume-loop-align.ll 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  5. target triple = "x86_64-unknown-linux-gnu"
  6. ; Function Attrs: nounwind uwtable
  7. define void @foo(i32* %a, i32* %b) #0 {
  8. entry:
  9. %ptrint = ptrtoint i32* %a to i64
  10. %maskedptr = and i64 %ptrint, 63
  11. %maskcond = icmp eq i64 %maskedptr, 0
  12. tail call void @llvm.assume(i1 %maskcond)
  13. %ptrint1 = ptrtoint i32* %b to i64
  14. %maskedptr2 = and i64 %ptrint1, 63
  15. %maskcond3 = icmp eq i64 %maskedptr2, 0
  16. tail call void @llvm.assume(i1 %maskcond3)
  17. br label %for.body
  18. ; CHECK-LABEL: @foo
  19. ; CHECK: load i32, i32* {{.*}} align 64
  20. ; CHECK: store i32 {{.*}} align 64
  21. ; CHECK: ret
  22. for.body: ; preds = %entry, %for.body
  23. %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  24. %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
  25. %0 = load i32, i32* %arrayidx, align 4
  26. %add = add nsw i32 %0, 1
  27. %arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
  28. store i32 %add, i32* %arrayidx5, align 4
  29. %indvars.iv.next = add nuw nsw i64 %indvars.iv, 16
  30. %1 = trunc i64 %indvars.iv.next to i32
  31. %cmp = icmp slt i32 %1, 1648
  32. br i1 %cmp, label %for.body, label %for.end
  33. for.end: ; preds = %for.body
  34. ret void
  35. }
  36. ; Function Attrs: nounwind
  37. declare void @llvm.assume(i1) #1
  38. attributes #0 = { nounwind uwtable }
  39. attributes #1 = { nounwind }