mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
For this transform: store V, (cast P) -> store (cast V), P
don't allow the transform if V and the pointer's element type are different width integer types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33371 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -8162,7 +8162,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// InstCombineStoreToCast - Fold 'store V, (cast P)' -> store (cast V), P'
|
/// InstCombineStoreToCast - Fold store V, (cast P) -> store (cast V), P
|
||||||
/// when possible.
|
/// when possible.
|
||||||
static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||||
User *CI = cast<User>(SI.getOperand(1));
|
User *CI = cast<User>(SI.getOperand(1));
|
||||||
@ -8206,8 +8206,9 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
|||||||
if (isa<PointerType>(SIOp0->getType()))
|
if (isa<PointerType>(SIOp0->getType()))
|
||||||
opcode = Instruction::PtrToInt;
|
opcode = Instruction::PtrToInt;
|
||||||
else if (const IntegerType* SITy = dyn_cast<IntegerType>(CastSrcTy))
|
else if (const IntegerType* SITy = dyn_cast<IntegerType>(CastSrcTy))
|
||||||
assert(DITy->getBitWidth() == SITy->getBitWidth() &&
|
if (SITy->getBitWidth() != DITy->getBitWidth())
|
||||||
"Illegal store instruction");
|
return 0; // Don't do this transform on unequal bit widths.
|
||||||
|
// else, BitCast is fine
|
||||||
}
|
}
|
||||||
if (Constant *C = dyn_cast<Constant>(SIOp0))
|
if (Constant *C = dyn_cast<Constant>(SIOp0))
|
||||||
NewCast = ConstantExpr::getCast(opcode, C, CastDstTy);
|
NewCast = ConstantExpr::getCast(opcode, C, CastDstTy);
|
||||||
|
Reference in New Issue
Block a user