Skip to content

Commit 4802be7

Browse files
committed
address review comments
1 parent 4811b7d commit 4802be7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3025,7 +3025,7 @@ static Value *simplifyICmpWithConstant(CmpPredicate Pred, Value *LHS,
30253025
*MulC != 0 && C->srem(*MulC) != 0)))
30263026
return ConstantInt::get(ITy, Pred == ICmpInst::ICMP_NE);
30273027

3028-
if (ICmpInst::isGE(Pred) && C->isOne() && isKnownNonZero(LHS, Q))
3028+
if (Pred == ICmpInst::ICMP_UGE && C->isOne() && isKnownNonZero(LHS, Q))
30293029
return ConstantInt::getTrue(ITy);
30303030

30313031
return nullptr;

llvm/test/Transforms/InstCombine/ceil-shift.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ define i32 @ceil_shift_should_infer_ge_zero(i32 %x) {
295295
br i1 %cond, label %if.then, label %if.else
296296

297297
if.then:
298-
%12 = lshr i32 %x, 20
299-
%13 = and i32 %x, 1048575
300-
%14 = icmp ne i32 %13, 0
301-
%15 = zext i1 %14 to i32
302-
%16 = add nuw nsw i32 %12, %15
303-
%max = call i32 @llvm.umax.i32(i32 %16, i32 1)
298+
%quot = lshr i32 %x, 20
299+
%rem = and i32 %x, 1048575
300+
%has_rem = icmp ne i32 %rem, 0
301+
%zext_has_rem = zext i1 %has_rem to i32
302+
%ceil = add nuw nsw i32 %quot, %zext_has_rem
303+
%max = call i32 @llvm.umax.i32(i32 %ceil, i32 1)
304304
ret i32 %max
305305

306306
if.else:

0 commit comments

Comments
 (0)