mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use targetdata to validate that it is safe. While I'm in there, fix some const correctness issues and generalize the interface to the "operand folder". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44817 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -299,7 +299,13 @@ ConstantFoldMappedInstruction(const Instruction *I) {
|
||||
else
|
||||
return 0; // All operands not constant!
|
||||
|
||||
return ConstantFoldInstOperands(I, &Ops[0], Ops.size(), TD);
|
||||
|
||||
if (const CmpInst *CI = dyn_cast<CmpInst>(I))
|
||||
return ConstantFoldCompareInstOperands(CI->getPredicate(),
|
||||
&Ops[0], Ops.size(), TD);
|
||||
else
|
||||
return ConstantFoldInstOperands(I->getOpcode(), I->getType(),
|
||||
&Ops[0], Ops.size(), TD);
|
||||
}
|
||||
|
||||
/// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto,
|
||||
|
Reference in New Issue
Block a user