64 lines · plain
1; RUN: opt -hexagon-loop-idiom -S < %s | FileCheck %s2; RUN: opt -p hexagon-loop-idiom -S < %s | FileCheck %s3;4; The number of nested selects caused the simplification loop to take5; more than the maximum number of iterations. This caused the compiler6; to crash under suspicion of an infinite loop. This (still reduced)7; testcase shows a legitimate case where this limit was exceeded.8; Instead of crashing, gracefully abort the simplification.9;10; Check for sane output.11; CHECK: define void @fred12 13target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"14target triple = "hexagon"15 16define void @fred() unnamed_addr #0 {17b0:18 %v1 = select i1 false, i32 undef, i32 219 br label %b220 21b2: ; preds = %b2, %b022 %v3 = sext i16 undef to i3223 %v4 = add nsw i32 %v1, %v324 %v5 = select i1 undef, i32 undef, i32 %v425 %v6 = icmp slt i32 %v5, undef26 %v7 = select i1 %v6, i32 %v5, i32 undef27 %v8 = icmp slt i32 %v7, 028 %v9 = select i1 %v8, i32 %v7, i32 029 %v10 = sub i32 undef, undef30 %v11 = add i32 %v10, %v931 %v12 = sext i16 undef to i3232 %v13 = sext i16 undef to i3233 %v14 = add nsw i32 %v1, %v1334 %v15 = select i1 undef, i32 undef, i32 %v1435 %v16 = icmp slt i32 %v15, undef36 %v17 = select i1 %v16, i32 %v15, i32 undef37 %v18 = select i1 undef, i32 %v17, i32 %v1238 %v19 = add i32 undef, %v1839 %v20 = sext i16 undef to i3240 %v21 = sext i16 0 to i3241 %v22 = add nsw i32 %v1, %v2142 %v23 = sext i16 undef to i3243 %v24 = add nsw i32 %v1, %v2344 %v25 = select i1 undef, i32 undef, i32 %v2445 %v26 = icmp slt i32 %v25, %v2246 %v27 = select i1 %v26, i32 %v25, i32 %v2247 %v28 = icmp slt i32 %v27, %v2048 %v29 = select i1 %v28, i32 %v27, i32 %v2049 %v30 = add i32 undef, %v2950 %v31 = add i32 %v11, undef51 %v32 = add i32 %v31, undef52 %v33 = add i32 %v32, %v1953 %v34 = add i32 %v33, %v3054 %v35 = add nsw i32 %v34, 3276855 %v36 = icmp ult i32 %v35, 6553656 %v37 = select i1 %v36, i32 %v34, i32 undef57 br i1 undef, label %b2, label %b3858 59b38: ; preds = %b260 unreachable61}62 63attributes #0 = { "target-cpu"="hexagonv60" }64