mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-29 07:39:27 +00:00
Look through addrspacecast in GetPointerBaseWithConstantOffset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
18c3a47118
commit
19d44f6ac1
@ -1731,7 +1731,8 @@ Value *llvm::GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ptr = GEP->getPointerOperand();
|
Ptr = GEP->getPointerOperand();
|
||||||
} else if (Operator::getOpcode(Ptr) == Instruction::BitCast) {
|
} else if (Operator::getOpcode(Ptr) == Instruction::BitCast ||
|
||||||
|
Operator::getOpcode(Ptr) == Instruction::AddrSpaceCast) {
|
||||||
Ptr = cast<Operator>(Ptr)->getOperand(0);
|
Ptr = cast<Operator>(Ptr)->getOperand(0);
|
||||||
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(Ptr)) {
|
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(Ptr)) {
|
||||||
if (GA->mayBeOverridden())
|
if (GA->mayBeOverridden())
|
||||||
|
@ -318,6 +318,19 @@ define i8 @coerce_offset0(i32 %V, i32* %P) {
|
|||||||
; CHECK: ret i8
|
; CHECK: ret i8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define i8 @coerce_offset0_addrspacecast(i32 %V, i32* %P) {
|
||||||
|
store i32 %V, i32* %P
|
||||||
|
|
||||||
|
%P2 = addrspacecast i32* %P to i8 addrspace(1)*
|
||||||
|
%P3 = getelementptr i8 addrspace(1)* %P2, i32 2
|
||||||
|
|
||||||
|
%A = load i8 addrspace(1)* %P3
|
||||||
|
ret i8 %A
|
||||||
|
; CHECK-LABEL: @coerce_offset0_addrspacecast(
|
||||||
|
; CHECK-NOT: load
|
||||||
|
; CHECK: ret i8
|
||||||
|
}
|
||||||
|
|
||||||
;; non-local i32/float -> i8 load forwarding.
|
;; non-local i32/float -> i8 load forwarding.
|
||||||
define i8 @coerce_offset_nonlocal0(i32* %P, i1 %cond) {
|
define i8 @coerce_offset_nonlocal0(i32* %P, i1 %cond) {
|
||||||
%P2 = bitcast i32* %P to float*
|
%P2 = bitcast i32* %P to float*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user