File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
test/Transforms/InstCombine Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -2870,7 +2870,7 @@ template <typename Opnd_t> struct Signum_match {
28702870 return false ;
28712871
28722872 unsigned ShiftWidth = TypeSize - 1 ;
2873- Value *OpL = nullptr , *OpR = nullptr ;
2873+ Value *Op ;
28742874
28752875 // This is the representation of signum we match:
28762876 //
@@ -2882,11 +2882,11 @@ template <typename Opnd_t> struct Signum_match {
28822882 //
28832883 // for i1 values.
28842884
2885- auto LHS = m_AShr (m_Value (OpL ), m_SpecificInt (ShiftWidth));
2886- auto RHS = m_LShr (m_Neg (m_Value (OpR )), m_SpecificInt (ShiftWidth));
2887- auto Signum = m_Or (LHS, RHS);
2885+ auto LHS = m_AShr (m_Value (Op ), m_SpecificInt (ShiftWidth));
2886+ auto RHS = m_LShr (m_Neg (m_Deferred (Op )), m_SpecificInt (ShiftWidth));
2887+ auto Signum = m_c_Or (LHS, RHS);
28882888
2889- return Signum.match (V) && OpL == OpR && Val.match (OpL );
2889+ return Signum.match (V) && Val.match (Op );
28902890 }
28912891};
28922892
Original file line number Diff line number Diff line change @@ -152,6 +152,19 @@ define i1 @test4a(i32 %a) {
152152 ret i1 %c
153153}
154154
155+ define i1 @test4a_commuted (i32 %a ) {
156+ ; CHECK-LABEL: @test4a_commuted(
157+ ; CHECK-NEXT: [[C:%.*]] = icmp slt i32 [[SIGNUM:%.*]], 1
158+ ; CHECK-NEXT: ret i1 [[C]]
159+ ;
160+ %l = ashr i32 %a , 31
161+ %na = sub i32 0 , %a
162+ %r = lshr i32 %na , 31
163+ %signum = or i32 %r , %l
164+ %c = icmp slt i32 %signum , 1
165+ ret i1 %c
166+ }
167+
155168define <2 x i1 > @test4a_vec (<2 x i32 > %a ) {
156169; CHECK-LABEL: @test4a_vec(
157170; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> [[A:%.*]], splat (i32 1)
You can’t perform that action at this time.
0 commit comments