Re-apply r234898 and fix tests.
authorDaniel Jasper <djasper@google.com>
Wed, 15 Apr 2015 06:24:07 +0000 (06:24 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 15 Apr 2015 06:24:07 +0000 (06:24 +0000)
commit058309ba87896d28a995118f5415011caa97cfbe
tree2dbb8379b3064b4254287a591e61d3a37c2aaa0a
parent29da6378264333420481f421b05078ce0af58e0a
Re-apply r234898 and fix tests.

This commit makes LLVM not estimate branch probabilities when doing a
single bit bitmask tests.

The code that originally made me discover this is:

  if ((a & 0x1) == 0x1) {
    ..
  }

In this case we don't actually have any branch probability information
and should not assume to have any. LLVM transforms this into:

  %and = and i32 %a, 1
  %tobool = icmp eq i32 %and, 0

So, in this case, the result of a bitwise and is compared against 0,
but nevertheless, we should not assume to have probability
information.

CodeGen/ARM/2013-10-11-select-stalls.ll started failing because the
changed probabilities changed the results of
ARMBaseInstrInfo::isProfitableToIfCvt() and led to an Ifcvt of the
diamond in the test. AFAICT, the test was never meant to test this and
thus changing the test input slightly to not change the probabilities
seems like the best way to preserve the meaning of the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234979 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/BranchProbabilityInfo.cpp
test/Analysis/BranchProbabilityInfo/basic.ll
test/CodeGen/AArch64/arm64-call-tailcalls.ll
test/CodeGen/ARM/2013-10-11-select-stalls.ll
test/CodeGen/Mips/octeon.ll