mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-10 08:40:41 +00:00
Fold a binary operator with constant operands when expanding code for a SCEV.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37602 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c2c28fc24c
commit
0f0eb18add
@ -72,6 +72,11 @@ Value *SCEVExpander::InsertCastOfTo(Instruction::CastOps opcode, Value *V,
|
||||
/// of work to avoid inserting an obviously redundant operation.
|
||||
Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
|
||||
Value *RHS, Instruction *&InsertPt) {
|
||||
// Fold a binop with constant operands.
|
||||
if (Constant *CLHS = dyn_cast<Constant>(LHS))
|
||||
if (Constant *CRHS = dyn_cast<Constant>(RHS))
|
||||
return ConstantExpr::get(Opcode, CLHS, CRHS);
|
||||
|
||||
// Do a quick scan to see if we have this binop nearby. If so, reuse it.
|
||||
unsigned ScanLimit = 6;
|
||||
for (BasicBlock::iterator IP = InsertPt, E = InsertPt->getParent()->begin();
|
||||
|
Loading…
x
Reference in New Issue
Block a user