[PATCH] D38133: [CGP] Make optimizeMemoryInst introduce a select/phi if it improves things

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 07:22:58 PDT 2017


john.brawn created this revision.
Herald added a subscriber: javed.absar.
Herald added a reviewer: dberlin.

r309397 made a change to GVN which in some cases causes getelementptrs to be conditionalised in a way that makes them unable to be folded into a later load/store, which has caused several large benchmark regressions on Cortex-M CPUs. However this isn't something that can be solved in GVN, as often it's only after later optimisation that we know whether the getelementptr can be folded or not.

This patch solves this by modifying optimizeMemoryInst in CodeGenPrepare to make it capable of handling multiple addressing modes at once and coping with the differences by introducing a phi or select of the differing part. This has the effect of undoing the earlier GVN translation, but only when we end up with a getelementptr that can be folded into the load/store. This fixes some, but not all, of the regressions we've seen.


Repository:
  rL LLVM

https://reviews.llvm.org/D38133

Files:
  lib/CodeGen/CodeGenPrepare.cpp
  test/CodeGen/X86/tail-merge-identical.ll
  test/CodeGen/X86/x86-cmov-converter.ll
  test/Transforms/CodeGenPrepare/ARM/sink-addrmode.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38133.116182.patch
Type: text/x-patch
Size: 24100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170921/e03b7dd1/attachment.bin>


More information about the llvm-commits mailing list