Add the ability to use GEPs for address sinking in CGP

Press ? to show keyboard shortcuts.
Committed
hfinkelApr 11 2014, 5:59 PM
Parents
rL206091: CodeGen: Test instrumentation based profiling of templates
Branches
Unknown
Tags
Unknown
Subscribers
None
Description

Add the ability to use GEPs for address sinking in CGP

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).

rL206092

llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp

Loading...

llvm/trunk/test/CodeGen/ARM/phi.ll

Loading...

llvm/trunk/test/CodeGen/ARM64/dagcombiner-indexed-load.ll

Loading...

llvm/trunk/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll

Loading...

llvm/trunk/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll

Loading...

llvm/trunk/test/CodeGen/X86/MergeConsecutiveStores.ll

Loading...

llvm/trunk/test/CodeGen/X86/codegen-prepare-addrmode-sext.ll

Loading...

llvm/trunk/test/CodeGen/X86/codegen-prepare.ll

Loading...

llvm/trunk/test/CodeGen/X86/isel-sink.ll

Loading...

llvm/trunk/test/CodeGen/X86/merge_store.ll

Loading...

llvm/trunk/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll

Loading...

llvm/trunk/test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll

Loading...

Add Comment