78 lines · plain
1; Test misexpect doesn't issue diagnostics when a branch is marked unpredictable2 3; RUN: llvm-profdata merge %S/Inputs/misexpect-branch-correct.proftext -o %t.profdata4 5; 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 %s6 7; CHECK-NOT: warning: {{.*}}8; CHECK-NOT: remark: {{.*}}9 10; ModuleID = 'misexpect-branch-unpredictable.c'11source_filename = "clang/test/Profile/misexpect-branch-unpredictable.c"12target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"13target triple = "x86_64-unknown-linux-gnu"14 15@inner_loop = constant i32 100, align 416@outer_loop = constant i32 2000, align 417 18; Function Attrs: nounwind19define i32 @bar() {20entry:21 %rando = alloca i32, align 422 %x = alloca i32, align 423 call void @llvm.lifetime.start.p0(ptr %rando)24 %call = call i32 (...) @buzz()25 store i32 %call, ptr %rando, align 4, !tbaa !226 call void @llvm.lifetime.start.p0(ptr %x)27 store i32 0, ptr %x, align 4, !tbaa !228 %0 = load i32, ptr %rando, align 4, !tbaa !229 %rem = srem i32 %0, 20000030 %cmp = icmp eq i32 %rem, 031 %lnot = xor i1 %cmp, true32 %lnot1 = xor i1 %lnot, true33 %lnot.ext = zext i1 %lnot1 to i3234 %conv = sext i32 %lnot.ext to i6435 %tobool = icmp ne i64 %conv, 036 br i1 %tobool, label %if.then, label %if.else, !unpredictable !637 38if.then: ; preds = %entry39 %1 = load i32, ptr %rando, align 4, !tbaa !240 %call2 = call i32 @baz(i32 %1)41 store i32 %call2, ptr %x, align 4, !tbaa !242 br label %if.end43 44if.else: ; preds = %entry45 %call3 = call i32 @foo(i32 50)46 store i32 %call3, ptr %x, align 4, !tbaa !247 br label %if.end48 49if.end: ; preds = %if.else, %if.then50 %2 = load i32, ptr %x, align 4, !tbaa !251 call void @llvm.lifetime.end.p0(ptr %x)52 call void @llvm.lifetime.end.p0(ptr %rando)53 ret i32 %254}55 56; Function Attrs: argmemonly nounwind willreturn57declare void @llvm.lifetime.start.p0(ptr nocapture)58 59declare i32 @buzz(...)60 61declare i32 @baz(i32)62 63declare i32 @foo(i32)64 65; Function Attrs: argmemonly nounwind willreturn66declare void @llvm.lifetime.end.p0(ptr nocapture)67 68!llvm.module.flags = !{!0}69!llvm.ident = !{!1}70 71!0 = !{i32 1, !"wchar_size", i32 4}72!1 = !{!"Fuchsia clang version 10.0.0 (153b453014c94291c8c6cf6320b2f46df40f26f3) (based on LLVM 10.0.0svn)"}73!2 = !{!3, !3, i64 0}74!3 = !{!"int", !4, i64 0}75!4 = !{!"omnipotent char", !5, i64 0}76!5 = !{!"Simple C/C++ TBAA"}77!6 = !{}78