[llvm] Consolidate infrastructure for exanding scalable intrinsics [NFC] (PR #195309)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 10:57:36 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h llvm/lib/Transforms/Utils/BasicBlockUtils.cpp llvm/lib/Transforms/Utils/LoopUtils.cpp llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index c839944f8..1035fe3bd 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -1683,10 +1683,10 @@ llvm::SplitBlockAndInsertSimpleForLoop(Value *End,
BasicBlock::iterator SplitBefore,
DominatorTree *DT, LoopInfo *LI) {
BasicBlock *LoopPred = SplitBefore->getParent();
- BasicBlock *LoopBody = SplitBlock(SplitBefore->getParent(), SplitBefore,
- DT, LI, /*MSSAU=*/nullptr, "ec.loop");
- BasicBlock *LoopExit = SplitBlock(SplitBefore->getParent(), SplitBefore,
- DT, LI, /*MSSAU=*/nullptr, "ec.exit");
+ BasicBlock *LoopBody = SplitBlock(SplitBefore->getParent(), SplitBefore, DT,
+ LI, /*MSSAU=*/nullptr, "ec.loop");
+ BasicBlock *LoopExit = SplitBlock(SplitBefore->getParent(), SplitBefore, DT,
+ LI, /*MSSAU=*/nullptr, "ec.exit");
auto *Ty = End->getType();
auto &DL = SplitBefore->getDataLayout();
@@ -1725,8 +1725,8 @@ llvm::SplitBlockAndInsertSimpleForLoop(Value *End,
void llvm::SplitBlockAndInsertForEachLane(
ElementCount EC, Type *IndexTy, BasicBlock::iterator InsertBefore,
- std::function<void(IRBuilderBase &, Value *)> Func,
- DominatorTree *DT, LoopInfo *LI) {
+ std::function<void(IRBuilderBase &, Value *)> Func, DominatorTree *DT,
+ LoopInfo *LI) {
IRBuilder<> IRB(InsertBefore->getParent(), InsertBefore);
@@ -1734,7 +1734,7 @@ void llvm::SplitBlockAndInsertForEachLane(
Value *NumElements = IRB.CreateElementCount(IndexTy, EC);
auto [BodyIP, Index] =
- SplitBlockAndInsertSimpleForLoop(NumElements, InsertBefore, DT, LI);
+ SplitBlockAndInsertSimpleForLoop(NumElements, InsertBefore, DT, LI);
IRB.SetInsertPoint(BodyIP);
Func(IRB, Index);
@@ -1750,8 +1750,8 @@ void llvm::SplitBlockAndInsertForEachLane(
void llvm::SplitBlockAndInsertForEachLane(
Value *EVL, BasicBlock::iterator InsertBefore,
- std::function<void(IRBuilderBase &, Value *)> Func,
- DominatorTree *DT, LoopInfo *LI) {
+ std::function<void(IRBuilderBase &, Value *)> Func, DominatorTree *DT,
+ LoopInfo *LI) {
IRBuilder<> IRB(InsertBefore->getParent(), InsertBefore);
Type *Ty = EVL->getType();
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index e5093a54b..a7573551d 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1345,25 +1345,23 @@ Value *llvm::expandReductionViaLoop(IRBuilderBase &Builder, Value *Vec,
const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
Type *IdxTy = DL.getIndexType(EltTy->getContext(), 0);
- Value *NumElts = Builder.CreateElementCount(IdxTy,
- VTy->getElementCount());
+ Value *NumElts = Builder.CreateElementCount(IdxTy, VTy->getElementCount());
- auto [BodyIP, IV] =
- SplitBlockAndInsertSimpleForLoop(NumElts, Builder.GetInsertPoint(),
- DT, LI);
+ auto [BodyIP, IV] = SplitBlockAndInsertSimpleForLoop(
+ NumElts, Builder.GetInsertPoint(), DT, LI);
BasicBlock *LoopBB = BodyIP->getParent();
auto *IVPhi = cast<PHINode>(IV);
BasicBlock *Preheader =
- IVPhi->getIncomingBlock(IVPhi->getIncomingBlock(0) == LoopBB);
+ IVPhi->getIncomingBlock(IVPhi->getIncomingBlock(0) == LoopBB);
PHINode *AccPhi = PHINode::Create(EltTy, 2, "rdx.acc", BodyIP);
AccPhi->addIncoming(Acc, Preheader);
Builder.SetInsertPoint(BodyIP);
Value *Elt = Builder.CreateExtractElement(Vec, IV);
- Value *Res = Builder.CreateBinOp((Instruction::BinaryOps)RdxOpcode,
- AccPhi, Elt, "rdx.op");
+ Value *Res = Builder.CreateBinOp((Instruction::BinaryOps)RdxOpcode, AccPhi,
+ Elt, "rdx.op");
AccPhi->addIncoming(Res, LoopBB);
auto *ExitBr = cast<BranchInst>(LoopBB->getTerminator());
diff --git a/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp b/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp
index ecf1b0ca4..630f0e6a1 100644
--- a/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp
+++ b/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp
@@ -21,8 +21,7 @@ bool llvm::lowerUnaryVectorIntrinsicAsLoop(Module &M, CallInst *CI) {
Type *IdxTy = M.getDataLayout().getIndexType(CI->getContext(), 0);
IRBuilder<> Builder(CI);
- Value *LoopEnd =
- Builder.CreateElementCount(IdxTy, VecTy->getElementCount());
+ Value *LoopEnd = Builder.CreateElementCount(IdxTy, VecTy->getElementCount());
auto [BodyIP, IV] =
SplitBlockAndInsertSimpleForLoop(LoopEnd, CI->getIterator());
``````````
</details>
https://github.com/llvm/llvm-project/pull/195309
More information about the llvm-commits
mailing list