summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBob Haarman <llvm@inglorion.net>2019-12-02 17:23:54 -0800
committerBob Haarman <llvm@inglorion.net>2019-12-05 10:39:34 -0800
commit055779a9ac11e56442cbcdc73da59f8bce7ce57d (patch)
treeab866ff5f83f5f3200f57f3420b47bff86448f20 /llvm/lib/Transforms
parent52812f2ade71476ea309a3482c93d0c9db1fa45b (diff)
downloadbcm5719-llvm-055779a9ac11e56442cbcdc73da59f8bce7ce57d.tar.gz
bcm5719-llvm-055779a9ac11e56442cbcdc73da59f8bce7ce57d.zip
Revert "[InstCombine] keep assumption before sinking calls"
Summary: This reverts commit c3b06d0c393e533eab712922911d14e5a079fa5d. Reason for revert: Caused miscompiles when inserting assume for undef. Also adds a test to prevent similar breakage in future. Fixes PR44154. Reviewers: rnk, jdoerfert, efriedma, xbolva00 Reviewed By: rnk Subscribers: thakis, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70933
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp23
1 files changed, 2 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index faaf5dcb2a4..5383da8fd86 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3147,8 +3147,7 @@ Instruction *InstCombiner::visitFreeze(FreezeInst &I) {
/// beginning of DestBlock, which can only happen if it's safe to move the
/// instruction past all of the instructions between it and the end of its
/// block.
-static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock,
- InstCombiner::BuilderTy &Builder) {
+static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
assert(I->hasOneUse() && "Invariants didn't hold!");
BasicBlock *SrcBlock = I->getParent();
@@ -3182,24 +3181,6 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock,
if (Scan->mayWriteToMemory())
return false;
}
-
- // If this instruction was providing nonnull guarantees insert assumptions for
- // nonnull call site arguments.
- if (auto CS = dyn_cast<CallBase>(I)) {
- for (unsigned Idx = 0; Idx != CS->getNumArgOperands(); Idx++)
- if (CS->paramHasAttr(Idx, Attribute::NonNull) ||
- (CS->paramHasAttr(Idx, Attribute::Dereferenceable) &&
- !llvm::NullPointerIsDefined(CS->getFunction(),
- CS->getArgOperand(Idx)
- ->getType()
- ->getPointerAddressSpace()))) {
- Value *V = CS->getArgOperand(Idx);
-
- Builder.SetInsertPoint(I->getParent(), I->getIterator());
- Builder.CreateAssumption(Builder.CreateIsNotNull(V));
- }
- }
-
BasicBlock::iterator InsertPos = DestBlock->getFirstInsertionPt();
I->moveBefore(&*InsertPos);
++NumSunkInst;
@@ -3334,7 +3315,7 @@ bool InstCombiner::run() {
// otherwise), we can keep going.
if (UserIsSuccessor && UserParent->getUniquePredecessor()) {
// Okay, the CFG is simple enough, try to sink this instruction.
- if (TryToSinkInstruction(I, UserParent, Builder)) {
+ if (TryToSinkInstruction(I, UserParent)) {
LLVM_DEBUG(dbgs() << "IC: Sink: " << *I << '\n');
MadeIRChange = true;
// We'll add uses of the sunk instruction below, but since sinking
OpenPOWER on IntegriCloud