diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-11-08 21:08:02 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-11-08 21:08:02 +0000 |
commit | 0bae8b2cfbd157ea0341ccf3506684ab67fd6515 (patch) | |
tree | 31232348af37aaf1b9c949d3342e11659b9932b3 /llvm | |
parent | 9bd86daa9521b77972aa3d9038d1c6db7e9c215b (diff) | |
download | bcm5719-llvm-0bae8b2cfbd157ea0341ccf3506684ab67fd6515.tar.gz bcm5719-llvm-0bae8b2cfbd157ea0341ccf3506684ab67fd6515.zip |
Fix code to match comment. Fixes PR11340, a regression from r143209.
llvm-svn: 144121
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/InstSimplify/compare.ll | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index c1416328b74..2f41f729568 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -1612,7 +1612,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, Lower = (-Upper) + 1; } else if (match(LHS, m_UDiv(m_ConstantInt(CI2), m_Value()))) { // 'udiv CI2, x' produces [0, CI2]. - Upper = CI2->getValue(); + Upper = CI2->getValue() + 1; } else if (match(LHS, m_UDiv(m_Value(), m_ConstantInt(CI2)))) { // 'udiv x, CI2' produces [0, UINT_MAX / CI2]. APInt NegOne = APInt::getAllOnesValue(Width); diff --git a/llvm/test/Transforms/InstSimplify/compare.ll b/llvm/test/Transforms/InstSimplify/compare.ll index db5e72f9db4..9f3dffe603f 100644 --- a/llvm/test/Transforms/InstSimplify/compare.ll +++ b/llvm/test/Transforms/InstSimplify/compare.ll @@ -342,6 +342,16 @@ define i1 @udiv5(i32 %X) { ; CHECK: ret i1 false } +; PR11340 +define i1 @udiv6(i32 %X) nounwind { +; CHECK: @udiv6 + %A = udiv i32 1, %X + %C = icmp eq i32 %A, 0 + ret i1 %C +; CHECK: ret i1 %C +} + + define i1 @sdiv1(i32 %X) { ; CHECK: @sdiv1 %A = sdiv i32 %X, 1000000 |