summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-09-21 16:26:41 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-09-21 16:26:41 +0000
commitefb4d34bcf83191cac46e346af323b5a8b21c823 (patch)
treeecc83395b99d3d209697ea46a71359b800177e10 /llvm/lib/Transforms
parent29ebecb11ab538cab4247a064fba51e61f0a2b9c (diff)
downloadbcm5719-llvm-efb4d34bcf83191cac46e346af323b5a8b21c823.tar.gz
bcm5719-llvm-efb4d34bcf83191cac46e346af323b5a8b21c823.zip
InstCombine: Make sure we use the pre-zext type when creating a constant of a value that is zext'd.
Fixes PR13250. llvm-svn: 164377
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 2a7182fc1d4..3361a1e7fbe 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -477,7 +477,8 @@ Instruction *InstCombiner::visitUDiv(BinaryOperator &I) {
if (match(Op1, m_Shl(m_Power2(CI), m_Value(N))) ||
match(Op1, m_ZExt(m_Shl(m_Power2(CI), m_Value(N))))) {
if (*CI != 1)
- N = Builder->CreateAdd(N, ConstantInt::get(I.getType(),CI->logBase2()));
+ N = Builder->CreateAdd(N,
+ ConstantInt::get(N->getType(), CI->logBase2()));
if (ZExtInst *Z = dyn_cast<ZExtInst>(Op1))
N = Builder->CreateZExt(N, Z->getDestTy());
if (I.isExact())
OpenPOWER on IntegriCloud