[PATCH] D16090: [SelectionDAG] Fold more offsets into GlobalAddresses

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 14:20:07 PST 2016


sunfish created this revision.
sunfish added a subscriber: llvm-commits.
sunfish set the repository for this revision to rL LLVM.
Herald added subscribers: dschuff, jfb.

SelectionDAG currently misses opportunities to fold constants into GlobalAddresses in several areas. For example, given `(add (add GA, c1), y)`, it often reassociates to `(add (add GA, y), c1)`, missing the opportunity to create `(add GA+c, y)`. This isn't often visible on targets such as X86 which effectively reassociate adds in their complex address-mode folding logic, however it is currently visible on WebAssembly since it currently has very simple address mode folding code that doesn't reassociate anything.

The attached patch fixes this by making SelectionDAG fold offsets into GlobalAddresses at the same times that it folds constants together, so that it doesn't miss any opportunities to perform such folding.

Repository:
  rL LLVM

http://reviews.llvm.org/D16090

Files:
  include/llvm/CodeGen/SelectionDAG.h
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  test/CodeGen/WebAssembly/address-offsets.ll
  test/CodeGen/X86/lea-opt.ll
  test/CodeGen/XCore/threads.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16090.44557.patch
Type: text/x-patch
Size: 37618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160111/fb0df0b0/attachment.bin>


More information about the llvm-commits mailing list