[llvm] [LVI][SCCP] Avoid copying ValueLatticeElement (PR #163901)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 11:00:37 PDT 2025


================
@@ -634,11 +634,11 @@ class SCCPInstVisitor : public InstVisitor<SCCPInstVisitor> {
   /// Merge \p MergeWithV into \p IV and push \p V to the worklist, if \p IV
   /// changes.
   bool mergeInValue(ValueLatticeElement &IV, Value *V,
-                    ValueLatticeElement MergeWithV,
+                    const ValueLatticeElement &MergeWithV,
                     ValueLatticeElement::MergeOptions Opts = {
                         /*MayIncludeUndef=*/false, /*CheckWiden=*/false});
 
-  bool mergeInValue(Value *V, ValueLatticeElement MergeWithV,
+  bool mergeInValue(Value *V, const ValueLatticeElement &MergeWithV,
----------------
dtcxzyw wrote:

I have removed the helper function to avoid implicit invalidations. Hopefully it makes the implementation cleaner.


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


More information about the llvm-commits mailing list