mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-17 05:31:32 +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:
parent
c10305743c
commit
55af2b59bb
@ -8162,7 +8162,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// InstCombineStoreToCast - Fold 'store V, (cast P)' -> store (cast V), P'
|
||||
/// InstCombineStoreToCast - Fold store V, (cast P) -> store (cast V), P
|
||||
/// when possible.
|
||||
static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||
User *CI = cast<User>(SI.getOperand(1));
|
||||
@ -8206,8 +8206,9 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||
if (isa<PointerType>(SIOp0->getType()))
|
||||
opcode = Instruction::PtrToInt;
|
||||
else if (const IntegerType* SITy = dyn_cast<IntegerType>(CastSrcTy))
|
||||
assert(DITy->getBitWidth() == SITy->getBitWidth() &&
|
||||
"Illegal store instruction");
|
||||
if (SITy->getBitWidth() != DITy->getBitWidth())
|
||||
return 0; // Don't do this transform on unequal bit widths.
|
||||
// else, BitCast is fine
|
||||
}
|
||||
if (Constant *C = dyn_cast<Constant>(SIOp0))
|
||||
NewCast = ConstantExpr::getCast(opcode, C, CastDstTy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user