[PATCH] D109357: [GlobalISel] Add a combine for and(load , mask) -> zextload

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 09:19:51 PDT 2021


paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:654
+
+  if (!MaybeMask->Value.isMask())
+    return false;
----------------
Pull this into a variable and reuse it in `NewSize`?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:666
+                              LoadMI->getMemSizeInBits());
+  if (NewSize < 8 || !isPowerOf2_32(NewSize))
+    return false;
----------------
May want a comment explaining why we don't want powers of 2 under 8.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:673
+  if (!isLegalOrBeforeLegalizer({TargetOpcode::G_ZEXTLOAD,
+                                 {MRI.getType(LoadMI->getDstReg()),
+                                  MRI.getType(LoadMI->getPointerReg())},
----------------
Reuse `LoadReg`?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:681
+}
+void CombinerHelper::applyCombineLoadWithAndMask(
+    MachineInstr &MI, std::tuple<Register, unsigned> &MatchInfo) {
----------------
Maybe use `applyBuildFn` instead of creating a new `apply` function?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109357



More information about the llvm-commits mailing list