aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-01-31 18:45:46 +0000
committerPhilip Reames <listmail@philipreames.com>2019-01-31 18:45:46 +0000
commitede49ddff5c100bf38ba753a432e7ead2b7cc7f6 (patch)
tree4237655b0703304ecc353052b4f839be0ebeee0e /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent02a86e6c7e40991c5fa1f6f19fab47c819be4f29 (diff)
downloadllvm-ede49ddff5c100bf38ba753a432e7ead2b7cc7f6.zip
llvm-ede49ddff5c100bf38ba753a432e7ead2b7cc7f6.tar.gz
llvm-ede49ddff5c100bf38ba753a432e7ead2b7cc7f6.tar.bz2
Lower widenable_conditions in CGP
This ensures that if we make it to the backend w/o lowering widenable_conditions first, that we generate correct code. Doing it in CGP - instead of isel - let's us fold control flow before hitting block local instruction selection. Differential Revision: https://reviews.llvm.org/D57473 llvm-svn: 352779
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index e382798..7d5d839 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1703,6 +1703,20 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, bool &ModifiedDT) {
if (II) {
switch (II->getIntrinsicID()) {
default: break;
+ case Intrinsic::experimental_widenable_condition: {
+ // Give up on future widening oppurtunties so that we can fold away dead
+ // paths and merge blocks before going into block-local instruction
+ // selection.
+ if (II->use_empty()) {
+ II->eraseFromParent();
+ return true;
+ }
+ Constant *RetVal = ConstantInt::getTrue(II->getContext());
+ resetIteratorIfInvalidatedWhileCalling(BB, [&]() {
+ replaceAndRecursivelySimplify(CI, RetVal, TLInfo, nullptr);
+ });
+ return true;
+ }
case Intrinsic::objectsize: {
// Lower all uses of llvm.objectsize.*
Value *RetVal =