Skip to content

Commit ea26b16

Browse files
committed
changes based on comments
1 parent 81c6c90 commit ea26b16

File tree

7 files changed

+235
-305
lines changed

7 files changed

+235
-305
lines changed

llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class CombinerHelper {
145145

146146
/// \return true if \p Query is legal on the target, or if \p Query will
147147
/// perform WidenScalar action on the target.
148-
bool isLegalorHasWidenScalar(const LegalityQuery &Query) const;
148+
bool isLegalOrHasWidenScalar(const LegalityQuery &Query) const;
149149

150150
/// \return true if the combine is running prior to legalization, or if \p Ty
151151
/// is a legal integer constant type on the target.

llvm/include/llvm/Target/GlobalISel/Combine.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,13 +1131,13 @@ def form_bitfield_extract : GICombineGroup<[bitfield_extract_from_sext_inreg,
11311131

11321132
def udiv_by_const : GICombineRule<
11331133
(defs root:$root),
1134-
(match (wip_match_opcode G_UDIV):$root,
1134+
(match (G_UDIV $dst, $x, $y):$root,
11351135
[{ return Helper.matchUDivorURemByConst(*${root}); }]),
11361136
(apply [{ Helper.applyUDivorURemByConst(*${root}); }])>;
11371137

11381138
def sdiv_by_const : GICombineRule<
11391139
(defs root:$root),
1140-
(match (wip_match_opcode G_SDIV):$root,
1140+
(match (G_SDIV $dst, $x, $y):$root,
11411141
[{ return Helper.matchSDivByConst(*${root}); }]),
11421142
(apply [{ Helper.applySDivByConst(*${root}); }])>;
11431143

@@ -1153,8 +1153,8 @@ def udiv_by_pow2 : GICombineRule<
11531153
[{ return Helper.matchDivByPow2(*${root}, /*IsSigned=*/false); }]),
11541154
(apply [{ Helper.applyUDivByPow2(*${root}); }])>;
11551155

1156-
def intdiv_combines : GICombineGroup<[udiv_by_const, sdiv_by_const,
1157-
sdiv_by_pow2, udiv_by_pow2]>;
1156+
def intdiv_combines : GICombineGroup<[udiv_by_pow2, sdiv_by_pow2,
1157+
udiv_by_const, sdiv_by_const,]>;
11581158

11591159
def urem_by_const : GICombineRule<
11601160
(defs root:$root),

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ bool CombinerHelper::isLegalOrBeforeLegalizer(
162162
return isPreLegalize() || isLegal(Query);
163163
}
164164

165-
bool CombinerHelper::isLegalorHasWidenScalar(const LegalityQuery &Query) const {
165+
bool CombinerHelper::isLegalOrHasWidenScalar(const LegalityQuery &Query) const {
166166
return isLegal(Query) ||
167167
LI->getAction(Query).Action == LegalizeActions::WidenScalar;
168168
}
@@ -5557,7 +5557,7 @@ bool CombinerHelper::matchSDivByConst(MachineInstr &MI) const {
55575557
if (!isLegalOrBeforeLegalizer({TargetOpcode::G_MUL, {DstTy, DstTy}}))
55585558
return false;
55595559
if (!isLegal({TargetOpcode::G_SMULH, {DstTy}}) &&
5560-
!isLegalorHasWidenScalar({TargetOpcode::G_MUL, {WideTy, WideTy}}))
5560+
!isLegalOrHasWidenScalar({TargetOpcode::G_MUL, {WideTy, WideTy}}))
55615561
return false;
55625562
}
55635563

llvm/test/CodeGen/AArch64/aarch64-bit-gen.ll

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,12 @@ define <4 x i32> @test_bit_sink_operand(<4 x i32> %src, <4 x i32> %dst, <4 x i32
229229
; CHECK-GI: // %bb.0: // %entry
230230
; CHECK-GI-NEXT: sub sp, sp, #32
231231
; CHECK-GI-NEXT: .cfi_def_cfa_offset 32
232-
; CHECK-GI-NEXT: // kill: def $w0 killed $w0 def $x0
233-
; CHECK-GI-NEXT: sxtw x9, w0
232+
; CHECK-GI-NEXT: asr w9, w0, #31
234233
; CHECK-GI-NEXT: mov w8, wzr
235234
; CHECK-GI-NEXT: add x10, sp, #16
236235
; CHECK-GI-NEXT: mov x11, sp
237-
; CHECK-GI-NEXT: sub x9, x9, x9, lsl #31
238-
; CHECK-GI-NEXT: asr x9, x9, #32
239-
; CHECK-GI-NEXT: add w9, w9, w0
240-
; CHECK-GI-NEXT: add w9, w9, w9, lsr #31
236+
; CHECK-GI-NEXT: add w9, w0, w9, lsr #31
237+
; CHECK-GI-NEXT: asr w9, w9, #1
241238
; CHECK-GI-NEXT: .LBB11_1: // %do.body
242239
; CHECK-GI-NEXT: // =>This Inner Loop Header: Depth=1
243240
; CHECK-GI-NEXT: bit v1.16b, v0.16b, v2.16b

0 commit comments

Comments
 (0)