File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
test/Transforms/VectorCombine/AArch64 Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 14
14
15
15
#include " llvm/Transforms/Vectorize/VectorCombine.h"
16
16
#include " llvm/ADT/DenseMap.h"
17
+ #include " llvm/ADT/ScopeExit.h"
17
18
#include " llvm/ADT/Statistic.h"
18
19
#include " llvm/Analysis/AssumptionCache.h"
19
20
#include " llvm/Analysis/BasicAliasAnalysis.h"
@@ -1272,6 +1273,12 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
1272
1273
Instruction *LastCheckedInst = LI;
1273
1274
unsigned NumInstChecked = 0 ;
1274
1275
DenseMap<ExtractElementInst *, ScalarizationResult> NeedFreeze;
1276
+ auto FailureGuard = make_scope_exit ([&]() {
1277
+ // If the transform is aborted, discard the ScalarizationResults.
1278
+ for (auto &Pair : NeedFreeze)
1279
+ Pair.second .discard ();
1280
+ });
1281
+
1275
1282
// Check if all users of the load are extracts with no memory modifications
1276
1283
// between the load and the extract. Compute the cost of both the original
1277
1284
// code and the scalarized version.
@@ -1339,6 +1346,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
1339
1346
replaceValue (*EI, *NewLoad);
1340
1347
}
1341
1348
1349
+ FailureGuard.release ();
1342
1350
return true ;
1343
1351
}
1344
1352
Original file line number Diff line number Diff line change @@ -906,3 +906,24 @@ exit:
906
906
%p = phi i8 [ 0 , %entry ], [ %ext , %then ]
907
907
ret i8 0
908
908
}
909
+
910
+ declare void @use (...)
911
+
912
+ ; Make sure we don't assert.
913
+ define void @pr69820 (ptr %p , i32 %arg ) {
914
+ ; CHECK-LABEL: @pr69820(
915
+ ; CHECK-NEXT: [[V:%.*]] = load <4 x float>, ptr [[P:%.*]], align 16
916
+ ; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARG:%.*]], 3
917
+ ; CHECK-NEXT: [[EXT:%.*]] = extractelement <4 x float> [[V]], i32 [[AND]]
918
+ ; CHECK-NEXT: call void @use(<4 x float> [[V]], float [[EXT]])
919
+ ; CHECK-NEXT: ret void
920
+ ;
921
+ %v = load <4 x float >, ptr %p , align 16
922
+ %and = and i32 %arg , 3
923
+ %ext = extractelement <4 x float > %v , i32 %and
924
+ call void @use (<4 x float > %v , float %ext )
925
+ ret void
926
+
927
+ ; uselistorder directives
928
+ uselistorder <4 x float > %v , { 1 , 0 }
929
+ }
You can’t perform that action at this time.
0 commit comments