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 {
2870
2870
return false ;
2871
2871
2872
2872
unsigned ShiftWidth = TypeSize - 1 ;
2873
- Value *OpL = nullptr , *OpR = nullptr ;
2873
+ Value *Op ;
2874
2874
2875
2875
// This is the representation of signum we match:
2876
2876
//
@@ -2882,11 +2882,11 @@ template <typename Opnd_t> struct Signum_match {
2882
2882
//
2883
2883
// for i1 values.
2884
2884
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);
2888
2888
2889
- return Signum.match (V) && OpL == OpR && Val.match (OpL );
2889
+ return Signum.match (V) && Val.match (Op );
2890
2890
}
2891
2891
};
2892
2892
Original file line number Diff line number Diff line change @@ -152,6 +152,19 @@ define i1 @test4a(i32 %a) {
152
152
ret i1 %c
153
153
}
154
154
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
+
155
168
define <2 x i1 > @test4a_vec (<2 x i32 > %a ) {
156
169
; CHECK-LABEL: @test4a_vec(
157
170
; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> [[A:%.*]], splat (i32 1)
You can’t perform that action at this time.
0 commit comments