[llvm] [Matrix] Place allocas in function entry. (PR #190032)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 04:37:26 PDT 2026
================
@@ -1950,14 +1952,16 @@ class LowerMatrixIntrinsics {
setExplicitlyUnknownBranchWeightsIfProfiled(*BR2, DEBUG_TYPE);
// Copy load operand to new alloca.
- Builder.SetInsertPoint(Copy, Copy->begin());
auto *VT = cast<FixedVectorType>(Load->getType());
// Use an array type for the alloca, to avoid potentially huge alignment
// requirements for large vector types.
auto *ArrayTy = ArrayType::get(VT->getElementType(), VT->getNumElements());
+ IRBuilder<> AllocaBuilder(&Func.getEntryBlock().front());
AllocaInst *Alloca =
- Builder.CreateAlloca(ArrayTy, Load->getPointerAddressSpace());
+ AllocaBuilder.CreateAlloca(ArrayTy, Load->getPointerAddressSpace());
+ Builder.SetInsertPoint(Copy, Copy->begin());
+ Builder.CreateLifetimeStart(Alloca);
----------------
fhahn wrote:
Sounds good, I updated the code to emit it before the conditional check, thanks
https://github.com/llvm/llvm-project/pull/190032
More information about the llvm-commits
mailing list