File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
test/CodeGen/AArch64/GlobalISel Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -2925,8 +2925,10 @@ bool CombinerHelper::matchCombineInsertVecElts(
2925
2925
}
2926
2926
return true ;
2927
2927
}
2928
- // If we didn't end in a G_IMPLICIT_DEF, bail out.
2929
- return TmpInst->getOpcode () == TargetOpcode::G_IMPLICIT_DEF;
2928
+ // If we didn't end in a G_IMPLICIT_DEF and the source is not fully
2929
+ // overwritten, bail out.
2930
+ return TmpInst->getOpcode () == TargetOpcode::G_IMPLICIT_DEF ||
2931
+ all_of (MatchInfo, [](Register Reg) { return !!Reg; });
2930
2932
}
2931
2933
2932
2934
void CombinerHelper::applyCombineInsertVecElts (
Original file line number Diff line number Diff line change @@ -220,6 +220,37 @@ body: |
220
220
$x0 = COPY %extract(s64)
221
221
RET_ReallyLR implicit $x0
222
222
223
+ ...
224
+ ---
225
+ # This test checks that this combine runs after the insertvec->build_vector
226
+ name : extract_from_insert2
227
+ tracksRegLiveness : true
228
+ liveins :
229
+ - { reg: '$x0' }
230
+ - { reg: '$x1' }
231
+ frameInfo :
232
+ maxAlignment : 1
233
+ body : |
234
+ bb.1:
235
+ liveins: $q0, $x0, $x1
236
+ ; CHECK-LABEL: name: extract_from_insert2
237
+ ; CHECK: liveins: $q0, $x0, $x1
238
+ ; CHECK-NEXT: {{ $}}
239
+ ; CHECK-NEXT: %arg1:_(s64) = COPY $x0
240
+ ; CHECK-NEXT: %arg2:_(s64) = COPY $x1
241
+ ; CHECK-NEXT: %ins2:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
242
+ ; CHECK-NEXT: $q0 = COPY %ins2(<2 x s64>)
243
+ ; CHECK-NEXT: RET_ReallyLR implicit $q0
244
+ %arg0:_(<2 x s64>) = COPY $q0
245
+ %arg1:_(s64) = COPY $x0
246
+ %arg2:_(s64) = COPY $x1
247
+ %zero:_(s32) = G_CONSTANT i32 0
248
+ %one:_(s32) = G_CONSTANT i32 1
249
+ %ins1:_(<2 x s64>) = G_INSERT_VECTOR_ELT %arg0, %arg1(s64), %zero(s32)
250
+ %ins2:_(<2 x s64>) = G_INSERT_VECTOR_ELT %ins1, %arg2(s64), %one(s32)
251
+ $q0 = COPY %ins2(<2 x s64>)
252
+ RET_ReallyLR implicit $q0
253
+
223
254
...
224
255
---
225
256
name : extract_from_idx_negative
You can’t perform that action at this time.
0 commit comments