mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 19:06:05 +00:00
Fix the inline cost calculation to take into account instructions
which cannot be folded even if they have constant operands. Significantly helps if_spppsubr.c attached to PR4573. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ef6ab66bcf
commit
4612e59779
@ -42,6 +42,13 @@ unsigned InlineCostAnalyzer::FunctionInfo::
|
|||||||
// Figure out if this instruction will be removed due to simple constant
|
// Figure out if this instruction will be removed due to simple constant
|
||||||
// propagation.
|
// propagation.
|
||||||
Instruction &Inst = cast<Instruction>(**UI);
|
Instruction &Inst = cast<Instruction>(**UI);
|
||||||
|
|
||||||
|
// We can't constant propagate instructions which have effects or
|
||||||
|
// read memory.
|
||||||
|
if (Inst.mayReadFromMemory() || Inst.mayHaveSideEffects() ||
|
||||||
|
isa<AllocationInst>(Inst))
|
||||||
|
continue;
|
||||||
|
|
||||||
bool AllOperandsConstant = true;
|
bool AllOperandsConstant = true;
|
||||||
for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i)
|
||||||
if (!isa<Constant>(Inst.getOperand(i)) && Inst.getOperand(i) != V) {
|
if (!isa<Constant>(Inst.getOperand(i)) && Inst.getOperand(i) != V) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user