[PATCH] D94350: [GlobalISel] Combine (a[0]) | (a[1] << k1) | ...| (a[m] << kn) into a wide load

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 10:55:10 PST 2021


aemerson added a comment.

We also need to check for the strict-align function attribute before we generate wider loads.



================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3294
+  int64_t Shift;
+  if (!mi_match(Reg, MRI, m_GShl(m_Reg(MaybeLoad), m_ICst(Shift)))) {
+    Shift = 0;
----------------
Nit: I think you can use m_OneUse() on the load and remove the check below, but you may need to add a variant for m_OneNonDbgUse().


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3303
+  // TODO: Handle other types of loads.
+  auto *Load = getOpcodeDef(TargetOpcode::G_ZEXTLOAD, MaybeLoad, MRI);
+  if (!Load)
----------------
I think G_ZEXTLOADs are the only valid loads we can match here? Otherwise we can't merge the values with G_OR.


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

https://reviews.llvm.org/D94350



More information about the llvm-commits mailing list