[llvm] 0eafef1 - [SCEVExpander] Remove handling for mixed int/pointer min/max (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 06:11:48 PDT 2022
Author: Nikita Popov
Date: 2022-05-10T15:11:39+02:00
New Revision: 0eafef117117d84027506486348a72480670aefa
URL: https://github.com/llvm/llvm-project/commit/0eafef117117d84027506486348a72480670aefa
DIFF: https://github.com/llvm/llvm-project/commit/0eafef117117d84027506486348a72480670aefa.diff
LOG: [SCEVExpander] Remove handling for mixed int/pointer min/max (NFCI)
Mixed int/pointer min/max are no longer possible.
Added:
Modified:
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 19b482654f659..e6bfe6f28810c 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -1674,13 +1674,6 @@ Value *SCEVExpander::expandSMaxExpr(const SCEVNAryExpr *S) {
Value *LHS = expand(S->getOperand(S->getNumOperands()-1));
Type *Ty = LHS->getType();
for (int i = S->getNumOperands()-2; i >= 0; --i) {
- // In the case of mixed integer and pointer types, do the
- // rest of the comparisons as integer.
- Type *OpTy = S->getOperand(i)->getType();
- if (OpTy->isIntegerTy() != Ty->isIntegerTy()) {
- Ty = SE.getEffectiveSCEVType(Ty);
- LHS = InsertNoopCastOfTo(LHS, Ty);
- }
Value *RHS = expandCodeForImpl(S->getOperand(i), Ty, false);
Value *Sel;
if (Ty->isIntegerTy())
@@ -1692,10 +1685,6 @@ Value *SCEVExpander::expandSMaxExpr(const SCEVNAryExpr *S) {
}
LHS = Sel;
}
- // In the case of mixed integer and pointer types, cast the
- // final result back to the pointer type.
- if (LHS->getType() != S->getType())
- LHS = InsertNoopCastOfTo(LHS, S->getType());
return LHS;
}
@@ -1703,13 +1692,6 @@ Value *SCEVExpander::expandUMaxExpr(const SCEVNAryExpr *S) {
Value *LHS = expand(S->getOperand(S->getNumOperands()-1));
Type *Ty = LHS->getType();
for (int i = S->getNumOperands()-2; i >= 0; --i) {
- // In the case of mixed integer and pointer types, do the
- // rest of the comparisons as integer.
- Type *OpTy = S->getOperand(i)->getType();
- if (OpTy->isIntegerTy() != Ty->isIntegerTy()) {
- Ty = SE.getEffectiveSCEVType(Ty);
- LHS = InsertNoopCastOfTo(LHS, Ty);
- }
Value *RHS = expandCodeForImpl(S->getOperand(i), Ty, false);
Value *Sel;
if (Ty->isIntegerTy())
@@ -1721,10 +1703,6 @@ Value *SCEVExpander::expandUMaxExpr(const SCEVNAryExpr *S) {
}
LHS = Sel;
}
- // In the case of mixed integer and pointer types, cast the
- // final result back to the pointer type.
- if (LHS->getType() != S->getType())
- LHS = InsertNoopCastOfTo(LHS, S->getType());
return LHS;
}
@@ -1732,13 +1710,6 @@ Value *SCEVExpander::expandSMinExpr(const SCEVNAryExpr *S) {
Value *LHS = expand(S->getOperand(S->getNumOperands() - 1));
Type *Ty = LHS->getType();
for (int i = S->getNumOperands() - 2; i >= 0; --i) {
- // In the case of mixed integer and pointer types, do the
- // rest of the comparisons as integer.
- Type *OpTy = S->getOperand(i)->getType();
- if (OpTy->isIntegerTy() != Ty->isIntegerTy()) {
- Ty = SE.getEffectiveSCEVType(Ty);
- LHS = InsertNoopCastOfTo(LHS, Ty);
- }
Value *RHS = expandCodeForImpl(S->getOperand(i), Ty, false);
Value *Sel;
if (Ty->isIntegerTy())
@@ -1750,10 +1721,6 @@ Value *SCEVExpander::expandSMinExpr(const SCEVNAryExpr *S) {
}
LHS = Sel;
}
- // In the case of mixed integer and pointer types, cast the
- // final result back to the pointer type.
- if (LHS->getType() != S->getType())
- LHS = InsertNoopCastOfTo(LHS, S->getType());
return LHS;
}
@@ -1761,13 +1728,6 @@ Value *SCEVExpander::expandUMinExpr(const SCEVNAryExpr *S) {
Value *LHS = expand(S->getOperand(S->getNumOperands() - 1));
Type *Ty = LHS->getType();
for (int i = S->getNumOperands() - 2; i >= 0; --i) {
- // In the case of mixed integer and pointer types, do the
- // rest of the comparisons as integer.
- Type *OpTy = S->getOperand(i)->getType();
- if (OpTy->isIntegerTy() != Ty->isIntegerTy()) {
- Ty = SE.getEffectiveSCEVType(Ty);
- LHS = InsertNoopCastOfTo(LHS, Ty);
- }
Value *RHS = expandCodeForImpl(S->getOperand(i), Ty, false);
Value *Sel;
if (Ty->isIntegerTy())
@@ -1779,10 +1739,6 @@ Value *SCEVExpander::expandUMinExpr(const SCEVNAryExpr *S) {
}
LHS = Sel;
}
- // In the case of mixed integer and pointer types, cast the
- // final result back to the pointer type.
- if (LHS->getType() != S->getType())
- LHS = InsertNoopCastOfTo(LHS, S->getType());
return LHS;
}
More information about the llvm-commits
mailing list