[llvm-dev] InductiveRangeCheckElimination and BranchProbabilityInfo

Sam Parker via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 9 08:06:52 PDT 2018


Hi,

extractRangeChecksFromBranch uses BranchProbabilityInfo to decide whether its worth trying the InductiveRangeCheckElimination transformation. For the following example:

void split() {
  for (int i = 0; i < 100; ++i) {
    if (i < 99)
      do_something()
    else
      do_something_else()
  }
}

But the reported BPI is reported as 50/50 to whether do_something will be called, but we can see with our human eyes that this should be 99%.

So two questions:
- why is BPI used to enable the transformation?
- would it not be more useful for BPI to use something like inductive range analyis to calculate the probability? And if so, what else could make use of it? To me, InductiveRangeCheckElimination feels like it should be separated out into an analysis and the transformation.
- or have I misunderstood how and what BPI does?

Thanks,
sam


Sam Parker

Compilation Tools Engineer | Arm

. . . . . . . . . . . . . . . . . . . . . . . . . . .

Arm.com

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180409/ee963931/attachment.html>


More information about the llvm-dev mailing list