[PATCH] D66338: [CGP] Drop llvm.assume calls
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 08:59:33 PDT 2019
xbolva00 updated this revision to Diff 215613.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66338/new/
https://reviews.llvm.org/D66338
Files:
lib/CodeGen/CodeGenPrepare.cpp
test/Transforms/CodeGenPrepare/assume.ll
Index: test/Transforms/CodeGenPrepare/assume.ll
===================================================================
--- test/Transforms/CodeGenPrepare/assume.ll
+++ test/Transforms/CodeGenPrepare/assume.ll
@@ -0,0 +1,17 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -codegenprepare -S %s | FileCheck %s
+
+declare i32 @foo()
+declare void @llvm.assume(i1)
+
+define void @bar() {
+; CHECK-LABEL: @bar(
+; CHECK-NEXT: ret void
+;
+ %call = tail call i32 @foo() #0
+ %cmp = icmp eq i32 %call, 1
+ tail call void @llvm.assume(i1 %cmp)
+ ret void
+}
+
+attributes #0 = { nounwind readnone }
Index: lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- lib/CodeGen/CodeGenPrepare.cpp
+++ lib/CodeGen/CodeGenPrepare.cpp
@@ -6926,6 +6926,14 @@
if (InsertedInsts.count(I))
return false;
+ // Drop all llvm.assume calls
+ if (match(I, m_Intrinsic<Intrinsic::assume>())) {
+ Value *Arg = I->getOperand(0);
+ I->eraseFromParent();
+ RecursivelyDeleteTriviallyDeadInstructions(Arg);
+ return true;
+ }
+
// TODO: Move into the switch on opcode below here.
if (PHINode *P = dyn_cast<PHINode>(I)) {
// It is possible for very late stage optimizations (such as SimplifyCFG)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66338.215613.patch
Type: text/x-patch
Size: 1296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190816/1300d582/attachment.bin>
More information about the llvm-commits
mailing list