mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-20 20:38:48 +00:00
Remove a special case, allowing the general case to handle it. No functionality
change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
167f1e2651
commit
455fcc8d35
@ -3814,18 +3814,6 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI,
|
||||
uint64_t CastElTySize = TD->getTypeSize(CastElTy);
|
||||
if (CastElTySize == 0 || AllocElTySize == 0) return 0;
|
||||
|
||||
// If the allocation is for an even multiple of the cast type size
|
||||
Value *Amt = 0;
|
||||
if (AllocElTySize % CastElTySize == 0) {
|
||||
Amt = ConstantUInt::get(Type::UIntTy, AllocElTySize/CastElTySize);
|
||||
if (ConstantUInt *CI = dyn_cast<ConstantUInt>(AI.getOperand(0)))
|
||||
Amt = ConstantExpr::getMul(CI, cast<ConstantUInt>(Amt));
|
||||
else {
|
||||
// Perform an explicit scale.
|
||||
Instruction *Tmp = BinaryOperator::createMul(Amt, AI.getOperand(0),"tmp");
|
||||
Amt = InsertNewInstBefore(Tmp, AI);
|
||||
}
|
||||
} else {
|
||||
// See if we can satisfy the modulus by pulling a scale out of the array
|
||||
// size argument.
|
||||
unsigned ArraySizeScale = 1;
|
||||
@ -3856,6 +3844,7 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI,
|
||||
if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0) return 0;
|
||||
|
||||
unsigned Scale = (AllocElTySize*ArraySizeScale)/CastElTySize;
|
||||
Value *Amt = 0;
|
||||
if (Scale == 1) {
|
||||
Amt = NumElements;
|
||||
} else {
|
||||
@ -3867,7 +3856,6 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI,
|
||||
Amt = InsertNewInstBefore(Tmp, AI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string Name = AI.getName(); AI.setName("");
|
||||
AllocationInst *New;
|
||||
|
Loading…
x
Reference in New Issue
Block a user