1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/inline-act.prof 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Sample profile should have non-empty ACT passed to inliner 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; int t; 6*9880d681SAndroid Build Coastguard Worker; bool foo(int value) { 7*9880d681SAndroid Build Coastguard Worker; switch(value) { 8*9880d681SAndroid Build Coastguard Worker; case 0: 9*9880d681SAndroid Build Coastguard Worker; case 1: 10*9880d681SAndroid Build Coastguard Worker; case 3: 11*9880d681SAndroid Build Coastguard Worker; return true; 12*9880d681SAndroid Build Coastguard Worker; default: 13*9880d681SAndroid Build Coastguard Worker; return false; 14*9880d681SAndroid Build Coastguard Worker; } 15*9880d681SAndroid Build Coastguard Worker; } 16*9880d681SAndroid Build Coastguard Worker; void bar(int i) { 17*9880d681SAndroid Build Coastguard Worker; if (foo(i)) 18*9880d681SAndroid Build Coastguard Worker; t *= 2; 19*9880d681SAndroid Build Coastguard Worker; } 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 22*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu" 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker@t = global i32 0, align 4 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable 27*9880d681SAndroid Build Coastguard Workerdefine zeroext i1 @_Z3fooi(i32) #0 { 28*9880d681SAndroid Build Coastguard Worker %switch.tableidx = sub i32 %0, 0 29*9880d681SAndroid Build Coastguard Worker %2 = icmp ult i32 %switch.tableidx, 4 30*9880d681SAndroid Build Coastguard Worker br i1 %2, label %switch.lookup, label %3 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Workerswitch.lookup: ; preds = %1 33*9880d681SAndroid Build Coastguard Worker %switch.cast = trunc i32 %switch.tableidx to i4 34*9880d681SAndroid Build Coastguard Worker %switch.shiftamt = mul i4 %switch.cast, 1 35*9880d681SAndroid Build Coastguard Worker %switch.downshift = lshr i4 -5, %switch.shiftamt 36*9880d681SAndroid Build Coastguard Worker %switch.masked = trunc i4 %switch.downshift to i1 37*9880d681SAndroid Build Coastguard Worker ret i1 %switch.masked 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Worker; <label>:3: ; preds = %1 40*9880d681SAndroid Build Coastguard Worker ret i1 false 41*9880d681SAndroid Build Coastguard Worker} 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable 44*9880d681SAndroid Build Coastguard Workerdefine void @_Z3bari(i32) #0 !dbg !9 { 45*9880d681SAndroid Build Coastguard Worker %2 = call zeroext i1 @_Z3fooi(i32 %0), !dbg !10 46*9880d681SAndroid Build Coastguard Worker br i1 %2, label %3, label %6, !dbg !10 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker; <label>:3: ; preds = %1 49*9880d681SAndroid Build Coastguard Worker %4 = load i32, i32* @t, align 4 50*9880d681SAndroid Build Coastguard Worker %5 = shl nsw i32 %4, 1 51*9880d681SAndroid Build Coastguard Worker store i32 %5, i32* @t, align 4 52*9880d681SAndroid Build Coastguard Worker br label %6 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker; <label>:6: ; preds = %3, %1 55*9880d681SAndroid Build Coastguard Worker ret void 56*9880d681SAndroid Build Coastguard Worker} 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 61*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!3} 62*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!4} 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 272227) (llvm/trunk 272226)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) 65*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "test.cc", directory: "./") 66*9880d681SAndroid Build Coastguard Worker!2 = !{} 67*9880d681SAndroid Build Coastguard Worker!3 = !{i32 2, !"Debug Info Version", i32 3} 68*9880d681SAndroid Build Coastguard Worker!4 = !{!"clang version 3.9.0 (trunk 272227) (llvm/trunk 272226)"} 69*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !2) 70*9880d681SAndroid Build Coastguard Worker!9 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 14, type: !6, isLocal: false, isDefinition: true, scopeLine: 14, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2) 71*9880d681SAndroid Build Coastguard Worker!10 = !DILocation(line: 15, column: 7, scope: !9) 72*9880d681SAndroid Build Coastguard Worker!11 = !DILocation(line: 16, column: 7, scope: !9) 73