[llvm] [GVN] Restrict equality propagation for pointers (PR #82458)

Usman Nadeem via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 10:37:30 PDT 2024


================
@@ -433,12 +433,29 @@ unsigned replaceNonLocalUsesWith(Instruction *From, Value *To);
 
 /// Replace each use of 'From' with 'To' if that use is dominated by
 /// the given edge.  Returns the number of replacements made.
-unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT,
+unsigned replaceDominatedUsesWith(Value *From, Value *To, const DataLayout &DL,
+                                  DominatorTree &DT,
                                   const BasicBlockEdge &Edge);
 /// Replace each use of 'From' with 'To' if that use is dominated by
 /// the end of the given BasicBlock. Returns the number of replacements made.
-unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT,
-                                  const BasicBlock *BB);
+unsigned replaceDominatedUsesWith(Value *From, Value *To, const DataLayout &DL,
+                                  DominatorTree &DT, const BasicBlock *BB);
+/// Replace each use of 'From' with 'To' if that use is dominated by
+/// the given edge and the callback ShouldReplace returns true. Returns the
+/// number of replacements made.
+unsigned replaceDominatedUsesWithIf(
+    Value *From, Value *To, const DataLayout &DL, DominatorTree &DT,
+    const BasicBlockEdge &Edge,
+    function_ref<bool(const Use &U, const Value *To, const DataLayout &DL)>
+        ShouldReplace);
+/// Replace each use of 'From' with 'To' if that use is dominated by
+/// the end of the given BasicBlock and the callback ShouldReplace returns true.
+/// Returns the number of replacements made.
+unsigned replaceDominatedUsesWithIf(
+    Value *From, Value *To, const DataLayout &DL, DominatorTree &DT,
+    const BasicBlock *BB,
+    function_ref<bool(const Use &U, const Value *To, const DataLayout &DL)>
+        ShouldReplace);
----------------
UsmanNadeem wrote:

Done!

https://github.com/llvm/llvm-project/pull/82458


More information about the llvm-commits mailing list