mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +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
47 lines
1.6 KiB
LLVM
47 lines
1.6 KiB
LLVM
; RUN: llc -O3 < %s | FileCheck %s
|
|
; RUN: llc -O3 -addr-sink-using-gep=1 < %s | FileCheck %s
|
|
; Test case for a DAG combiner bug where we combined an indexed load
|
|
; with an extension (sext, zext, or any) into a regular extended load,
|
|
; i.e., dropping the indexed value.
|
|
; <rdar://problem/16389332>
|
|
|
|
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
|
|
target triple = "arm64-apple-ios"
|
|
|
|
%class.A = type { i64, i64 }
|
|
%class.C = type { i64 }
|
|
|
|
; CHECK-LABEL: XX:
|
|
; CHECK: ldr
|
|
define void @XX(%class.A* %K) {
|
|
entry:
|
|
br i1 undef, label %if.then, label %lor.rhs.i
|
|
|
|
lor.rhs.i: ; preds = %entry
|
|
%tmp = load i32* undef, align 4
|
|
%y.i.i.i = getelementptr inbounds %class.A* %K, i64 0, i32 1
|
|
%tmp1 = load i64* %y.i.i.i, align 8
|
|
%U.sroa.3.8.extract.trunc.i = trunc i64 %tmp1 to i32
|
|
%div11.i = sdiv i32 %U.sroa.3.8.extract.trunc.i, 17
|
|
%add12.i = add nsw i32 0, %div11.i
|
|
%U.sroa.3.12.extract.shift.i = lshr i64 %tmp1, 32
|
|
%U.sroa.3.12.extract.trunc.i = trunc i64 %U.sroa.3.12.extract.shift.i to i32
|
|
%div15.i = sdiv i32 %U.sroa.3.12.extract.trunc.i, 13
|
|
%add16.i = add nsw i32 %add12.i, %div15.i
|
|
%rem.i.i = srem i32 %add16.i, %tmp
|
|
%idxprom = sext i32 %rem.i.i to i64
|
|
%arrayidx = getelementptr inbounds %class.C** undef, i64 %idxprom
|
|
%tobool533 = icmp eq %class.C* undef, null
|
|
br i1 %tobool533, label %while.end, label %while.body
|
|
|
|
if.then: ; preds = %entry
|
|
unreachable
|
|
|
|
while.body: ; preds = %lor.rhs.i
|
|
unreachable
|
|
|
|
while.end: ; preds = %lor.rhs.i
|
|
%tmp3 = load %class.C** %arrayidx, align 8
|
|
unreachable
|
|
}
|