1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s 3 4; With optimization at O2 we actually get the legalized function optimized 5; away through legalization and stack coloring, but check that we do all of 6; that here and don't crash during legalization. 7 8; Original program: 9; typedef enum { A, B, C, D } P; 10; struct { P x[2]; } a; 11 12; void fn2(); 13; void fn1() { 14; int b; 15; unsigned c; 16; for (;; c++) { 17; fn2(); 18; unsigned n; 19; for (; c; c++) { 20; b = a.x[c] == A || a.x[c] == B || a.x[c] == D; 21; if (b) n++; 22; } 23; if (n) 24; for (;;) 25; ; 26; } 27; } 28 29define void @fn1() { 30; CHECK-LABEL: fn1: 31; CHECK: # %bb.0: # %for.cond 32; CHECK-NEXT: .p2align 4, 0x90 33; CHECK-NEXT: .LBB0_1: # %vector.body 34; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 35; CHECK-NEXT: cmpq $8, %rax 36; CHECK-NEXT: jne .LBB0_1 37; CHECK-NEXT: # %bb.2: # %middle.block 38; CHECK-NEXT: retq 39for.cond: 40 br label %vector.body 41 42vector.body: ; preds = %vector.body, %for.cond 43 %x42 = bitcast <4 x i4> zeroinitializer to i16 44 %x43 = icmp ne i16 %x42, 0 45 %x44 = select i1 %x43, i32 undef, i32 0 46 %x72 = bitcast <4 x i1> zeroinitializer to i4 47 %x73 = icmp ne i4 %x72, 0 48 %x74 = select i1 %x73, i32 %x44, i32 undef 49 %x84 = select i1 undef, i32 undef, i32 %x74 50 %x88 = icmp eq i64 undef, 8 51 br i1 %x88, label %middle.block, label %vector.body 52 53middle.block: ; preds = %vector.body 54 %0 = select i1 undef, i32 undef, i32 %x84 55 ret void 56} 57