mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
ConstantFoldInstOperands doesn't like compares, hand it off to instsimplify instead.
Fixes PR10040. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132254 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -298,6 +298,16 @@ static Value *SimplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
|
||||
return SimplifyBinOp(B->getOpcode(), B->getOperand(0), RepOp, TD);
|
||||
}
|
||||
|
||||
// Same for CmpInsts.
|
||||
if (CmpInst *C = dyn_cast<CmpInst>(I)) {
|
||||
if (C->getOperand(0) == Op)
|
||||
return SimplifyCmpInst(C->getPredicate(), RepOp, C->getOperand(1), TD);
|
||||
if (C->getOperand(1) == Op)
|
||||
return SimplifyCmpInst(C->getPredicate(), C->getOperand(0), RepOp, TD);
|
||||
}
|
||||
|
||||
// TODO: We could hand off more cases to instsimplify here.
|
||||
|
||||
// If all operands are constant after substituting Op for RepOp then we can
|
||||
// constant fold the instruction.
|
||||
if (Constant *CRepOp = dyn_cast<Constant>(RepOp)) {
|
||||
|
Reference in New Issue
Block a user