[llvm] [RISCV][DAG][TLI] Avoid scalarizing length decreasing shuffles (PR #115532)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 11:02:06 PST 2024
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 02668f60a9b5c0d5b8b6e60b4e897f763ad59a91 e30c3d522304ba9537b5581949d0004b3df72d4e --extensions h,cpp -- llvm/include/llvm/CodeGen/TargetLowering.h llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/Target/RISCV/RISCVISelLowering.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 5fe2b7949c..c143a07f27 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -548,10 +548,7 @@ public:
// In SDAG construction, should length decreasing shuffles be expanded
// to a sequence of extracts and inserts if they can't be recognized
// via the two extracted operand form?
- virtual bool
- shouldScalarizeLengthDescreasingShuffle() const {
- return true;
- }
+ virtual bool shouldScalarizeLengthDescreasingShuffle() const { return true; }
/// Return true if integer divide is usually cheaper than a sequence of
/// several shifts, adds, and multiplies for this target.
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index f4e011e4cd..ffe81e6229 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4185,14 +4185,14 @@ void SelectionDAGBuilder::visitShuffleVector(const User &I) {
// source operand width, then extract the original destination
// type.
if (!TLI.shouldScalarizeLengthDescreasingShuffle()) {
- EVT PaddedVT = EVT::getVectorVT(*DAG.getContext(), VT.getScalarType(),
- SrcNumElts);
+ EVT PaddedVT =
+ EVT::getVectorVT(*DAG.getContext(), VT.getScalarType(), SrcNumElts);
SmallVector<int, 8> ExtendedMask(Mask);
ExtendedMask.resize(SrcNumElts, -1);
SDValue Result =
- DAG.getVectorShuffle(PaddedVT, DL, Src1, Src2, ExtendedMask);
+ DAG.getVectorShuffle(PaddedVT, DL, Src1, Src2, ExtendedMask);
Result = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Result,
- DAG.getVectorIdxConstant(0, DL));
+ DAG.getVectorIdxConstant(0, DL));
setValue(&I, Result);
return;
}
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.h b/llvm/lib/Target/RISCV/RISCVISelLowering.h
index a8f385a59c..a9ccad30a2 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.h
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.h
@@ -586,8 +586,7 @@ public:
shouldExpandBuildVectorWithShuffles(EVT VT,
unsigned DefinedValues) const override;
- bool
- shouldScalarizeLengthDescreasingShuffle() const override {
+ bool shouldScalarizeLengthDescreasingShuffle() const override {
// We always prefer to pad as a canonical form.
return false;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/115532
More information about the llvm-commits
mailing list