blob: d95220d238ac5d64c72b60a56d4fa37b68b64126 [file] [log] [blame]
Andrew Trickb9c822a2012-01-20 21:23:40 +00001; RUN: opt < %s -loop-reduce -S | FileCheck %s
2;
3; PR11782: bad cast to AddRecExpr.
4; A sign extend feeds an IVUser and cannot be hoisted into the AddRec.
5; CollectIVChains should bailout on this case.
6
Mehdi Amini46a43552015-03-04 18:43:29 +00007
8; Provide legal integer types.
9target datalayout = "n8:16:32:64"
10
Andrew Trickb9c822a2012-01-20 21:23:40 +000011%struct = type { i8*, i8*, i16, i64, i16, i16, i16, i64, i64, i16, i8*, i64, i64, i64 }
12
Stephen Linc1c7a132013-07-14 01:42:54 +000013; CHECK-LABEL: @test(
Andrew Trickb9c822a2012-01-20 21:23:40 +000014; CHECK: for.body:
15; CHECK: lsr.iv = phi %struct
16; CHECK: br
17define i32 @test(i8* %h, i32 %more) nounwind uwtable {
18entry:
19 br i1 undef, label %land.end238, label %return
20
21land.end238: ; preds = %if.end229
22 br label %for.body
23
24for.body: ; preds = %sw.epilog, %land.end238
25 %fbh.0 = phi %struct* [ undef, %land.end238 ], [ %incdec.ptr, %sw.epilog ]
26 %column_n.0 = phi i16 [ 0, %land.end238 ], [ %inc601, %sw.epilog ]
27 %conv250 = sext i16 %column_n.0 to i32
28 %add257 = add nsw i32 %conv250, 1
29 %conv258 = trunc i32 %add257 to i16
30 %cmp263 = icmp ult i16 undef, 2
31 br label %if.end388
32
33if.end388: ; preds = %if.then380, %if.else356
David Blaikie79e6c742015-02-27 19:29:02 +000034 %ColLength = getelementptr inbounds %struct, %struct* %fbh.0, i64 0, i32 7
Andrew Trickb9c822a2012-01-20 21:23:40 +000035 %call405 = call signext i16 @SQLColAttribute(i8* undef, i16 zeroext %conv258, i16 zeroext 1003, i8* null, i16 signext 0, i16* null, i64* %ColLength) nounwind
36 br label %sw.epilog
37
38sw.epilog: ; preds = %sw.bb542, %sw.bb523, %if.end475
39 %inc601 = add i16 %column_n.0, 1
David Blaikie79e6c742015-02-27 19:29:02 +000040 %incdec.ptr = getelementptr inbounds %struct, %struct* %fbh.0, i64 1
Andrew Trickb9c822a2012-01-20 21:23:40 +000041 br label %for.body
42
43return: ; preds = %entry
44 ret i32 1
45}
46
47declare signext i16 @SQLColAttribute(i8*, i16 zeroext, i16 zeroext, i8*, i16 signext, i16*, i64*)