This patch introduces the llvm.cond.no_loop_predication which will be
annotated on boolean conditions that are used in branches.
This is used by loop predication to identify loops that should not be
predicated. When the conditional instruction is used as the latch check
in the loop, predicating the loop can cause the widened checks to fail
spuriously.
Such coarse checks (which can later become the latch check through
passes such as loop rotate) can be introduced by the front end or by
downstream passes. Given this metadata is a property of the condition,
we cannot attach it to llvm.loop metadata.
Details
Details
- Reviewers
hfinkel apilipenko reames mkazantsev
Diff Detail
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 16138 Build 16138: arc lint + arc unit
Event Timeline
Comment Actions
Artur had an idea offline that we could use BPI to identify if the latch exit is very rarely taken compared to other exits in the loop. We can teach loop predication to use that information and avoid predication, instead of depending on llvm.cond.donot_predicate metadata.
I'm going to abandon this revision for now and get back in case the above idea of using BPI doesn't pan out for some reason.