aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 1b2615d4..d2c6ffe 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -1223,7 +1223,9 @@ Instruction *InstCombinerImpl::visitZExt(ZExtInst &Zext) {
if (!Zext.hasNonNeg()) {
// If this zero extend is only used by a shift, add nneg flag.
- if (Zext.hasOneUse() && SrcTy->getScalarSizeInBits() > 2 &&
+ if (Zext.hasOneUse() &&
+ SrcTy->getScalarSizeInBits() >
+ Log2_64_Ceil(DestTy->getScalarSizeInBits()) &&
match(Zext.user_back(), m_Shift(m_Value(), m_Specific(&Zext)))) {
Zext.setNonNeg();
return &Zext;