Skip to content

Commit 451a076

Browse files
committed
[VPlan] Address review: patch is now NFC
1 parent 531009e commit 451a076

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ static void licm(VPlan &Plan) {
21112111
auto CannotHoistRecipe = [](VPRecipeBase &R) {
21122112
// TODO: Relax checks in the future, e.g. we could also hoist reads, if
21132113
// their memory location is not modified in the vector loop.
2114-
if (R.mayReadOrWriteMemory() || R.isPhi())
2114+
if (R.mayHaveSideEffects() || R.mayReadFromMemory() || R.isPhi())
21152115
return true;
21162116

21172117
// Allocas cannot be hoisted.
@@ -2121,10 +2121,13 @@ static void licm(VPlan &Plan) {
21212121

21222122
// Hoist any loop invariant recipes from the vector loop region to the
21232123
// preheader. Preform a shallow traversal of the vector loop region, to
2124-
// exclude recipes in replicate regions. Since the vector loop region is
2125-
// guaranteed to execute, if the vector pre-header is, we don't need to check
2126-
// speculation safety.
2124+
// exclude recipes in replicate regions.
21272125
VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion();
2126+
2127+
// Since the vector loop region is guaranteed to execute, if the vector
2128+
// pre-header is, we don't need to check speculation safety.
2129+
assert(Preheader->getSingleSuccessor() == LoopRegion &&
2130+
"Expected vector prehader's successor to be the vector loop region");
21282131
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
21292132
vp_depth_first_shallow(LoopRegion->getEntry()))) {
21302133
for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {

llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ define void @test1(ptr %dst, {i64, i64} %sv) {
4545
; FORCED-NEXT: [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
4646
; FORCED-NEXT: br i1 [[TMP3]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
4747
; FORCED: [[MIDDLE_BLOCK]]:
48-
; FORCED-NEXT: br label %[[EXIT:.*]]
49-
; FORCED: [[EXIT]]:
50-
; FORCED-NEXT: ret void
48+
; FORCED-NEXT: br [[EXIT:label %.*]]
49+
; FORCED: [[SCALAR_PH:.*:]]
5150
;
5251
entry:
5352
br label %loop.body
@@ -92,19 +91,18 @@ define void @test_getVectorCallCost(ptr %dst, {float, float} %sv) {
9291
; FORCED-NEXT: [[TMP4:%.*]] = extractvalue { float, float } [[SV]], 1
9392
; FORCED-NEXT: [[BROADCAST_SPLATINSERT1:%.*]] = insertelement <2 x float> poison, float [[TMP4]], i64 0
9493
; FORCED-NEXT: [[BROADCAST_SPLAT2:%.*]] = shufflevector <2 x float> [[BROADCAST_SPLATINSERT1]], <2 x float> poison, <2 x i32> zeroinitializer
95-
; FORCED-NEXT: [[TMP2:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[BROADCAST_SPLAT]], <2 x float> [[BROADCAST_SPLAT2]])
9694
; FORCED-NEXT: br label %[[VECTOR_BODY:.*]]
9795
; FORCED: [[VECTOR_BODY]]:
9896
; FORCED-NEXT: [[INDEX:%.*]] = phi i32 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
9997
; FORCED-NEXT: [[TMP1:%.*]] = getelementptr float, ptr [[DST]], i32 [[INDEX]]
98+
; FORCED-NEXT: [[TMP2:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[BROADCAST_SPLAT]], <2 x float> [[BROADCAST_SPLAT2]])
10099
; FORCED-NEXT: store <2 x float> [[TMP2]], ptr [[TMP1]], align 4
101100
; FORCED-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 2
102101
; FORCED-NEXT: [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
103-
; FORCED-NEXT: br i1 [[TMP3]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP3:![0-9]+]]
102+
; FORCED-NEXT: br i1 [[TMP3]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]
104103
; FORCED: [[MIDDLE_BLOCK]]:
105-
; FORCED-NEXT: br label %[[EXIT:.*]]
106-
; FORCED: [[EXIT]]:
107-
; FORCED-NEXT: ret void
104+
; FORCED-NEXT: br [[EXIT:label %.*]]
105+
; FORCED: [[SCALAR_PH:.*:]]
108106
;
109107
entry:
110108
br label %loop.body

llvm/test/Transforms/LoopVectorize/X86/funclet.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ for.cond.cleanup: ; preds = %for.body
1919

2020
for.body: ; preds = %for.body, %catch
2121
%i.07 = phi i32 [ 0, %catch ], [ %inc, %for.body ]
22-
%tofp = uitofp i32 %i.07 to double
23-
%call = call double @floor(double %tofp) #1 [ "funclet"(token %1) ]
22+
%call = call double @floor(double 1.0) #1 [ "funclet"(token %1) ]
2423
%inc = add nuw nsw i32 %i.07, 1
2524
%exitcond = icmp eq i32 %inc, 1024
2625
br i1 %exitcond, label %for.cond.cleanup, label %for.body

0 commit comments

Comments
 (0)