aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-02-27 16:36:07 +0100
committerNikita Popov <npopov@redhat.com>2023-02-27 16:47:16 +0100
commit86d1ed9e480849ff57dfee23975165465ebe0fc8 (patch)
treef66b4abd42e7404e2486fb3e766d367041cd4756 /llvm/lib/Analysis/InlineCost.cpp
parent9a29d87538842a29b430c6956a4f914896643691 (diff)
downloadllvm-86d1ed9e480849ff57dfee23975165465ebe0fc8.zip
llvm-86d1ed9e480849ff57dfee23975165465ebe0fc8.tar.gz
llvm-86d1ed9e480849ff57dfee23975165465ebe0fc8.tar.bz2
[InlineCost] Avoid ConstantExpr::getSelect()
Instead use ConstantFoldSelectInstruction(), which will return nullptr if it cannot be folded and a constant expression would be produced instead. In preparation for removing select constant expressions.
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 5bcc8a2..f303670 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -2314,10 +2314,10 @@ bool CallAnalyzer::visitSelectInst(SelectInst &SI) {
: nullptr;
if (!SelectedV) {
// Condition is a vector constant that is not all 1s or all 0s. If all
- // operands are constants, ConstantExpr::getSelect() can handle the cases
- // such as select vectors.
+ // operands are constants, ConstantFoldSelectInstruction() can handle the
+ // cases such as select vectors.
if (TrueC && FalseC) {
- if (auto *C = ConstantExpr::getSelect(CondC, TrueC, FalseC)) {
+ if (auto *C = ConstantFoldSelectInstruction(CondC, TrueC, FalseC)) {
SimplifiedValues[&SI] = C;
return true;
}