brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · eb1cc5e Raw
84 lines · plain
1; Test misexpect checks do not issue diagnostics when profiling weights and2; branch weights added by llvm.expect agree3 4; RUN: llvm-profdata merge %S/Inputs/misexpect-branch-correct.proftext -o %t.profdata5 6; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S  2>&1 | FileCheck %s7 8; CHECK-NOT: warning: {{.*}}9; CHECK-NOT: remark: {{.*}}10; CHECK: !{!"branch_weights", i32 0, i32 200000}11 12; ModuleID = 'misexpect-branch-correct.c'13source_filename = "misexpect-branch-correct.c"14target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"15target triple = "x86_64-unknown-linux-gnu"16 17@inner_loop = constant i32 100, align 418@outer_loop = constant i32 2000, align 419 20; Function Attrs: nounwind21define i32 @bar() {22entry:23  %rando = alloca i32, align 424  %x = alloca i32, align 425  call void @llvm.lifetime.start.p0(ptr %rando)26  %call = call i32 (...) @buzz()27  store i32 %call, ptr %rando, align 4, !tbaa !328  call void @llvm.lifetime.start.p0(ptr %x)29  store i32 0, ptr %x, align 4, !tbaa !330  %0 = load i32, ptr %rando, align 4, !tbaa !331  %rem = srem i32 %0, 20000032  %cmp = icmp eq i32 %rem, 033  %lnot = xor i1 %cmp, true34  %lnot1 = xor i1 %lnot, true35  %lnot.ext = zext i1 %lnot1 to i3236  %conv = sext i32 %lnot.ext to i6437  %expval = call i64 @llvm.expect.i64(i64 %conv, i64 0)38  %tobool = icmp ne i64 %expval, 039  br i1 %tobool, label %if.then, label %if.else40 41if.then:                                          ; preds = %entry42  %1 = load i32, ptr %rando, align 4, !tbaa !343  %call2 = call i32 @baz(i32 %1)44  store i32 %call2, ptr %x, align 4, !tbaa !345  br label %if.end46 47if.else:                                          ; preds = %entry48  %call3 = call i32 @foo(i32 50)49  store i32 %call3, ptr %x, align 4, !tbaa !350  br label %if.end51 52if.end:                                           ; preds = %if.else, %if.then53  %2 = load i32, ptr %x, align 4, !tbaa !354  call void @llvm.lifetime.end.p0(ptr %x)55  call void @llvm.lifetime.end.p0(ptr %rando)56  ret i32 %257}58 59; Function Attrs: argmemonly nounwind willreturn60declare void @llvm.lifetime.start.p0(ptr nocapture)61 62declare i32 @buzz(...)63 64; Function Attrs: nounwind readnone willreturn65declare i64 @llvm.expect.i64(i64, i64)66 67declare i32 @baz(i32)68 69declare i32 @foo(i32)70 71; Function Attrs: argmemonly nounwind willreturn72declare void @llvm.lifetime.end.p0(ptr nocapture)73 74!llvm.module.flags = !{!0, !1}75!llvm.ident = !{!2}76 77!0 = !{i32 2, !"Debug Info Version", i32 3}78!1 = !{i32 1, !"wchar_size", i32 4}79!2 = !{!"clang version 10.0.0 (c20270bfffc9d6965219de339d66c61e9fe7d82d)"}80!3 = !{!4, !4, i64 0}81!4 = !{!"int", !5, i64 0}82!5 = !{!"omnipotent char", !6, i64 0}83!6 = !{!"Simple C/C++ TBAA"}84