[llvm] [SelectionDAG] Optimize MPI for align(1) GEPs using base pointer (PR #145309)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 05:18:45 PDT 2025


================
@@ -4597,7 +4598,25 @@ void SelectionDAGBuilder::visitLoad(const LoadInst &I) {
   const MDNode *Ranges = getRangeMetadata(I);
   bool isVolatile = I.isVolatile();
   MachineMemOperand::Flags MMOFlags =
-      TLI.getLoadMemOperandFlags(I, DAG.getDataLayout(), AC, LibInfo);
+      TLI.getLoadMemOperandFlags(I, DL, AC, LibInfo);
+
+  // See visitStore comments.
+  int64_t Offset = 0;
+  if (auto *GEP = dyn_cast<GetElementPtrInst>(SV);
+      GEP && Alignment == Align(1)) {
----------------
arsenm wrote:

Align of 1 shouldn't be special. But isn't this already refined in the middle end? We shouldn't need to redo this analysis during codegen. Given the test changes, we probably didn't bother to refine the alignment of kernel argument loads or something

https://github.com/llvm/llvm-project/pull/145309


More information about the llvm-commits mailing list