mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +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
32 lines
1.0 KiB
LLVM
32 lines
1.0 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 | FileCheck %s
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -addr-sink-using-gep=1 | FileCheck %s
|
|
|
|
define void @merge_store(i32* nocapture %a) {
|
|
; CHECK-LABEL: merge_store:
|
|
; CHECK: movq
|
|
; CHECK: movq
|
|
entry:
|
|
br label %for.body
|
|
|
|
for.body:
|
|
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
|
|
%arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
|
|
store i32 1, i32* %arrayidx, align 4
|
|
%0 = or i64 %indvars.iv, 1
|
|
%arrayidx2 = getelementptr inbounds i32* %a, i64 %0
|
|
store i32 1, i32* %arrayidx2, align 4
|
|
%1 = or i64 %indvars.iv, 2
|
|
%arrayidx5 = getelementptr inbounds i32* %a, i64 %1
|
|
store i32 1, i32* %arrayidx5, align 4
|
|
%2 = or i64 %indvars.iv, 3
|
|
%arrayidx8 = getelementptr inbounds i32* %a, i64 %2
|
|
store i32 1, i32* %arrayidx8, align 4
|
|
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 4
|
|
%3 = trunc i64 %indvars.iv.next to i32
|
|
%cmp = icmp slt i32 %3, 1000
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end:
|
|
ret void
|
|
}
|