Skip to content

Commit 06150e8

Browse files
committed
[ValueTracking] Add computeKnownBits DemandedElts support to AND instructions (PR36319)
1 parent 9f981e9 commit 06150e8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,8 +1104,8 @@ static void computeKnownBitsFromOperator(const Operator *I,
11041104
break;
11051105
case Instruction::And: {
11061106
// If either the LHS or the RHS are Zero, the result is zero.
1107-
computeKnownBits(I->getOperand(1), Known, Depth + 1, Q);
1108-
computeKnownBits(I->getOperand(0), Known2, Depth + 1, Q);
1107+
computeKnownBits(I->getOperand(1), DemandedElts, Known, Depth + 1, Q);
1108+
computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
11091109

11101110
// Output known-1 bits are only known if set in both the LHS & RHS.
11111111
Known.One &= Known2.One;

llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ define <4 x i32> @avx2_psrav_d_128_masked_shuffle(<4 x i32> %v, <4 x i32> %a) {
26932693
; CHECK-LABEL: @avx2_psrav_d_128_masked_shuffle(
26942694
; CHECK-NEXT: [[TMP1:%.*]] = and <4 x i32> [[A:%.*]], <i32 undef, i32 undef, i32 15, i32 31>
26952695
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
2696-
; CHECK-NEXT: [[TMP3:%.*]] = tail call <4 x i32> @llvm.x86.avx2.psrav.d(<4 x i32> [[V:%.*]], <4 x i32> [[TMP2]])
2696+
; CHECK-NEXT: [[TMP3:%.*]] = ashr <4 x i32> [[V:%.*]], [[TMP2]]
26972697
; CHECK-NEXT: ret <4 x i32> [[TMP3]]
26982698
;
26992699
%1 = and <4 x i32> %a, <i32 undef, i32 undef, i32 15, i32 31>

0 commit comments

Comments
 (0)