[llvm] [Hexagon] Track type locally in HexagonVectorCombine (PR #179066)
Jameson Nash via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 31 12:53:04 PST 2026
https://github.com/vtjnash created https://github.com/llvm/llvm-project/pull/179066
Replace getAllocatedType calls with tracked types from alloca creation. The types are known at the CreateAlloca call sites, so we track them locally instead of re-querying through getAllocatedType, to facilitate someday possibly removing getAllocatedType from the API of AllocaInst.
>From fa7424402fc90f8e97576b5eb554ac5571502538 Mon Sep 17 00:00:00 2001
From: Jameson Nash <vtjnash+github at gmail.com>
Date: Wed, 28 Jan 2026 16:16:02 +0000
Subject: [PATCH] [Hexagon] Track type locally in HexagonVectorCombine
Replace getAllocatedType calls with tracked types from alloca creation.
The types are known at the CreateAlloca call sites, so we track them
locally instead of re-querying through getAllocatedType.
Co-Authored-By: Claude Sonnet 4.5 <noreply at anthropic.com>
---
llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
index af7663b0a00dc..1c41a251f494e 100644
--- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
@@ -2239,13 +2239,13 @@ Value *HvxIdioms::processVScatter(Instruction &In) const {
Value *CastIndex = nullptr;
if (cstDataVector) {
// Our indexes are represented as a constant. We need it in a reg.
- AllocaInst *IndexesAlloca =
- Builder.CreateAlloca(HVC.getHvxTy(HVC.getIntTy(32), false));
+ Type *IndexVectorType = HVC.getHvxTy(HVC.getIntTy(32), false);
+ AllocaInst *IndexesAlloca = Builder.CreateAlloca(IndexVectorType);
[[maybe_unused]] auto *StoreIndexes =
Builder.CreateStore(cstDataVector, IndexesAlloca);
LLVM_DEBUG(dbgs() << " StoreIndexes : " << *StoreIndexes << "\n");
- CastIndex = Builder.CreateLoad(IndexesAlloca->getAllocatedType(),
- IndexesAlloca, "reload_index");
+ CastIndex = Builder.CreateLoad(IndexVectorType, IndexesAlloca,
+ "reload_index");
} else {
if (ElemWidth == 2)
CastIndex = getReinterpretiveCast_i16_to_i32(HVC, Builder, Ctx, Indexes);
@@ -2622,8 +2622,8 @@ Value *HvxIdioms::processVGather(Instruction &In) const {
[[maybe_unused]] auto *StoreIndexes =
Builder.CreateStore(cstDataVector, IndexesAlloca);
LLVM_DEBUG(dbgs() << " StoreIndexes : " << *StoreIndexes << "\n");
- Value *LoadedIndex = Builder.CreateLoad(
- IndexesAlloca->getAllocatedType(), IndexesAlloca, "reload_index");
+ Value *LoadedIndex =
+ Builder.CreateLoad(NT, IndexesAlloca, "reload_index");
AllocaInst *ResultAlloca = Builder.CreateAlloca(NT);
LLVM_DEBUG(dbgs() << " ResultAlloca : " << *ResultAlloca << "\n");
@@ -2703,8 +2703,8 @@ Value *HvxIdioms::processVGather(Instruction &In) const {
[[maybe_unused]] auto *StoreIndexes =
Builder.CreateStore(cstDataVector, IndexesAlloca);
LLVM_DEBUG(dbgs() << " StoreIndexes : " << *StoreIndexes << "\n");
- Value *LoadedIndex = Builder.CreateLoad(
- IndexesAlloca->getAllocatedType(), IndexesAlloca, "reload_index");
+ Value *LoadedIndex =
+ Builder.CreateLoad(NT, IndexesAlloca, "reload_index");
AllocaInst *ResultAlloca = Builder.CreateAlloca(NT);
LLVM_DEBUG(dbgs() << " ResultAlloca : " << *ResultAlloca
<< "\n AddressSpace: "
More information about the llvm-commits
mailing list