[llvm] [TTI] NFC: Port TLI.shouldSinkOperands to TTI (PR #110564)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 17:15:10 PDT 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 18fa9fa0439d483060cee42412926565838822d4 6e9fd1b530ea112f2d04ebdc706413e17d92e2ba --extensions h,cpp -- llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/include/llvm/CodeGen/TargetLowering.h llvm/lib/Analysis/TargetTransformInfo.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.h llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/lib/Target/ARM/ARMISelLowering.h llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp llvm/lib/Target/ARM/ARMTargetTransformInfo.h llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVISelLowering.h llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Target/X86/X86ISelLowering.h llvm/lib/Target/X86/X86TargetTransformInfo.cpp llvm/lib/Target/X86/X86TargetTransformInfo.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 605b568c93..e4a785e914 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -1749,7 +1749,8 @@ public:
/// instruction during instruction selection. After calling the function
/// \p Ops contains the Uses to sink ordered by dominance (dominating users
/// come first).
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
struct VPLegalization {
enum VPTransform {
@@ -2189,8 +2190,9 @@ public:
virtual bool supportsScalableVectors() const = 0;
virtual bool hasActiveVectorLength(unsigned Opcode, Type *DataType,
Align Alignment) const = 0;
- virtual bool isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &OpsToSink) const = 0;
+ virtual bool
+ isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &OpsToSink) const = 0;
virtual VPLegalization
getVPLegalizationStrategy(const VPIntrinsic &PI) const = 0;
virtual bool hasArmWideBranch(bool Thumb) const = 0;
@@ -2962,7 +2964,7 @@ public:
}
bool isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const override {
+ SmallVectorImpl<Use *> &Ops) const override {
return Impl.isProfitableToSinkOperands(I, Ops);
};
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 1235324fc2..2b59ab50c7 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -968,7 +968,8 @@ public:
return false;
}
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const {
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const {
return false;
}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index a5a0d9de2d..14274f8541 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -4820,8 +4820,8 @@ static bool shouldSinkVScale(Value *Op, SmallVectorImpl<Use *> &Ops) {
/// Check if sinking \p I's operands to I's basic block is profitable, because
/// the operands can be folded into a target instruction, e.g.
/// shufflevectors extracts and/or sext/zext can be folded into (u,s)subl(2).
-bool AArch64TTIImpl::isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const {
+bool AArch64TTIImpl::isProfitableToSinkOperands(
+ Instruction *I, SmallVectorImpl<Use *> &Ops) const {
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
switch (II->getIntrinsicID()) {
case Intrinsic::aarch64_neon_smull:
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
index 62b0b2ef6d..1d09d67f6e 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
@@ -435,7 +435,8 @@ public:
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
const TargetTransformInfo::LSRCost &C2);
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
/// @}
};
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
index 0d72086e66..0e051bf6e8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
@@ -1191,7 +1191,7 @@ InstructionCost GCNTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
/// Instruction I to the basic block of I.
/// This helps using several modifiers (like abs and neg) more often.
bool GCNTTIImpl::isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const {
+ SmallVectorImpl<Use *> &Ops) const {
using namespace PatternMatch;
for (auto &Op : I->operands()) {
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
index 501e5e6d44..30da002376 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
@@ -237,7 +237,8 @@ public:
ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr);
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
bool areInlineCompatible(const Function *Caller,
const Function *Callee) const;
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index b5af691d65..835ae98efb 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -2683,7 +2683,7 @@ static bool areExtractExts(Value *Ext1, Value *Ext2) {
/// the operands can be folded into a target instruction, e.g.
/// sext/zext can be folded into vsubl.
bool ARMTTIImpl::isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const {
+ SmallVectorImpl<Use *> &Ops) const {
using namespace PatternMatch;
if (!I->getType()->isVectorTy())
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
index 31b68dfc5f..b0a75134ee 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -335,7 +335,8 @@ public:
bool hasArmWideBranch(bool Thumb) const;
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
/// @}
};
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 64b4699b1c..0d3906d472 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -2381,8 +2381,8 @@ bool RISCVTTIImpl::canSplatOperand(Instruction *I, int Operand) const {
/// Check if sinking \p I's operands to I's basic block is profitable, because
/// the operands can be folded into a target instruction, e.g.
/// splats of scalars can fold into vector instructions.
-bool RISCVTTIImpl::isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const {
+bool RISCVTTIImpl::isProfitableToSinkOperands(
+ Instruction *I, SmallVectorImpl<Use *> &Ops) const {
using namespace llvm::PatternMatch;
if (!I->getType()->isVectorTy() || !ST->hasVInstructions())
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index b57517159d..3f50bd86b9 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -419,7 +419,8 @@ public:
/// able to splat the given operand.
bool canSplatOperand(unsigned Opcode, int Operand) const;
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
};
} // end namespace llvm
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
index 0c65cf5a06..9fe5e5f27f 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
@@ -155,8 +155,8 @@ bool WebAssemblyTTIImpl::supportsTailCalls() const {
return getST()->hasTailCall();
}
-bool WebAssemblyTTIImpl::isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const {
+bool WebAssemblyTTIImpl::isProfitableToSinkOperands(
+ Instruction *I, SmallVectorImpl<Use *> &Ops) const {
using namespace llvm::PatternMatch;
if (!I->getType()->isVectorTy() || !I->isShift())
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
index a932e679f9..2ce6cbf3ba 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
@@ -77,7 +77,8 @@ public:
bool supportsTailCalls() const;
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
/// @}
};
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index fb4cb78ba3..22008919f7 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -6918,7 +6918,7 @@ static bool isVectorShiftByScalarCheap(Type *Ty, const X86Subtarget *ST) {
}
bool X86TTIImpl::isProfitableToSinkOperands(Instruction *I,
- SmallVectorImpl<Use *> &Ops) const {
+ SmallVectorImpl<Use *> &Ops) const {
using namespace llvm::PatternMatch;
FixedVectorType *VTy = dyn_cast<FixedVectorType>(I->getType());
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.h b/llvm/lib/Target/X86/X86TargetTransformInfo.h
index fe9205c031..5995fb7586 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.h
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.h
@@ -297,7 +297,8 @@ public:
InstructionCost getBranchMispredictPenalty() const;
- bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops) const;
+ bool isProfitableToSinkOperands(Instruction *I,
+ SmallVectorImpl<Use *> &Ops) const;
private:
bool supportsGather() const;
``````````
</details>
https://github.com/llvm/llvm-project/pull/110564
More information about the llvm-commits
mailing list