mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
InstCombine: Fix an edge case where constant icmps could sneak into ConstantFoldInstOperands and crash.
Have to refactor the ConstantFolder interface one day to define bugs like this away. Fixes PR14131. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -333,6 +333,10 @@ static Value *SimplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
|
||||
|
||||
// All operands were constants, fold it.
|
||||
if (ConstOps.size() == I->getNumOperands()) {
|
||||
if (CmpInst *C = dyn_cast<CmpInst>(I))
|
||||
return ConstantFoldCompareInstOperands(C->getPredicate(), ConstOps[0],
|
||||
ConstOps[1], TD, TLI);
|
||||
|
||||
if (LoadInst *LI = dyn_cast<LoadInst>(I))
|
||||
if (!LI->isVolatile())
|
||||
return ConstantFoldLoadFromConstPtr(ConstOps[0], TD);
|
||||
|
||||
Reference in New Issue
Block a user