[llvm] 99336bf - [ValueTracking] Add computeKnownBits DemandedElts support to masked add instructions (PR36319)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 18 14:51:14 PDT 2020
Author: Simon Pilgrim
Date: 2020-03-18T21:50:56Z
New Revision: 99336bf95ab6abe4e4f3244ea132d3d074a222d9
URL: https://github.com/llvm/llvm-project/commit/99336bf95ab6abe4e4f3244ea132d3d074a222d9
DIFF: https://github.com/llvm/llvm-project/commit/99336bf95ab6abe4e4f3244ea132d3d074a222d9.diff
LOG: [ValueTracking] Add computeKnownBits DemandedElts support to masked add instructions (PR36319)
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstSimplify/add-mask.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index f1adc037d17f..56243c3f3723 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1121,7 +1121,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
if (!Known.Zero[0] && !Known.One[0] &&
match(I, m_c_BinOp(m_Value(X), m_Add(m_Deferred(X), m_Value(Y))))) {
Known2.resetAll();
- computeKnownBits(Y, Known2, Depth + 1, Q);
+ computeKnownBits(Y, DemandedElts, Known2, Depth + 1, Q);
if (Known2.countMinTrailingOnes() > 0)
Known.Zero.setBit(0);
}
diff --git a/llvm/test/Transforms/InstSimplify/add-mask.ll b/llvm/test/Transforms/InstSimplify/add-mask.ll
index fe384e338b8f..cd0c87198120 100644
--- a/llvm/test/Transforms/InstSimplify/add-mask.ll
+++ b/llvm/test/Transforms/InstSimplify/add-mask.ll
@@ -13,11 +13,7 @@ define i1 @test1(i32 %a) {
define i1 @test1v(<2 x i32> %a) {
; CHECK-LABEL: @test1v(
-; CHECK-NEXT: [[RHS:%.*]] = add <2 x i32> [[A:%.*]], <i32 -1, i32 0>
-; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[A]], [[RHS]]
-; CHECK-NEXT: [[EXT:%.*]] = extractelement <2 x i32> [[AND]], i32 0
-; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[EXT]], 1
-; CHECK-NEXT: ret i1 [[RES]]
+; CHECK-NEXT: ret i1 false
;
%rhs = add <2 x i32> %a, <i32 -1, i32 0>
%and = and <2 x i32> %a, %rhs
@@ -38,11 +34,7 @@ define i1 @test2(i32 %a) {
define i1 @test2v(<2 x i32> %a) {
; CHECK-LABEL: @test2v(
-; CHECK-NEXT: [[RHS:%.*]] = add <2 x i32> [[A:%.*]], <i32 0, i32 1>
-; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[A]], [[RHS]]
-; CHECK-NEXT: [[EXT:%.*]] = extractelement <2 x i32> [[AND]], i32 1
-; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[EXT]], 1
-; CHECK-NEXT: ret i1 [[RES]]
+; CHECK-NEXT: ret i1 false
;
%rhs = add <2 x i32> %a, <i32 0, i32 1>
%and = and <2 x i32> %a, %rhs
@@ -63,11 +55,7 @@ define i1 @test3(i32 %a) {
define i1 @test3v(<2 x i32> %a) {
; CHECK-LABEL: @test3v(
-; CHECK-NEXT: [[RHS:%.*]] = add <2 x i32> [[A:%.*]], <i32 7, i32 0>
-; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[A]], [[RHS]]
-; CHECK-NEXT: [[EXT:%.*]] = extractelement <2 x i32> [[AND]], i32 0
-; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[EXT]], 1
-; CHECK-NEXT: ret i1 [[RES]]
+; CHECK-NEXT: ret i1 false
;
%rhs = add <2 x i32> %a, <i32 7, i32 0>
%and = and <2 x i32> %a, %rhs
@@ -140,11 +128,7 @@ define i1 @test6(i32 %a) {
define i1 @test6v(<2 x i32> %a) {
; CHECK-LABEL: @test6v(
-; CHECK-NEXT: [[LHS:%.*]] = add <2 x i32> [[A:%.*]], <i32 0, i32 -1>
-; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[LHS]], [[A]]
-; CHECK-NEXT: [[EXT:%.*]] = extractelement <2 x i32> [[AND]], i32 1
-; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[EXT]], 1
-; CHECK-NEXT: ret i1 [[RES]]
+; CHECK-NEXT: ret i1 false
;
%lhs = add <2 x i32> %a, <i32 0, i32 -1>
%and = and <2 x i32> %lhs, %a
More information about the llvm-commits
mailing list