[PATCH] D86383: [GlobalISel] Fold xor(cmp(pred, _, _), 1) -> cmp(inverse(pred), _, _)

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 11:56:06 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2153-2165
+    if (!mi_match(CstReg, MRI, m_ICst(Cst)))
+      return false;
+    // For i1, Cst will always be -1 regardless of boolean contents.
+    if (!(Ty.getSizeInBits() == 1 && Cst == -1) && !isConstTrueVal(TLI, Cst))
+      return false;
+  } else {
+    // For vectors, look for a build vector splat of true.
----------------
I think this isConstTrue logic should be merged into a separate function (at least the getScalarSizeInBits() == 1 case and check TLI for the extended version should be together)


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2172
+    // Try fcmp.
+    if (!mi_match(XorSrc, MRI, m_GFCmp(m_Pred(), m_Reg(), m_Reg())))
+      return false;
----------------
I guess technically TargetBooleanContents also depends on isFloat in the fcmp case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86383



More information about the llvm-commits mailing list