[llvm] [InstSimplify] Fix Inconsistent PHI Simplification (PR #113037)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 06:29:42 PDT 2024


================
@@ -5288,6 +5288,54 @@ Value *llvm::simplifyExtractElementInst(Value *Vec, Value *Idx,
   return ::simplifyExtractElementInst(Vec, Idx, Q, RecursionLimit);
 }
 
+static Value *getCommonPHIValue(Value *PreviousCommon, Value *Current,
+                                const SimplifyQuery &Q) {
+  if (!PreviousCommon)
+    return Current;
+
+  if (PreviousCommon == Current)
+    return PreviousCommon;
----------------
arsenm wrote:

```suggestion
  if (!PreviousCommon || PreviousCommon == Current)
    return Current;

```

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


More information about the llvm-commits mailing list