File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -4897,6 +4897,12 @@ SDValue DAGCombiner::visitUDIV(SDNode *N) {
4897
4897
if (SDValue DivRem = useDivRem(N))
4898
4898
return DivRem;
4899
4899
4900
+ // Simplify the operands using demanded-bits information.
4901
+ // We don't have demanded bits support for UDIV so this just enables constant
4902
+ // folding based on known bits.
4903
+ if (SimplifyDemandedBits(SDValue(N, 0)))
4904
+ return SDValue(N, 0);
4905
+
4900
4906
return SDValue();
4901
4907
}
4902
4908
Original file line number Diff line number Diff line change
1
+ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2
+ ; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
3
+
4
+ define i8 @PR108728 (i1 %a0 ) {
5
+ ; CHECK-LABEL: PR108728:
6
+ ; CHECK: # %bb.0:
7
+ ; CHECK-NEXT: xorl %eax, %eax
8
+ ; CHECK-NEXT: retq
9
+ %sel = select i1 %a0 , i8 0 , i8 1
10
+ %not = xor i8 %sel , -1
11
+ %udiv = udiv i8 1 , %not
12
+ %cnt = tail call i8 @llvm.ctpop.i8 (i8 %udiv )
13
+ ret i8 %cnt
14
+ }
You can’t perform that action at this time.
0 commit comments