[PATCH] D98082: [gvn] Precisely propagate equalities to phi operands

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 15:17:38 PST 2021


reames created this revision.
reames added reviewers: fhahn, nikic, jdoerfert.
Herald added subscribers: dantrushin, hiraditya, mcrosier.
Herald added a reviewer: bollu.
reames requested review of this revision.
Herald added a project: LLVM.

The code used for propagating equalities (e.g. assume facts) was conservative in two ways - one of which this patch fixes.  Specifically, it shifts the code reasoning about whether a use is dominated by the end of the assume block to consider phi uses to exist on the predecessor edge.  This matches the dominator tree handling for dominates(X, Use), and simply extends it to properlyDominates.

Note that the decision to use the end of the block is itself a conservative choice.  The more precise option would be to use the later of the assume and the value, and replace all uses after that.  GVN handles that case separately (with the replace operand mechanism) because it used to be expensive to ask dominator questions within blocks.  With the new instruction ordering support, we should probably rewrite this code at some point to simplify.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98082

Files:
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/GVN/phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98082.328662.patch
Type: text/x-patch
Size: 3954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210305/6b59e1f9/attachment.bin>


More information about the llvm-commits mailing list