[PATCH] D105344: [DAGCombiner] Fold SETCC(FREEZE(x),const) to FREEZE(SETCC(x,const)) if SETCC is used by BRCOND

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 26 13:41:57 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10250
+  // This is correct if SETCC(FREEZE(X), CONST, Cond) isn't equivalent to true
+  // or false.
+  // For example, SETCC(FREEZE(X), -128, SETULT) cannot be folded to
----------------
Maybe worth calling out the one-use constraint in this comment?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10260
+                         ISD::isUnsignedIntSetCC(Cond) ||
+                         ISD::isIntEqualitySetCC(Cond);
+  if (PreferSetCC && IsIntComparison) {
----------------
I don't think the IsIntComparison check does anything.  The cod codes are shared between int and fp ops.  The way to check if you have an integer comparison is just to check the types of the operands... which you're implicitly doing by casting to ConstantSDNode.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105344



More information about the llvm-commits mailing list