Skip to content

Commit 1c2ca39

Browse files
committed
Revert "Add vplan test for cond reduction with basic block."
This reverts commit fce239f.
1 parent fce239f commit 1c2ca39

File tree

2 files changed

+0
-208
lines changed

2 files changed

+0
-208
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,10 +1492,6 @@ bool VPlanTransforms::tryAddExplicitVectorLength(VPlan &Plan) {
14921492
GetNewMask(RedR->getCondOp()));
14931493
} else if (auto *VPInst = dyn_cast<VPInstruction>(CurRecipe)) {
14941494

1495-
// TODO: Transform
1496-
// select(HeaderMask, LHS, blend(RHS, LHS/BlendMask))
1497-
// into
1498-
// MergeUntilPivot(BlendMask, LHS, RHS, EVL)
14991495
VPValue *LHS, *RHS;
15001496
if (match(VPInst, m_Select(m_Specific(HeaderMask), m_VPValue(LHS),
15011497
m_VPValue(RHS)))) {

llvm/test/Transforms/LoopVectorize/RISCV/vplan-vp-intrinsics-reduction.ll

Lines changed: 0 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -203,209 +203,5 @@ for.end:
203203
ret i32 %add
204204
}
205205

206-
define i32 @cond_add_pred(ptr %a, i64 %n, i32 %start) {
207-
; IF-EVL-OUTLOOP: VPlan 'Initial VPlan for VF={vscale x 1,vscale x 2,vscale x 4},UF={1}' {
208-
; IF-EVL-OUTLOOP-NEXT: Live-in vp<[[VFUF:%[0-9]+]]> = VF * UF
209-
; IF-EVL-OUTLOOP-NEXT: Live-in vp<[[VTC:%[0-9]+]]> = vector-trip-count
210-
; IF-EVL-OUTLOOP-NEXT: Live-in vp<[[BTC:%[0-9]+]]> = backedge-taken count
211-
; IF-EVL-OUTLOOP-NEXT: Live-in ir<%n> = original trip-count
212-
; IF-EVL-OUTLOOP-EMPTY:
213-
; IF-EVL-OUTLOOP: vector.ph:
214-
; IF-EVL-OUTLOOP-NEXT: Successor(s): vector loop
215-
; IF-EVL-OUTLOOP-EMPTY:
216-
; IF-EVL-OUTLOOP-NEXT: <x1> vector loop: {
217-
; IF-EVL-OUTLOOP-NEXT: vector.body:
218-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[IV:%[0-9]+]]> = CANONICAL-INDUCTION
219-
; IF-EVL-OUTLOOP-NEXT: EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI vp<[[EVL_PHI:%[0-9]+]]> = phi ir<0>, vp<[[IV_NEXT:%[0-9]+]]>
220-
; IF-EVL-OUTLOOP-NEXT: WIDEN-REDUCTION-PHI ir<[[RDX_PHI:%.+]]> = phi ir<%start>, ir<[[RDX_NEXT:%.+]]>
221-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[EVL:%.+]]> = EXPLICIT-VECTOR-LENGTH vp<[[EVL_PHI]]>, ir<%n>
222-
; IF-EVL-OUTLOOP-NEXT: vp<[[ST:%[0-9]+]]> = SCALAR-STEPS vp<[[EVL_PHI]]>, ir<1>
223-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[WIV:%.+]]> = WIDEN-CANONICAL-INDUCTION vp<[[EVL_PHI]]>
224-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[HEADER_MASK:%.+]]> = icmp ule vp<[[WIV]]>, vp<[[BTC]]>
225-
; IF-EVL-OUTLOOP-NEXT: CLONE ir<[[GEP1:%.+]]> = getelementptr inbounds ir<%a>, vp<[[ST]]>
226-
; IF-EVL-OUTLOOP-NEXT: vp<[[PTR1:%[0-9]+]]> = vector-pointer ir<[[GEP1]]>
227-
; IF-EVL-OUTLOOP-NEXT: WIDEN ir<[[LD1:%.+]]> = vp.load vp<[[PTR1]]>, vp<[[EVL]]>
228-
; IF-EVL-OUTLOOP-NEXT: WIDEN ir<[[COND:%.+]]> = icmp sgt ir<[[LD1]]>, ir<3>
229-
; IF-EVL-OUTLOOP-NEXT: WIDEN ir<[[ADD:%.+]]> = add ir<[[RDX_PHI]]>, ir<[[LD1]]>
230-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[NOT_COND:%.+]]> = not ir<[[COND]]>
231-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[BLEND_MASK:%.+]]> = logical-and vp<[[HEADER_MASK]]>, vp<[[NOT_COND]]>
232-
; IF-EVL-OUTLOOP-NEXT: BLEND ir<[[BLEND_ADD:%.+]]> = ir<[[ADD]]> ir<[[RDX_PHI]]>/vp<[[BLEND_MASK]]>
233-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[RDX_SELECT:%.+]]> = merge-until-pivot ir<true>, ir<[[BLEND_ADD]]>, ir<[[RDX_PHI]]>, vp<[[EVL]]>
234-
; IF-EVL-OUTLOOP-NEXT: SCALAR-CAST vp<[[CAST:%[0-9]+]]> = zext vp<[[EVL]]> to i64
235-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[IV_NEXT]]> = add vp<[[CAST]]>, vp<[[EVL_PHI]]>
236-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[IV_NEXT_EXIT:%[0-9]+]]> = add vp<[[IV]]>, vp<[[VFUF]]>
237-
; IF-EVL-OUTLOOP-NEXT: EMIT branch-on-count vp<[[IV_NEXT_EXIT]]>, vp<[[VTC]]>
238-
; IF-EVL-OUTLOOP-NEXT: No successors
239-
; IF-EVL-OUTLOOP-NEXT: }
240-
; IF-EVL-OUTLOOP-NEXT: Successor(s): middle.block
241-
; IF-EVL-OUTLOOP-EMPTY:
242-
; IF-EVL-OUTLOOP-NEXT: middle.block:
243-
; IF-EVL-OUTLOOP-NEXT: EMIT vp<[[RDX:%.+]]> = compute-reduction-result ir<[[RDX_PHI]]>, vp<[[RDX_SELECT]]>
244-
; IF-EVL-OUTLOOP-NEXT: EMIT branch-on-cond ir<true>
245-
; IF-EVL-OUTLOOP-NEXT: Successor(s): ir-bb<for.end>, scalar.ph
246-
; IF-EVL-OUTLOOP-EMPTY:
247-
; IF-EVL-OUTLOOP-NEXT: ir-bb<for.end>:
248-
; IF-EVL-OUTLOOP-NEXT: No successors
249-
; IF-EVL-OUTLOOP-EMPTY:
250-
; IF-EVL-OUTLOOP-NEXT: scalar.ph:
251-
; IF-EVL-OUTLOOP-NEXT: No successors
252-
; IF-EVL-OUTLOOP-EMPTY:
253-
; IF-EVL-OUTLOOP-NEXT: Live-out i32 %rdx.add.lcssa = vp<[[RDX]]>
254-
; IF-EVL-OUTLOOP-NEXT: }
255-
;
256-
257-
; IF-EVL-INLOOP: VPlan 'Initial VPlan for VF={vscale x 1,vscale x 2,vscale x 4},UF={1}' {
258-
; IF-EVL-INLOOP-NEXT: Live-in vp<[[VFUF:%[0-9]+]]> = VF * UF
259-
; IF-EVL-INLOOP-NEXT: Live-in vp<[[VTC:%[0-9]+]]> = vector-trip-count
260-
; IF-EVL-INLOOP-NEXT: Live-in vp<[[BTC:%[0-9]+]]> = backedge-taken count
261-
; IF-EVL-INLOOP-NEXT: Live-in ir<%n> = original trip-count
262-
; IF-EVL-INLOOP-EMPTY:
263-
; IF-EVL-INLOOP: vector.ph:
264-
; IF-EVL-INLOOP-NEXT: Successor(s): vector loop
265-
; IF-EVL-INLOOP-EMPTY:
266-
; IF-EVL-INLOOP-NEXT: <x1> vector loop: {
267-
; IF-EVL-INLOOP-NEXT: vector.body:
268-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[IV:%[0-9]+]]> = CANONICAL-INDUCTION
269-
; IF-EVL-INLOOP-NEXT: EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI vp<[[EVL_PHI:%[0-9]+]]> = phi ir<0>, vp<[[IV_NEXT:%[0-9]+]]>
270-
; IF-EVL-INLOOP-NEXT: WIDEN-REDUCTION-PHI ir<[[RDX_PHI:%.+]]> = phi ir<%start>, ir<[[RDX_NEXT:%.+]]>
271-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[EVL:%.+]]> = EXPLICIT-VECTOR-LENGTH vp<[[EVL_PHI]]>, ir<%n>
272-
; IF-EVL-INLOOP-NEXT: vp<[[ST:%[0-9]+]]> = SCALAR-STEPS vp<[[EVL_PHI]]>, ir<1>
273-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[WIV:%.+]]> = WIDEN-CANONICAL-INDUCTION vp<[[EVL_PHI]]>
274-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[HEADER_MASK:%.+]]> = icmp ule vp<[[WIV]]>, vp<[[BTC]]>
275-
; IF-EVL-INLOOP-NEXT: CLONE ir<[[GEP1:%.+]]> = getelementptr inbounds ir<%a>, vp<[[ST]]>
276-
; IF-EVL-INLOOP-NEXT: vp<[[PTR1:%[0-9]+]]> = vector-pointer ir<[[GEP1]]>
277-
; IF-EVL-INLOOP-NEXT: WIDEN ir<[[LD1:%.+]]> = vp.load vp<[[PTR1]]>, vp<[[EVL]]>
278-
; IF-EVL-INLOOP-NEXT: WIDEN ir<[[COND:%.+]]> = icmp sgt ir<[[LD1]]>, ir<3>
279-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[MASK:%.+]]> = logical-and vp<[[HEADER_MASK]]>, ir<[[COND]]>
280-
; IF-EVL-INLOOP-NEXT: REDUCE ir<[[ADD:%.+]]> = ir<[[RDX_PHI]]> + vp.reduce.add (ir<[[LD1]]>, vp<[[EVL]]>, vp<[[MASK]]>)
281-
; IF-EVL-INLOOP-NEXT: SCALAR-CAST vp<[[CAST:%[0-9]+]]> = zext vp<[[EVL]]> to i64
282-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[IV_NEXT]]> = add vp<[[CAST]]>, vp<[[EVL_PHI]]>
283-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[IV_NEXT_EXIT:%[0-9]+]]> = add vp<[[IV]]>, vp<[[VFUF]]>
284-
; IF-EVL-INLOOP-NEXT: EMIT branch-on-count vp<[[IV_NEXT_EXIT]]>, vp<[[VTC]]>
285-
; IF-EVL-INLOOP-NEXT: No successors
286-
; IF-EVL-INLOOP-NEXT: }
287-
; IF-EVL-INLOOP-NEXT: Successor(s): middle.block
288-
; IF-EVL-INLOOP-EMPTY:
289-
; IF-EVL-INLOOP-NEXT: middle.block:
290-
; IF-EVL-INLOOP-NEXT: EMIT vp<[[RDX:%.+]]> = compute-reduction-result ir<[[RDX_PHI]]>, ir<[[ADD]]>
291-
; IF-EVL-INLOOP-NEXT: EMIT branch-on-cond ir<true>
292-
; IF-EVL-INLOOP-NEXT: Successor(s): ir-bb<for.end>, scalar.ph
293-
; IF-EVL-INLOOP-EMPTY:
294-
; IF-EVL-INLOOP-NEXT: ir-bb<for.end>:
295-
; IF-EVL-INLOOP-NEXT: No successors
296-
; IF-EVL-INLOOP-EMPTY:
297-
; IF-EVL-INLOOP-NEXT: scalar.ph:
298-
; IF-EVL-INLOOP-NEXT: No successors
299-
; IF-EVL-INLOOP-EMPTY:
300-
; IF-EVL-INLOOP-NEXT: Live-out i32 %rdx.add.lcssa = vp<[[RDX]]>
301-
; IF-EVL-INLOOP-NEXT: }
302-
;
303-
304-
; NO-VP-OUTLOOP: VPlan 'Initial VPlan for VF={vscale x 1,vscale x 2,vscale x 4},UF>=1' {
305-
; NO-VP-OUTLOOP-NEXT: Live-in vp<[[VFUF:%[0-9]+]]> = VF * UF
306-
; NO-VP-OUTLOOP-NEXT: Live-in vp<[[VTC:%[0-9]+]]> = vector-trip-count
307-
; NO-VP-OUTLOOP-NEXT: Live-in ir<%n> = original trip-count
308-
; NO-VP-OUTLOOP-EMPTY:
309-
; NO-VP-OUTLOOP: vector.ph:
310-
; NO-VP-OUTLOOP-NEXT: Successor(s): vector loop
311-
; NO-VP-OUTLOOP-EMPTY:
312-
; NO-VP-OUTLOOP-NEXT: <x1> vector loop: {
313-
; NO-VP-OUTLOOP-NEXT: vector.body:
314-
; NO-VP-OUTLOOP-NEXT: EMIT vp<[[IV:%[0-9]+]]> = CANONICAL-INDUCTION
315-
; NO-VP-OUTLOOP-NEXT: WIDEN-REDUCTION-PHI ir<[[RDX_PHI:%.+]]> = phi ir<%start>, ir<[[RDX_NEXT:%.+]]>
316-
; NO-VP-OUTLOOP-NEXT: vp<[[ST:%[0-9]+]]> = SCALAR-STEPS vp<[[IV]]>, ir<1>
317-
; NO-VP-OUTLOOP-NEXT: CLONE ir<[[GEP1:%.+]]> = getelementptr inbounds ir<%a>, vp<[[ST]]>
318-
; NO-VP-OUTLOOP-NEXT: vp<[[PTR1:%[0-9]+]]> = vector-pointer ir<[[GEP1]]>
319-
; NO-VP-OUTLOOP-NEXT: WIDEN ir<[[LD1:%.+]]> = load vp<[[PTR1]]>
320-
; NO-VP-OUTLOOP-NEXT: WIDEN ir<[[COND:%.+]]> = icmp sgt ir<[[LD1]]>, ir<3>
321-
; NO-VP-OUTLOOP-NEXT: WIDEN ir<[[ADD:%.+]]> = add ir<[[RDX_PHI]]>, ir<[[LD1]]>
322-
; NO-VP-OUTLOOP-NEXT: EMIT vp<[[NOT_COND:%.+]]> = not ir<[[COND]]>
323-
; NO-VP-OUTLOOP-NEXT: BLEND ir<[[BLEND_ADD:%.+]]> = ir<[[ADD]]> ir<[[RDX_PHI]]>/vp<[[NOT_COND]]>
324-
; NO-VP-OUTLOOP-NEXT: EMIT vp<[[IV_NEXT_EXIT:%[0-9]+]]> = add nuw vp<[[IV]]>, vp<[[VFUF]]>
325-
; NO-VP-OUTLOOP-NEXT: EMIT branch-on-count vp<[[IV_NEXT_EXIT]]>, vp<[[VTC]]>
326-
; NO-VP-OUTLOOP-NEXT: No successors
327-
; NO-VP-OUTLOOP-NEXT: }
328-
; NO-VP-OUTLOOP-NEXT: Successor(s): middle.block
329-
; NO-VP-OUTLOOP-EMPTY:
330-
; NO-VP-OUTLOOP-NEXT: middle.block:
331-
; NO-VP-OUTLOOP-NEXT: EMIT vp<[[RDX:%.+]]> = compute-reduction-result ir<[[RDX_PHI]]>, ir<[[BLEND_ADD]]>
332-
; NO-VP-OUTLOOP-NEXT: EMIT vp<[[BOC:%.+]]> = icmp eq ir<%n>, vp<[[VTC]]>
333-
; NO-VP-OUTLOOP-NEXT: EMIT branch-on-cond vp<[[BOC]]>
334-
; NO-VP-OUTLOOP-NEXT: Successor(s): ir-bb<for.end>, scalar.ph
335-
; NO-VP-OUTLOOP-EMPTY:
336-
; NO-VP-OUTLOOP-NEXT: ir-bb<for.end>:
337-
; NO-VP-OUTLOOP-NEXT: No successors
338-
; NO-VP-OUTLOOP-EMPTY:
339-
; NO-VP-OUTLOOP-NEXT: scalar.ph:
340-
; NO-VP-OUTLOOP-NEXT: No successors
341-
; NO-VP-OUTLOOP-EMPTY:
342-
; NO-VP-OUTLOOP-NEXT: Live-out i32 %rdx.add.lcssa = vp<[[RDX]]>
343-
; NO-VP-OUTLOOP-NEXT: }
344-
;
345-
346-
; NO-VP-INLOOP: VPlan 'Initial VPlan for VF={vscale x 1,vscale x 2,vscale x 4},UF>=1' {
347-
; NO-VP-INLOOP-NEXT: Live-in vp<[[VFUF:%[0-9]+]]> = VF * UF
348-
; NO-VP-INLOOP-NEXT: Live-in vp<[[VTC:%[0-9]+]]> = vector-trip-count
349-
; NO-VP-INLOOP-NEXT: Live-in ir<%n> = original trip-count
350-
; NO-VP-INLOOP-EMPTY:
351-
; NO-VP-INLOOP: vector.ph:
352-
; NO-VP-INLOOP-NEXT: Successor(s): vector loop
353-
; NO-VP-INLOOP-EMPTY:
354-
; NO-VP-INLOOP-NEXT: <x1> vector loop: {
355-
; NO-VP-INLOOP-NEXT: vector.body:
356-
; NO-VP-INLOOP-NEXT: EMIT vp<[[IV:%[0-9]+]]> = CANONICAL-INDUCTION
357-
; NO-VP-INLOOP-NEXT: WIDEN-REDUCTION-PHI ir<[[RDX_PHI:%.+]]> = phi ir<%start>, ir<[[RDX_NEXT:%.+]]>
358-
; NO-VP-INLOOP-NEXT: vp<[[ST:%[0-9]+]]> = SCALAR-STEPS vp<[[IV]]>, ir<1>
359-
; NO-VP-INLOOP-NEXT: CLONE ir<[[GEP1:%.+]]> = getelementptr inbounds ir<%a>, vp<[[ST]]>
360-
; NO-VP-INLOOP-NEXT: vp<[[PTR1:%[0-9]+]]> = vector-pointer ir<[[GEP1]]>
361-
; NO-VP-INLOOP-NEXT: WIDEN ir<[[LD1:%.+]]> = load vp<[[PTR1]]>
362-
; NO-VP-INLOOP-NEXT: WIDEN ir<[[COND:%.+]]> = icmp sgt ir<[[LD1]]>, ir<3>
363-
; NO-VP-INLOOP-NEXT: REDUCE ir<[[ADD:%.+]]> = ir<[[RDX_PHI]]> + reduce.add (ir<[[LD1]]>, ir<[[COND]]>)
364-
; NO-VP-INLOOP-NEXT: EMIT vp<[[IV_NEXT_EXIT:%[0-9]+]]> = add nuw vp<[[IV]]>, vp<[[VFUF]]>
365-
; NO-VP-INLOOP-NEXT: EMIT branch-on-count vp<[[IV_NEXT_EXIT]]>, vp<[[VTC]]>
366-
; NO-VP-INLOOP-NEXT: No successors
367-
; NO-VP-INLOOP-NEXT: }
368-
; NO-VP-INLOOP-NEXT: Successor(s): middle.block
369-
; NO-VP-INLOOP-EMPTY:
370-
; NO-VP-INLOOP-NEXT: middle.block:
371-
; NO-VP-INLOOP-NEXT: EMIT vp<[[RDX:%.+]]> = compute-reduction-result ir<[[RDX_PHI]]>, ir<[[ADD]]>
372-
; NO-VP-INLOOP-NEXT: EMIT vp<[[BOC:%.+]]> = icmp eq ir<%n>, vp<[[VTC]]>
373-
; NO-VP-INLOOP-NEXT: EMIT branch-on-cond vp<[[BOC]]>
374-
; NO-VP-INLOOP-NEXT: Successor(s): ir-bb<for.end>, scalar.ph
375-
; NO-VP-INLOOP-EMPTY:
376-
; NO-VP-INLOOP-NEXT: ir-bb<for.end>:
377-
; NO-VP-INLOOP-NEXT: No successors
378-
; NO-VP-INLOOP-EMPTY:
379-
; NO-VP-INLOOP-NEXT: scalar.ph:
380-
; NO-VP-INLOOP-NEXT: No successors
381-
; NO-VP-INLOOP-EMPTY:
382-
; NO-VP-INLOOP-NEXT: Live-out i32 %rdx.add.lcssa = vp<[[RDX]]>
383-
; NO-VP-INLOOP-NEXT: }
384-
;
385-
entry:
386-
br label %for.body
387-
388-
for.body:
389-
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.inc ]
390-
%rdx = phi i32 [ %start, %entry ], [ %rdx.add, %for.inc ]
391-
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv
392-
%0 = load i32, ptr %arrayidx, align 4
393-
%cmp = icmp sgt i32 %0, 3
394-
br i1 %cmp, label %if.then, label %for.inc
395-
396-
if.then:
397-
%add.pred = add nsw i32 %rdx, %0
398-
br label %for.inc
399-
400-
for.inc:
401-
%rdx.add = phi i32 [ %add.pred, %if.then ], [ %rdx, %for.body ]
402-
%iv.next = add nuw nsw i64 %iv, 1
403-
%exitcond.not = icmp eq i64 %iv.next, %n
404-
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !0
405-
406-
for.end:
407-
ret i32 %rdx.add
408-
}
409-
410206
!0 = distinct !{!0, !1}
411207
!1 = !{!"llvm.loop.vectorize.enable", i1 true}

0 commit comments

Comments
 (0)