[llvm] [InstCombine] fold (Binop phi(a, b) phi(b, a)) -> (Binop a, b) while Binop is commutative. (PR #75765)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 03:42:21 PST 2023


================
@@ -278,6 +278,16 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
                                               IntrinsicInst &Tramp);
   Instruction *foldCommutativeIntrinsicOverSelects(IntrinsicInst &II);
 
+  // match a pair of Phi Nodes like
+  // phi [a, BB0], [b, BB1] & phi [b, BB0], [a, BB1]
+  // return the matched two operands
----------------
nikic wrote:

```suggestion
  // Return the matched two operands.
```

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


More information about the llvm-commits mailing list