[PATCH] D68500: [PATCH 17/38] [noalias] D9379: llvm.noalias - don't interfere with llvm.assume
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 14:48:00 PDT 2019
jeroen.dobbelaere created this revision.
jeroen.dobbelaere added reviewers: hfinkel, jdoerfert.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
This is part of the series started by D68484 <https://reviews.llvm.org/D68484>.
Rebase of D9379 <https://reviews.llvm.org/D9379>
https://reviews.llvm.org/D68500
Files:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/assume.ll
Index: llvm/test/Transforms/InstCombine/assume.ll
===================================================================
--- llvm/test/Transforms/InstCombine/assume.ll
+++ llvm/test/Transforms/InstCombine/assume.ll
@@ -339,6 +339,24 @@
declare void @llvm.dbg.value(metadata, metadata, metadata)
+define i1 @nonnull5(i32** %a) {
+entry:
+ %load = load i32*, i32** %a
+ ;; This call cannot actually trap, and so should not disrupt the assume.
+ %v = call i32* @llvm.noalias.p0i32(i32* %load, metadata !1)
+ %cmp = icmp ne i32* %load, null
+ tail call void @llvm.assume(i1 %cmp)
+ %q = bitcast i32** %a to i32*
+ %rval = icmp eq i32* %v, %q
+ ret i1 %rval
+
+; CHECK-LABEL: @nonnull5
+; CHECK: !nonnull
+; CHECK-NOT: call void @llvm.assume
+}
+
+declare i32* @llvm.noalias.p0i32(i32*, metadata) nounwind
+
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!5, !6, !7, !8}
@@ -351,6 +369,8 @@
!7 = !{i32 1, !"wchar_size", i32 4}
!8 = !{i32 7, !"PIC Level", i32 2}
!9 = !DILocation(line: 0, column: 0, scope: !2)
+!10 = !{!10, !"some domain"}
+!11 = !{!11, !10, !"some scope"}
attributes #0 = { nounwind uwtable }
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -513,6 +513,7 @@
case Intrinsic::invariant_end:
case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end:
+ case Intrinsic::noalias:
case Intrinsic::objectsize:
case Intrinsic::ptr_annotation:
case Intrinsic::var_annotation:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68500.223303.patch
Type: text/x-patch
Size: 1595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191004/47ed75c2/attachment.bin>
More information about the llvm-commits
mailing list