[PATCH] D109130: [GlobalISel] Combine icmp eq/ne x, 0/1 -> x when x == 0 or 1

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 14:00:40 PDT 2021


aemerson added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4152
+  LLT LHSTy = MRI.getType(LHS);
+  const auto LHSSize = LHSTy.getSizeInBits();
+  const auto DstSize = DstTy.getSizeInBits();
----------------
s/const auto/unsigned


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4156
+  if (DstSize != LHSSize)
+    Op = DstSize < LHSSize ? TargetOpcode::G_TRUNC : TargetOpcode::G_ZEXT;
+  if (!isLegalOrBeforeLegalizer({Op, {DstTy, LHSTy}}))
----------------
Test for the G_ZEXT case?


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

https://reviews.llvm.org/D109130



More information about the llvm-commits mailing list