[llvm] [AArch64] Fix codegen for histograms with i64 increments (PR #181808)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 01:24:06 PST 2026


================
@@ -6555,8 +6555,12 @@ void SelectionDAGBuilder::visitVectorHistogram(const CallInst &I,
   }
 
   EVT IdxVT = Index.getValueType();
-  EVT EltTy = IdxVT.getVectorElementType();
-  if (TLI.shouldExtendGSIndex(IdxVT, EltTy)) {
+
+  // Avoid using nxv4i32 as index type when the increment must be performed
+  // on i64's.
+  bool MustExtendIndex = VT == MVT::i64 && IdxVT.getScalarSizeInBits() < 64;
+  EVT EltTy = MustExtendIndex ? VT : IdxVT.getVectorElementType();
+  if (TLI.shouldExtendGSIndex(IdxVT, EltTy) || MustExtendIndex) {
----------------
arsenm wrote:

```suggestion
  if (MustExtendIndex || TLI.shouldExtendGSIndex(IdxVT, EltTy)) {
```

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


More information about the llvm-commits mailing list