[PATCH] D68495: [PATCH 12/38] [noalias] EarlyCSE: learn about noalias intrinsics
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 17:33:26 PDT 2019
jeroen.dobbelaere updated this revision to Diff 226794.
jeroen.dobbelaere added a comment.
Rebased
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68495/new/
https://reviews.llvm.org/D68495
Files:
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/test/Transforms/EarlyCSE/basic.ll
Index: llvm/test/Transforms/EarlyCSE/basic.ll
===================================================================
--- llvm/test/Transforms/EarlyCSE/basic.ll
+++ llvm/test/Transforms/EarlyCSE/basic.ll
@@ -57,7 +57,17 @@
; CHECK-LABEL: @test2b(
define i32 @test2b(i32 *%P, i1 %b) {
%V1 = load i32, i32* %P
- call i8* @llvm.noalias.p0i8(i8* undef, metadata !1)
+ call i8* @llvm.noalias.p0i8.p0i8.p0p0i8.i32(i8* undef, i8* null, i8** null, i32 0, metadata !1)
+ %V2 = load i32, i32* %P
+ %Diff = sub i32 %V1, %V2
+ ret i32 %Diff
+ ; CHECK: ret i32 0
+}
+
+; CHECK-LABEL: @test2c(
+define i32 @test2c(i32 *%P, i1 %b) {
+ %V1 = load i32, i32* %P
+ call i8* @llvm.side.noalias.p0i8.p0i8.p0p0i8.p0p0i8.i32(i8* undef, i8* null, i8** null, i8** null, i32 0, metadata !1)
%V2 = load i32, i32* %P
%Diff = sub i32 %V1, %V2
ret i32 %Diff
@@ -147,7 +157,16 @@
; CHECK-LABEL: @test6b(
define i32 @test6b(i32 *%P, i1 %b) {
store i32 42, i32* %P
- call i8* @llvm.noalias.p0i8(i8* undef, metadata !1)
+ call i8* @llvm.noalias.p0i8.p0i8.p0p0i8.i32(i8* undef, i8* null, i8** null, i32 0, metadata !1)
+ %V1 = load i32, i32* %P
+ ret i32 %V1
+ ; CHECK: ret i32 42
+}
+
+; CHECK-LABEL: @test6c(
+define i32 @test6c(i32 *%P, i1 %b) {
+ store i32 42, i32* %P
+ call i8* @llvm.side.noalias.p0i8.p0i8.p0p0i8.p0p0i8.i32(i8* undef, i8* null, i8** null, i8** null, i32 0, metadata !1)
%V1 = load i32, i32* %P
ret i32 %V1
; CHECK: ret i32 42
@@ -311,7 +330,8 @@
ret void
}
-declare i8* @llvm.noalias.p0i8(i8*, metadata) nounwind
+declare i8* @llvm.noalias.p0i8.p0i8.p0p0i8.i32(i8*, i8*, i8**, i32, metadata ) nounwind
+declare i8* @llvm.side.noalias.p0i8.p0i8.p0p0i8.p0p0i8.i32(i8*, i8*, i8**, i8**, i32, metadata ) nounwind
!0 = !{!0, !"some domain"}
!1 = !{!1, !0, !"some scope"}
Index: llvm/lib/Transforms/Scalar/EarlyCSE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -927,15 +927,23 @@
<< '\n');
AvailableValues.insert(CondI, ConstantInt::getTrue(BB->getContext()));
} else
- LLVM_DEBUG(dbgs() << "EarlyCSE skipping assumption: " << *Inst << '\n');
+ LLVM_DEBUG(dbgs() << "EarlyCSE skipping intrinsic: " << *Inst << '\n');
continue;
}
- // Skip sideeffect intrinsics, for the same reason as assume intrinsics.
// Likewise, noalias intrinsics don't actually write.
- if (match(Inst, m_CombineOr(m_Intrinsic<Intrinsic::sideeffect>(),
- m_Intrinsic<Intrinsic::noalias>()))) {
- LLVM_DEBUG(dbgs() << "EarlyCSE skipping intrinsic: " << *Inst << '\n');
+ if (match(Inst, m_Intrinsic<Intrinsic::noalias>()) ||
+ match(Inst, m_Intrinsic<Intrinsic::noalias_decl>()) ||
+ match(Inst, m_Intrinsic<Intrinsic::side_noalias>()) ||
+ match(Inst, m_Intrinsic<Intrinsic::noalias_arg_guard>())) {
+ LLVM_DEBUG(dbgs() << "EarlyCSE skipping noalias intrinsic: " << *Inst
+ << '\n');
+ continue;
+ }
+
+ // Skip sideeffect intrinsics, for the same reason as assume intrinsics.
+ if (match(Inst, m_Intrinsic<Intrinsic::sideeffect>())) {
+ LLVM_DEBUG(dbgs() << "EarlyCSE skipping sideeffect: " << *Inst << '\n');
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68495.226794.patch
Type: text/x-patch
Size: 3350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191029/fff1b5fb/attachment.bin>
More information about the llvm-commits
mailing list