[llvm] [WIP][SLP] Allow external uses to exist as both an extract and a rematerialization during the pass (PR #211680)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 18:03:32 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 -- llvm/lib/Transforms/Vectorize/SLPVectorizer.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/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 31ff66606..13f4e1afc 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -25616,7 +25616,8 @@ Value *BoUpSLP::vectorizeTree(
Value *Vec = E->VectorizedValue;
assert(Vec && "Can't find vectorizable value");
- auto ExtractAndExtendIfNeeded = [&](Value *Vec, bool ExtractAnyways = false) {
+ auto ExtractAndExtendIfNeeded = [&](Value *Vec,
+ bool ExtractAnyways = false) {
if (isa<InsertValueInst>(Scalar))
return Vec;
if (Scalar->getType() != Vec->getType()) {
@@ -25782,7 +25783,8 @@ Value *BoUpSLP::vectorizeTree(
if (!Inst)
return;
if (ExternalUsesAsOriginalScalar.contains(Inst)) {
- Value *ReplacedExtract = ExtractAndExtendIfNeeded(Vec, /*ExtractAnyways*/true);
+ Value *ReplacedExtract =
+ ExtractAndExtendIfNeeded(Vec, /*ExtractAnyways*/ true);
auto *EI = dyn_cast<ExtractElementInst>(ReplacedExtract);
auto *RI = dyn_cast<Instruction>(Replacement);
assert(EI && RI && "Expected to find underlying instructions");
@@ -27748,7 +27750,8 @@ void BoUpSLP::scheduleBlock(const BoUpSLP &R, BlockScheduling *BS) {
PickedInst->moveAfter(LastScheduledInst->getPrevNode());
LastScheduledInst = PickedInst;
if (auto *EI = DE.lookupExtract(PickedInst)) {
- assert(EI->getParent() == PickedInst->getParent() && "Expected extract to be in same block as rematerialize version");
+ assert(EI->getParent() == PickedInst->getParent() &&
+ "Expected extract to be in same block as rematerialize version");
// Keep deferred extract/remat instructions contiguous in the scheduled
// suffix so the scheduling frontier always points at a valid anchor.
if (EI->getNextNode() != LastScheduledInst)
``````````
</details>
https://github.com/llvm/llvm-project/pull/211680
More information about the llvm-commits
mailing list