mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-03 16:21:41 +00:00
Fix some bugs in code I didn't mean to check in.
llvm-svn: 19534
This commit is contained in:
parent
aebad4db9a
commit
ee469241c3
@ -2112,6 +2112,7 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) {
|
|||||||
SIntPtrTy);
|
SIntPtrTy);
|
||||||
if (Constant *OpC = dyn_cast<Constant>(Op)) {
|
if (Constant *OpC = dyn_cast<Constant>(Op)) {
|
||||||
if (!OpC->isNullValue()) {
|
if (!OpC->isNullValue()) {
|
||||||
|
OpC = ConstantExpr::getCast(OpC, SIntPtrTy);
|
||||||
Scale = ConstantExpr::getMul(OpC, Scale);
|
Scale = ConstantExpr::getMul(OpC, Scale);
|
||||||
if (Constant *RC = dyn_cast<Constant>(Result))
|
if (Constant *RC = dyn_cast<Constant>(Result))
|
||||||
Result = ConstantExpr::getAdd(RC, Scale);
|
Result = ConstantExpr::getAdd(RC, Scale);
|
||||||
@ -2123,13 +2124,19 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We'll let instcombine(mul) convert this to a shl if possible.
|
//if (Op->getType() != Scale->getType())
|
||||||
Value *Offs =
|
if (Size != 1) {
|
||||||
IC.InsertNewInstBefore(BinaryOperator::createMul(Op, Scale,
|
// Convert to correct type.
|
||||||
GEP->getName()+".idx"), I);
|
Op = IC.InsertNewInstBefore(new CastInst(Op, SIntPtrTy,
|
||||||
|
Op->getName()+".c"), I);
|
||||||
|
|
||||||
|
// We'll let instcombine(mul) convert this to a shl if possible.
|
||||||
|
Op = IC.InsertNewInstBefore(BinaryOperator::createMul(Op, Scale,
|
||||||
|
GEP->getName()+".idx"), I);
|
||||||
|
}
|
||||||
|
|
||||||
// Emit an add instruction.
|
// Emit an add instruction.
|
||||||
Result = IC.InsertNewInstBefore(BinaryOperator::createAdd(Offs, Result,
|
Result = IC.InsertNewInstBefore(BinaryOperator::createAdd(Op, Result,
|
||||||
GEP->getName()+".offs"), I);
|
GEP->getName()+".offs"), I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user