; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-pc-linux-gnu -mcpu=generic -slp-vectorizer -pass-remarks-output=%t < %s | FileCheck %s
; RUN: FileCheck --input-file=%t --check-prefix=YAML %s

define void @vsub2_test(i32* %pin1, i32* %pin2, i32* %pout) #0 {
; CHECK-LABEL: @vsub2_test(
; CHECK-NEXT:    br label [[TMP1:%.*]]
; CHECK:         [[IDX_04:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP1]] ]
; CHECK-NEXT:    [[PO_03:%.*]] = phi i32* [ [[POUT:%.*]], [[TMP0]] ], [ [[TMP7:%.*]], [[TMP1]] ]
; CHECK-NEXT:    [[PTMPI2_02:%.*]] = phi i32* [ [[PIN2:%.*]], [[TMP0]] ], [ [[TMP4:%.*]], [[TMP1]] ]
; CHECK-NEXT:    [[PTMPI1_01:%.*]] = phi i32* [ [[PIN1:%.*]], [[TMP0]] ], [ [[TMP2:%.*]], [[TMP1]] ]
; CHECK-NEXT:    [[TMP2]] = getelementptr inbounds i32, i32* [[PTMPI1_01]], i64 1
; CHECK-NEXT:    [[TMP3:%.*]] = load i32, i32* [[PTMPI1_01]], align 4, !tbaa !1
; CHECK-NEXT:    [[TMP4]] = getelementptr inbounds i32, i32* [[PTMPI2_02]], i64 1
; CHECK-NEXT:    [[TMP5:%.*]] = load i32, i32* [[PTMPI2_02]], align 4, !tbaa !1
; CHECK-NEXT:    [[TMP6:%.*]] = sub nsw i32 [[TMP3]], [[TMP5]]
; CHECK-NEXT:    [[TMP7]] = getelementptr inbounds i32, i32* [[PO_03]], i64 1
; CHECK-NEXT:    store i32 [[TMP6]], i32* [[PO_03]], align 4, !tbaa !1
; CHECK-NEXT:    [[TMP8]] = add nuw nsw i32 [[IDX_04]], 1
; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[TMP8]], 64
; CHECK-NEXT:    br i1 [[EXITCOND]], label [[TMP9:%.*]], label [[TMP1]], !llvm.loop !5
; CHECK:         ret void
;
  br label %1

  %idx.04 = phi i32 [ 0, %0 ], [ %8, %1 ]
  %po.03 = phi i32* [ %pout, %0 ], [ %7, %1 ]
  %ptmpi2.02 = phi i32* [ %pin2, %0 ], [ %4, %1 ]
  %ptmpi1.01 = phi i32* [ %pin1, %0 ], [ %2, %1 ]
  %2 = getelementptr inbounds i32, i32* %ptmpi1.01, i64 1
  %3 = load i32, i32* %ptmpi1.01, align 4, !tbaa !1
  %4 = getelementptr inbounds i32, i32* %ptmpi2.02, i64 1
  %5 = load i32, i32* %ptmpi2.02, align 4, !tbaa !1
  %6 = sub nsw i32 %3, %5
  %7 = getelementptr inbounds i32, i32* %po.03, i64 1
  ; YAML:      Pass:            slp-vectorizer
  ; YAML-NEXT: Name:            NotBeneficial
  ; YAML-NEXT: Function:        vsub2_test
  ; YAML-NEXT: Args:
  ; YAML-NEXT:   - String:          'List vectorization was possible but not beneficial with cost '
  ; YAML-NEXT:   - Cost:            '0'
  ; YAML-NEXT:   - String:          ' >= '
  ; YAML-NEXT:   - Treshold:        '0'
  store i32 %6, i32* %po.03, align 4, !tbaa !1
  %8 = add nuw nsw i32 %idx.04, 1
  %exitcond = icmp eq i32 %8, 64
  br i1 %exitcond, label %9, label %1, !llvm.loop !5

  ret void
}

!llvm.ident = !{!0}

!0 = !{!"clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"int", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.vectorize.width", i32 1}
!7 = !{!"llvm.loop.interleave.count", i32 1}
