Skip to content

Commit f502ab7

Browse files
committed
[InstCombine] Add test for #62450 (NFC)
1 parent e96adfd commit f502ab7

File tree

1 file changed

+13
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+13
-0
lines changed

llvm/test/Transforms/InstCombine/ctpop.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,16 @@ define i32 @parity_xor_extra_use2(i32 %arg, i32 %arg1) {
475475
%i5 = xor i32 %i2, %i4
476476
ret i32 %i5
477477
}
478+
479+
define i32 @select_ctpop_zero(i32 %x) {
480+
; CHECK-LABEL: @select_ctpop_zero(
481+
; CHECK-NEXT: [[CTPOP:%.*]] = call i32 @llvm.ctpop.i32(i32 [[X:%.*]]), !range [[RNG1]]
482+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0
483+
; CHECK-NEXT: [[RES:%.*]] = select i1 [[CMP]], i32 0, i32 [[CTPOP]]
484+
; CHECK-NEXT: ret i32 [[RES]]
485+
;
486+
%ctpop = call i32 @llvm.ctpop.i32(i32 %x)
487+
%cmp = icmp eq i32 %x, 0
488+
%res = select i1 %cmp, i32 0, i32 %ctpop
489+
ret i32 %res
490+
}

0 commit comments

Comments
 (0)