diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-12 17:35:29 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-12 17:35:29 +0000 |
| commit | 6132a50d2a92fa81a089a895dca03c3c5d1e9038 (patch) | |
| tree | 1c7b397a62c82ee037d2833f03dcb5f56afe7f08 /llvm/lib/Transforms | |
| parent | 00c872f353905e0667bb16d3fae3451ac5ce453e (diff) | |
| download | bcm5719-llvm-6132a50d2a92fa81a089a895dca03c3c5d1e9038.tar.gz bcm5719-llvm-6132a50d2a92fa81a089a895dca03c3c5d1e9038.zip | |
Revert "[InstCombine] Fix PR35618: Instcombine hangs on single minmax load bitcast."
This reverts commit r320499 again to resolve the problem with the
sanitizers bbots.
llvm-svn: 320501
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index fbbdfaa04dd..01fc1528681 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -1339,10 +1339,10 @@ static bool equivalentAddressValues(Value *A, Value *B) { /// Converts store (bitcast (load (bitcast (select ...)))) to /// store (load (select ...)), where select is minmax: /// select ((cmp load V1, load V2), V1, V2). -static bool removeBitcastsFromLoadStoreOnMinMax(InstCombiner &IC, - StoreInst &SI) { +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; @@ -1354,26 +1354,9 @@ static bool removeBitcastsFromLoadStoreOnMinMax(InstCombiner &IC, 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 *USI = cast<StoreInst>(UI); - IC.Builder.SetInsertPoint(USI); - combineStoreToNewValue(IC, *USI, NewLI); - if (USI != &SI) - IC.eraseInstFromFunction(*cast<Instruction>(UI)); - } - IC.Worklist.Remove(LI); + combineStoreToNewValue(IC, SI, NewLI); return true; } |

