mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Thread LLVMContext through the constant folding APIs, which touches a lot of files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -3420,6 +3420,7 @@ static Constant *EvaluateExpression(Value *V, Constant *PHIVal) {
|
||||
if (Constant *C = dyn_cast<Constant>(V)) return C;
|
||||
if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) return GV;
|
||||
Instruction *I = cast<Instruction>(V);
|
||||
LLVMContext* Context = I->getParent()->getContext();
|
||||
|
||||
std::vector<Constant*> Operands;
|
||||
Operands.resize(I->getNumOperands());
|
||||
@ -3431,10 +3432,12 @@ static Constant *EvaluateExpression(Value *V, Constant *PHIVal) {
|
||||
|
||||
if (const CmpInst *CI = dyn_cast<CmpInst>(I))
|
||||
return ConstantFoldCompareInstOperands(CI->getPredicate(),
|
||||
&Operands[0], Operands.size());
|
||||
&Operands[0], Operands.size(),
|
||||
Context);
|
||||
else
|
||||
return ConstantFoldInstOperands(I->getOpcode(), I->getType(),
|
||||
&Operands[0], Operands.size());
|
||||
&Operands[0], Operands.size(),
|
||||
Context);
|
||||
}
|
||||
|
||||
/// getConstantEvolutionLoopExitValue - If we know that the specified Phi is
|
||||
@ -3636,10 +3639,11 @@ const SCEV* ScalarEvolution::getSCEVAtScope(const SCEV *V, const Loop *L) {
|
||||
Constant *C;
|
||||
if (const CmpInst *CI = dyn_cast<CmpInst>(I))
|
||||
C = ConstantFoldCompareInstOperands(CI->getPredicate(),
|
||||
&Operands[0], Operands.size());
|
||||
&Operands[0], Operands.size(),
|
||||
Context);
|
||||
else
|
||||
C = ConstantFoldInstOperands(I->getOpcode(), I->getType(),
|
||||
&Operands[0], Operands.size());
|
||||
&Operands[0], Operands.size(), Context);
|
||||
Pair.first->second = C;
|
||||
return getSCEV(C);
|
||||
}
|
||||
|
Reference in New Issue
Block a user