[PATCH] D100213: [PassManager][PhaseOrdering] lower expects before running simplifyCFG
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 9 09:32:25 PDT 2021
spatel created this revision.
spatel added reviewers: lebedev.ri, Carrot, craig.topper.
Herald added subscribers: wenlei, steven_wu, hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.
If we run passes before lowering llvm.expect intrinsics to metadata, then those passes have no way to act on the hints provided by llvm.expect. SimplifyCFG is the known offender, and we made it smarter about profile metadata in D98898 <https://reviews.llvm.org/D98898>.
In the motivating example from https://llvm.org/PR49336 , this means we were ignoring the recommended method for a programmer to tell the compiler that a compare+branch is expensive. This change appears to solve that case - the metadata survives to the backend, the compare order is as expected in IR, and the backend does not do anything to reverse it.
I don't know if we have a policy about old (legacy) pass manager changes at this point. We could make the same change there to keep things synchronized, or we let that rot. A potential advantage of not changing it: we have an easy way to regress test this change in the wild by running with `-fno-experimental-new-pass-manager`.
https://reviews.llvm.org/D100213
Files:
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-pgo.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
llvm/test/Transforms/PhaseOrdering/expect.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100213.336486.patch
Type: text/x-patch
Size: 9228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/2829920b/attachment.bin>
More information about the llvm-commits
mailing list