[PATCH] D126268: [InstCombine] [NFC] refector foldXorOfICmps

Chenbing.Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 01:11:11 PDT 2022


Chenbing.Zheng added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3000
+    if (LHS0 == RHS1 && LHS1 == RHS0)
+      std::swap(LHS0, LHS1);
+    if (LHS0 == RHS0 && LHS1 == RHS1) {
----------------
RKSimon wrote:
> If the if() below fails - doesn't this leave the LHS0/LHS1 operands in a commuted state further down?
(LHS0 == RHS1 && LHS1 == RHS0) is true, means (LHS0 == RHS0 && LHS1 == RHS1) must be true.
In other words, if do swap, we must go to the next conditional branch.

I think this is consistent with the original logic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126268/new/

https://reviews.llvm.org/D126268



More information about the llvm-commits mailing list