================ @@ -0,0 +1,203 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG + +int shouldNotGenBranchRet(int x) { + if (x > 5) + goto err; + return 0; +err: + return -1; +} +// CIR: cir.func dso_local @_Z21shouldNotGenBranchReti +// CIR: cir.if {{.*}} { +// CIR: cir.goto "err" +// CIR: } +// CIR: ^bb1: +// CIR: [[LOAD:%.*]] = cir.load [[ZERO:%.*]] : !cir.ptr<!s32i>, !s32i ---------------- andykaylor wrote:
This test is very confusing, partly because of the check names, and partly because some critical pieces are omitted. The thing being loaded here is the return value, which is either set to zero after the `if` or set to `-1` in the "err" label block which then branches to `^bb1`. Can you add more of this to the test to make it more sensible? https://godbolt.org/z/zbY1Wv5Y5 https://github.com/llvm/llvm-project/pull/153701 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits