[PATCH] D105545: Conditional store elimination

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 03:46:41 PDT 2021


chill created this revision.
Herald added subscribers: ormris, kerbowa, jfb, steven_wu, hiraditya, nhaehnle, jvesely.
chill requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch implements replacement of certain conditional stores with
unconditional ones (subject to constraints).

A triangle shaped part of the CFG like:

  header:
    ...
    br %cond, label %if.then, label %if.end
      
  if.then:
    store %s.new, %addr
    br label %if.end
      
  if.end:
     ...

would become

   header:
     ...
     br %cond, label %if.then, label %if.else
      
  if.then:
     br %if.end
      
  if.else:
    %s.old = load %addr
    br label %if.end
      
  if.end:
    %s = phi [%s.new, if.then], [%s.old, if.else]
    store %s, %addr

At the moment the patch considers only stores to local, non-escaping objects,
which stores are alone in the block.


https://reviews.llvm.org/D105545

Files:
  llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
  llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
  llvm/test/Other/opt-LTO-pipeline.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105545.356915.patch
Type: text/x-patch
Size: 21644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210707/7e81b234/attachment.bin>


More information about the llvm-commits mailing list