[PATCH] D99908: [GlobalISel] Simplify G_ICMP against true/false when boolean contents are 0/1

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 5 17:07:00 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3908
+  assert(MI.getOpcode() == TargetOpcode::G_ICMP);
+  if (!KB)
+    return false;
----------------
Is this actually optional?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3917
+    return false;
+  if (getICmpTrueVal(getTargetLowering(), /* IsVector = */ false,
+                     /*IsFP = */ false) != 1)
----------------
Might as well just handle vectors and pass through isVector?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3934
+  Builder.setInstrAndDebugLoc(MI);
+  Builder.buildZExtOrTrunc(Dst, LHS);
+  MI.eraseFromParent();
----------------
This will be the wrong extension type for zero or neg1 boolean


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

https://reviews.llvm.org/D99908



More information about the llvm-commits mailing list