[all-commits] [llvm/llvm-project] 97a7bc: [gvn] Precisely propagate equalities to phi operands
Philip Reames via All-commits
all-commits at lists.llvm.org
Mon Mar 8 08:59:31 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 97a7bc5831152eabcd61e5b970c054ce67c2c91b
https://github.com/llvm/llvm-project/commit/97a7bc5831152eabcd61e5b970c054ce67c2c91b
Author: Philip Reames <listmail at philipreames.com>
Date: 2021-03-08 (Mon, 08 Mar 2021)
Changed paths:
M llvm/include/llvm/IR/Dominators.h
M llvm/lib/IR/Dominators.cpp
M llvm/lib/Transforms/Utils/Local.cpp
M llvm/test/Transforms/GVN/phi.ll
Log Message:
-----------
[gvn] Precisely propagate equalities to phi operands
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(Edge, Use), and simply extends it to dominates(BB, Use).
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.
Differential Revision: https://reviews.llvm.org/D98082
More information about the All-commits
mailing list