mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 22:07:27 +00:00
24517d023f
The current memory-instruction optimization logic in CGP, which sinks parts of the address computation that can be adsorbed by the addressing mode, does this by explicitly converting the relevant part of the address computation into IR-level integer operations (making use of ptrtoint and inttoptr). For most targets this is currently not a problem, but for targets wishing to make use of IR-level aliasing analysis during CodeGen, the use of ptrtoint/inttoptr is a problem for two reasons: 1. BasicAA becomes less powerful in the face of the ptrtoint/inttoptr 2. In cases where type-punning was used, and BasicAA was used to override TBAA, BasicAA may no longer do so. (this had forced us to disable all use of TBAA in CodeGen; something which we can now enable again) This (use of GEPs instead of ptrtoint/inttoptr) is not currently enabled by default (except for those targets that use AA during CodeGen), and so aside from some PowerPC subtargets and SystemZ, there should be no change in behavior. We may be able to switch completely away from the ptrtoint/inttoptr sinking on all targets, but further testing is required. I've doubled-up on a number of existing tests that are sensitive to the address sinking behavior (including some store-merging tests that are sensitive to the order of the resulting ADD operations at the SDAG level). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206092 91177308-0d34-0410-b5e6-96231b3b80d8
26 lines
563 B
LLVM
26 lines
563 B
LLVM
; RUN: llc -mtriple=arm-eabi -mattr=+v4t %s -o - | FileCheck %s
|
|
; RUN: llc -mtriple=arm-eabi -mattr=+v4t -addr-sink-using-gep=1 %s -o - | FileCheck %s
|
|
|
|
; <rdar://problem/8686347>
|
|
|
|
define i32 @test1(i1 %a, i32* %b) {
|
|
; CHECK: test1
|
|
entry:
|
|
br i1 %a, label %lblock, label %rblock
|
|
|
|
lblock:
|
|
%lbranch = getelementptr i32* %b, i32 1
|
|
br label %end
|
|
|
|
rblock:
|
|
%rbranch = getelementptr i32* %b, i32 1
|
|
br label %end
|
|
|
|
end:
|
|
; CHECK: ldr r0, [r1, #4]
|
|
%gep = phi i32* [%lbranch, %lblock], [%rbranch, %rblock]
|
|
%r = load i32* %gep
|
|
; CHECK-NEXT: bx lr
|
|
ret i32 %r
|
|
}
|