[PATCH] D9397: llvm.noalias - computeKnownBits should look through them

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 15:56:46 PDT 2016


hfinkel updated this revision to Diff 63344.
hfinkel added a comment.
Herald added a subscriber: mcrosier.

Rebased.


http://reviews.llvm.org/D9397

Files:
  lib/Analysis/ValueTracking.cpp
  test/Transforms/InstCombine/align-attr.ll

Index: test/Transforms/InstCombine/align-attr.ll
===================================================================
--- test/Transforms/InstCombine/align-attr.ll
+++ test/Transforms/InstCombine/align-attr.ll
@@ -13,3 +13,19 @@
 ; CHECK: ret i32
 }
 
+define i32 @foo2(i32* align 32 %a) #0 {
+entry:
+  %v = call i32* @llvm.noalias.p0i32(i32* %a, metadata !1)
+  %0 = load i32, i32* %v, align 4
+  ret i32 %0
+
+; CHECK-LABEL: @foo2
+; CHECK-DAG: load i32, i32* %v, align 32
+; CHECK: ret i32
+}
+
+declare i32* @llvm.noalias.p0i32(i32*, metadata) nounwind
+
+!0 = !{!0, !"some domain"}
+!1 = !{!1, !0, !"some scope"}
+
Index: lib/Analysis/ValueTracking.cpp
===================================================================
--- lib/Analysis/ValueTracking.cpp
+++ lib/Analysis/ValueTracking.cpp
@@ -1288,6 +1288,9 @@
     if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
       switch (II->getIntrinsicID()) {
       default: break;
+      case Intrinsic::noalias:
+        computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q);
+        break;
       case Intrinsic::bswap:
         computeKnownBits(I->getOperand(0), KnownZero2, KnownOne2, Depth + 1, Q);
         KnownZero |= KnownZero2.byteSwap();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9397.63344.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160708/476eedf4/attachment.bin>


More information about the llvm-commits mailing list