39 lines · plain
1; RUN: opt %s -passes=tailcallelim -verify-dom-info -pass-remarks=tailcallelim -o /dev/null 2>&1 | FileCheck %s2; RUN: opt %s -o /dev/null -passes='require<opt-remark-emit>,tailcallelim' -pass-remarks=tailcallelim 2>&1 | FileCheck %s3 4; CHECK: /home/davide/pat.c:2:20: transforming tail recursion into loop5define i32 @fib(i32 %n) nounwind ssp {6entry:7 %cmp = icmp slt i32 %n, 28 br i1 %cmp, label %if.then, label %if.end9 10if.then: ; preds = %entry11 br label %return12 13if.end: ; preds = %entry14 %sub = add nsw i32 %n, -215 %call = call i32 @fib(i32 %sub)16 %sub3 = add nsw i32 %n, -117 %call4 = call i32 @fib(i32 %sub3), !dbg !818 %add = add nsw i32 %call, %call419 br label %return20 21return: ; preds = %if.end, %if.then22 %retval.0 = phi i32 [ 1, %if.then ], [ %add, %if.end ]23 ret i32 %retval.024}25 26!llvm.dbg.cu = !{!0}27!llvm.module.flags = !{!3, !4}28!llvm.ident = !{!5}29 30!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)31!1 = !DIFile(filename: "/home/davide/pat.c", directory: "/tmp")32!2 = !{}33!3 = !{i32 2, !"Debug Info Version", i32 3}34!4 = !{i32 1, !"PIC Level", i32 2}35!5 = !{!"clang version 3.9.0 "}36!6 = distinct !DISubprogram(name: "success", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)37!7 = !DISubroutineType(types: !2)38!8 = !DILocation(line: 2, column: 20, scope: !6)39