sherwin-dc created this revision. Herald added subscribers: ormris, wenlei, pengfei, steven_wu, hiraditya, inglorion. sherwin-dc requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
I am working on a target in a downstream LLVM repo, and it seems that if a target backend chooses to disable loop unrolling this test would fail. A solution would be to modify the test to search for a different string instead. The specific test checks for `if.true.direct_targ` which appears in the output when thinlto is not used (ie samplepgo). The same is true for `if.false.orig_indirect`. However, if a target disables loop unrolling in the backend, the test fails as `if.true.direct_targ` no longer appears, though `if.false.orig_indirect` still does. This can be seen by using a clang pragma to disable loop unrolling in the `unroll()` function. For reference, the following files are the outputs of the last 2 test functions being compiled as the test case does, with and without thinlto, and with and without loop unrolling on the latest x86 clang build. The loop unrolling pragma was used to simulate the loop unrolling being disabled in a backend. // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o out.ll // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o out.ll F18832230: samplepgo_unroll.ll <https://reviews.llvm.org/F18832230> F18832229: thinlto_unroll.ll <https://reviews.llvm.org/F18832229> F18832228: thinlto_nounroll.ll <https://reviews.llvm.org/F18832228> F18832227: samplepgo_nounroll.ll <https://reviews.llvm.org/F18832227> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109234 Files: clang/test/CodeGen/pgo-sample-thinlto-summary.c Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c =================================================================== --- clang/test/CodeGen/pgo-sample-thinlto-summary.c +++ clang/test/CodeGen/pgo-sample-thinlto-summary.c @@ -37,10 +37,10 @@ // Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo. // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp // THINLTO-LABEL: define {{(dso_local )?}}void @icp -// SAMPLEPGO: if.true.direct_targ +// SAMPLEPGO: if.false.orig_indirect // FIXME: the following condition needs to be reversed once // LTOPreLinkDefaultPipeline is customized. -// THINLTO-NOT: if.true.direct_targ +// THINLTO-NOT: if.false.orig_indirect void icp(void (*p)()) { p(); }
Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c =================================================================== --- clang/test/CodeGen/pgo-sample-thinlto-summary.c +++ clang/test/CodeGen/pgo-sample-thinlto-summary.c @@ -37,10 +37,10 @@ // Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo. // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp // THINLTO-LABEL: define {{(dso_local )?}}void @icp -// SAMPLEPGO: if.true.direct_targ +// SAMPLEPGO: if.false.orig_indirect // FIXME: the following condition needs to be reversed once // LTOPreLinkDefaultPipeline is customized. -// THINLTO-NOT: if.true.direct_targ +// THINLTO-NOT: if.false.orig_indirect void icp(void (*p)()) { p(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits