[PATCH] D124071: [1/3][NewGVN][LoadCoercion] Add support for load coercion between store and load instructions.

Konstantina Mitropoulou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 23:46:17 PDT 2022


kmitropoulou created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
kmitropoulou requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We collect all the load instructions that can be optimized with load coercion in
LoadCoercion map. The collection is done using existing functions from GVN
(analyzeLoadFromClobberingStore and analyzeLoadFromClobberingLoad). The actual
load coercion occurs before the elimination phase. This is due to the fact that
load coercion inserts new instrucctions which can be optimized further by
NewGVN.

Every load of the LoadCoercion map is replaced with a new sequence of
instructions which extract the right value from the depending instruction. This
is done using existing functions from GVN (getStoreValueForLoad() and
getLoadValueForLoad()).

Next, we check if there is any other load in the LoadCoercion map that can be
optimized using the sequence of instructions that we just generated.

Finally, we run value numbering for the newly generated instructions. In this
way, the new instructions will be added in the corresponding congruence classes
and they will be optimized by NewGVN during the elimination phase.

This is the first patch for load coercion. Two more patches will follow:

1. one patch for implementing load coercion between load instructions
2. one patch for implementing load coercion for load instructions that depend on memory phis.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124071

Files:
  llvm/lib/Transforms/Scalar/NewGVN.cpp
  llvm/test/Transforms/NewGVN/load_coercion_between_store_and_load.ll
  llvm/test/Transforms/NewGVN/pr14166-xfail.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124071.423825.patch
Type: text/x-patch
Size: 22487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/054113fd/attachment.bin>


More information about the llvm-commits mailing list