aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorJeffrey Byrnes <jeffrey.byrnes@amd.com>2024-10-09 14:30:09 -0700
committerGitHub <noreply@github.com>2024-10-09 14:30:09 -0700
commit853c43d04a378c379e49db552e856f02a5ad9216 (patch)
tree7cb97bddecdca4ff746ff8a1815d63558cb0433f /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent35684fa4bc8d2288d479cb8aa9d275b14bfefead (diff)
downloadllvm-853c43d04a378c379e49db552e856f02a5ad9216.zip
llvm-853c43d04a378c379e49db552e856f02a5ad9216.tar.gz
llvm-853c43d04a378c379e49db552e856f02a5ad9216.tar.bz2
[TTI] NFC: Port TLI.shouldSinkOperands to TTI (#110564)
Porting to TTI provides direct access to the instruction cost model, which can enable instruction cost based sinking without introducing code duplication.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 631cc26..3e09fba 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -7274,7 +7274,7 @@ bool CodeGenPrepare::optimizeShiftInst(BinaryOperator *Shift) {
// We can't do this effectively in SDAG because we may not be able to
// determine if the select operands are splats from within a basic block.
Type *Ty = Shift->getType();
- if (!Ty->isVectorTy() || !TLI->isVectorShiftByScalarCheap(Ty))
+ if (!Ty->isVectorTy() || !TTI->isVectorShiftByScalarCheap(Ty))
return false;
Value *Cond, *TVal, *FVal;
if (!match(Shift->getOperand(1),
@@ -7309,7 +7309,7 @@ bool CodeGenPrepare::optimizeFunnelShift(IntrinsicInst *Fsh) {
// We can't do this effectively in SDAG because we may not be able to
// determine if the select operands are splats from within a basic block.
Type *Ty = Fsh->getType();
- if (!Ty->isVectorTy() || !TLI->isVectorShiftByScalarCheap(Ty))
+ if (!Ty->isVectorTy() || !TTI->isVectorShiftByScalarCheap(Ty))
return false;
Value *Cond, *TVal, *FVal;
if (!match(Fsh->getOperand(2),
@@ -7566,7 +7566,7 @@ bool CodeGenPrepare::tryToSinkFreeOperands(Instruction *I) {
// If the operands of I can be folded into a target instruction together with
// I, duplicate and sink them.
SmallVector<Use *, 4> OpsToSink;
- if (!TLI->shouldSinkOperands(I, OpsToSink))
+ if (!TTI->isProfitableToSinkOperands(I, OpsToSink))
return false;
// OpsToSink can contain multiple uses in a use chain (e.g.