[llvm] [GlobalISel] Avoid redundant copy for zero-offset GEPs (PR #203029)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 02:33:39 PDT 2026


================
@@ -1661,6 +1661,9 @@ bool IRTranslator::translateGetElementPtr(const User &U,
     WantSplatVector = VectorWidth > 1;
   }
 
+  if (cast<GEPOperator>(U).hasAllZeroIndices())
----------------
aengelke wrote:

This doesn't handle vector geps (`getelementptr i8, ptr %a, <4 x i32> zeroinitializer`). Ok, right now it does, but when ConstantInt will be used to represent vector splats, it won't. Can you add a test for this, also with `--use-constant-int-for-fixed-length-splat`?

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


More information about the llvm-commits mailing list