diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2020-08-28 19:31:36 +0200 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2020-08-28 20:52:22 +0200 |
commit | 52cc97a0db2d4c20655d4df7f2ae5c087ee5807b (patch) | |
tree | 240d775277834651c67a9ba2434fede167bfe74b /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 8bd895cac0cd4eaf76b9bb296a995e5ee485205b (diff) | |
download | llvm-52cc97a0db2d4c20655d4df7f2ae5c087ee5807b.zip llvm-52cc97a0db2d4c20655d4df7f2ae5c087ee5807b.tar.gz llvm-52cc97a0db2d4c20655d4df7f2ae5c087ee5807b.tar.bz2 |
[CodeGenPrepare] Zap the argument of llvm.assume when deleting it
We know that the argument is mostly likely dead, so we can purge it
early. Otherwise it would make it to codegen, and can block further
optimizations.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 2034fd0..3272f36 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -2044,7 +2044,12 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, bool &ModifiedDT) { switch (II->getIntrinsicID()) { default: break; case Intrinsic::assume: { + Value *Operand = II->getOperand(0); II->eraseFromParent(); + // Prune the operand, it's most likely dead. + RecursivelyDeleteTriviallyDeadInstructions( + Operand, TLInfo, nullptr, + [&](Value *V) { removeAllAssertingVHReferences(V); }); return true; } |