37 lines · plain
1; Check that an estimated trip count of zero does not crash or otherwise break2; LoopVectorize behavior while it tries to create runtime memory checks inside3; an outer loop.4 5; REQUIRES: x86-registered-target6; RUN: opt -passes=loop-vectorize -S %s | FileCheck %s7 8target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"9target triple = "x86_64-unknown-linux-gnu"10 11; Look for basic signs that vectorization ran and produced memory checks.12; CHECK: @test(13; CHECK: vector.memcheck:14; CHECK: vector.body:15; CHECK: inner:16 17define void @test(ptr addrspace(1) %p, i32 %n) {18entry:19 br label %outer20outer:21 br label %inner22inner:23 %i = phi i32 [ %inc, %inner ], [ 0, %outer ]24 store i32 0, ptr addrspace(1) %p25 %load = load i32, ptr addrspace(1) null26 %inc = add i32 %i, 127 %cmp = icmp slt i32 %i, %n28 br i1 %cmp, label %inner, label %outer.latch29outer.latch:30 br i1 %cmp, label %outer, label %exit, !llvm.loop !031exit:32 ret void33}34 35!0 = distinct !{!0, !1}36!1 = !{!"llvm.loop.estimated_trip_count", i32 0}37