mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-04 04:19:25 +00:00
cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107988 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -30,9 +30,10 @@ Value *SCEVExpander::ReuseOrCreateCast(Value *V, const Type *Ty,
|
|||||||
BasicBlock::iterator IP) {
|
BasicBlock::iterator IP) {
|
||||||
// Check to see if there is already a cast!
|
// Check to see if there is already a cast!
|
||||||
for (Value::use_iterator UI = V->use_begin(), E = V->use_end();
|
for (Value::use_iterator UI = V->use_begin(), E = V->use_end();
|
||||||
UI != E; ++UI)
|
UI != E; ++UI) {
|
||||||
if ((*UI)->getType() == Ty)
|
User *U = *UI;
|
||||||
if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(*UI)))
|
if (U->getType() == Ty)
|
||||||
|
if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(U)))
|
||||||
if (CI->getOpcode() == Op) {
|
if (CI->getOpcode() == Op) {
|
||||||
// If the cast isn't where we want it, fix it.
|
// If the cast isn't where we want it, fix it.
|
||||||
if (BasicBlock::iterator(CI) != IP) {
|
if (BasicBlock::iterator(CI) != IP) {
|
||||||
@@ -49,6 +50,7 @@ Value *SCEVExpander::ReuseOrCreateCast(Value *V, const Type *Ty,
|
|||||||
rememberInstruction(CI);
|
rememberInstruction(CI);
|
||||||
return CI;
|
return CI;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new cast.
|
// Create a new cast.
|
||||||
Instruction *I = CastInst::Create(Op, V, Ty, V->getName(), IP);
|
Instruction *I = CastInst::Create(Op, V, Ty, V->getName(), IP);
|
||||||
|
Reference in New Issue
Block a user