mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
Revert r228556: InstCombine: propagate nonNull through assume
This commit isn't using the correct context, and is transfoming calls that are operands to loads rather than calls that are operands to an icmp feeding into an assume. I've replied on the original review thread with a very reduced test case and some thoughts on how to rework this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1081,19 +1081,12 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
|
||||
cast<Constant>(RHS)->isNullValue()) {
|
||||
LoadInst* LI = cast<LoadInst>(LHS);
|
||||
if (isValidAssumeForContext(II, LI, DL, DT)) {
|
||||
// assume( load (call|invoke) != null ) -> add 'nonnull' return
|
||||
// attribute
|
||||
Value *LIOperand = LI->getOperand(0);
|
||||
if (CallInst *I = dyn_cast<CallInst>(LIOperand))
|
||||
I->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull);
|
||||
else if (InvokeInst *I = dyn_cast<InvokeInst>(LIOperand))
|
||||
I->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull);
|
||||
|
||||
MDNode *MD = MDNode::get(II->getContext(), None);
|
||||
LI->setMetadata(LLVMContext::MD_nonnull, MD);
|
||||
return EraseInstFromFunction(*II);
|
||||
}
|
||||
}
|
||||
// TODO: apply nonnull return attributes to calls and invokes
|
||||
// TODO: apply range metadata for range check patterns?
|
||||
}
|
||||
// If there is a dominating assume with the same condition as this one,
|
||||
|
Reference in New Issue
Block a user