[PATCH] D114555: [ScalarEvolution] Add bailout to avoid zext of pointer.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 11:42:16 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb2837bf2f22a: [ScalarEvolution] Add bailout to avoid zext of pointer. (authored by efriedma).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114555/new/
https://reviews.llvm.org/D114555
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -10919,7 +10919,8 @@
// For unsigned and equality predicates, try to prove that both found
// operands fit into narrow unsigned range. If so, try to prove facts in
// narrow types.
- if (!CmpInst::isSigned(FoundPred) && !FoundLHS->getType()->isPointerTy()) {
+ if (!CmpInst::isSigned(FoundPred) && !FoundLHS->getType()->isPointerTy() &&
+ !FoundRHS->getType()->isPointerTy()) {
auto *NarrowType = LHS->getType();
auto *WideType = FoundLHS->getType();
auto BitWidth = getTypeSizeInBits(NarrowType);
@@ -10937,7 +10938,7 @@
}
}
- if (LHS->getType()->isPointerTy())
+ if (LHS->getType()->isPointerTy() || RHS->getType()->isPointerTy())
return false;
if (CmpInst::isSigned(Pred)) {
LHS = getSignExtendExpr(LHS, FoundLHS->getType());
@@ -10948,7 +10949,7 @@
}
} else if (getTypeSizeInBits(LHS->getType()) >
getTypeSizeInBits(FoundLHS->getType())) {
- if (FoundLHS->getType()->isPointerTy())
+ if (FoundLHS->getType()->isPointerTy() || FoundRHS->getType()->isPointerTy())
return false;
if (CmpInst::isSigned(FoundPred)) {
FoundLHS = getSignExtendExpr(FoundLHS, LHS->getType());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114555.404643.patch
Type: text/x-patch
Size: 1400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220131/0fceb041/attachment.bin>
More information about the llvm-commits
mailing list