[PATCH] llvm.noalias - computeKnownBits should look through them
hfinkel at anl.gov
hfinkel at anl.gov
Thu Apr 30 09:15:34 PDT 2015
Hi chandlerc, reames,
This is part of the series started by D9375, and teaches computeKnownBits to look through calls to llvm.noalias. This is necessary for pointer-alignment propagation to work.
http://reviews.llvm.org/D9397
Files:
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/align-attr.ll
Index: lib/Analysis/ValueTracking.cpp
===================================================================
--- lib/Analysis/ValueTracking.cpp
+++ lib/Analysis/ValueTracking.cpp
@@ -1460,6 +1460,9 @@
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
switch (II->getIntrinsicID()) {
default: break;
+ case Intrinsic::noalias:
+ computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, Q);
+ break;
case Intrinsic::ctlz:
case Intrinsic::cttz: {
unsigned LowBits = Log2_32(BitWidth)+1;
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"}
+
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9397.24736.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150430/9ee44f80/attachment.bin>
More information about the llvm-commits
mailing list