diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-12 16:05:52 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-12 16:05:52 +0000 |
commit | c9f1d2e4a0acd0f0f18452385cce666363efed0b (patch) | |
tree | f5630d9a702dd3667ca5393b06e31cb0e1251e14 /llvm/lib | |
parent | bd2197c0c1ad4e7ed648880a90a4ab16064942ae (diff) | |
download | bcm5719-llvm-c9f1d2e4a0acd0f0f18452385cce666363efed0b.tar.gz bcm5719-llvm-c9f1d2e4a0acd0f0f18452385cce666363efed0b.zip |
Revert "[InstCombine] Fix PR35618: Instcombine hangs on single minmax load bitcast."
This reverts commit r320488 because of the failed asan buildbots..
llvm-svn: 320490
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 27adcade8f1..01fc1528681 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -1341,7 +1341,8 @@ static bool equivalentAddressValues(Value *A, Value *B) { /// select ((cmp load V1, load V2), V1, V2). bool removeBitcastsFromLoadStoreOnMinMax(InstCombiner &IC, StoreInst &SI) { // bitcast? - if (!match(SI.getPointerOperand(), m_BitCast(m_Value()))) + Value *StoreAddr; + if (!match(SI.getPointerOperand(), m_BitCast(m_Value(StoreAddr)))) return false; // load? integer? Value *LoadAddr; @@ -1353,26 +1354,9 @@ bool removeBitcastsFromLoadStoreOnMinMax(InstCombiner &IC, StoreInst &SI) { if (!isMinMaxWithLoads(LoadAddr)) return false; - if (!all_of(LI->users(), [LI, LoadAddr](User *U) { - auto *SI = dyn_cast<StoreInst>(U); - return SI && SI->getPointerOperand() != LI && - peekThroughBitcast(SI->getPointerOperand()) != LoadAddr && - !SI->getPointerOperand()->isSwiftError(); - })) - return false; - - IC.Builder.SetInsertPoint(LI); LoadInst *NewLI = combineLoadToNewType( IC, *LI, LoadAddr->getType()->getPointerElementType()); - // Replace all the stores with stores of the newly loaded value. - for (auto *UI : LI->users()) { - auto *SI = cast<StoreInst>(UI); - IC.Builder.SetInsertPoint(SI); - combineStoreToNewValue(IC, *SI, NewLI); - IC.eraseInstFromFunction(*SI); - } - IC.replaceInstUsesWith(*LI, UndefValue::get(LI->getType())); - IC.eraseInstFromFunction(*LI); + combineStoreToNewValue(IC, SI, NewLI); return true; } @@ -1401,7 +1385,7 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) { return eraseInstFromFunction(SI); if (removeBitcastsFromLoadStoreOnMinMax(*this, SI)) - return nullptr; + return eraseInstFromFunction(SI); // Replace GEP indices if possible. if (Instruction *NewGEPI = replaceGEPIdxWithZero(*this, Ptr, SI)) { |