OSDN Git Service

[CodeGen][IfCvt] Don't re-ifcvt blocks with unanalyzable terminators.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 21 Mar 2015 01:23:15 +0000 (01:23 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 21 Mar 2015 01:23:15 +0000 (01:23 +0000)
commit995f4f8fd12cbf11beccf57fca9981f8b13bba7e
tree52f8cad0623a953c78d86d9d74c5d9c7e02498de
parent165bd1733be20664b91920c846d9c51712eda115
[CodeGen][IfCvt] Don't re-ifcvt blocks with unanalyzable terminators.

If we couldn't analyze its terminator (i.e., it's an indirectbr, or some
other weirdness), we can't safely re-if-convert a predicated block,
because we can't tell whether the predicated terminator can
fallthrough (it does).

Currently, we would completely ignore the fallthrough successor. In
the added testcase, this means we used to generate:

    ...
  @ %entry:
    cmp   r5, #21
    ittt  ne
  @ %cc1f:
    cmpne r7, #42
  @ %cc2t:
    strne.w       r5, [r8]
    movne pc, r10
  @ %cc1t:
    ...

Whereas the successor of %cc1f was originally %bb1.
With the fix, we get the correct:

    ...
  @ %entry:
    cmp   r5, #21
    itt   eq
  @ %cc1t:
    streq.w       r5, [r11]
    moveq pc, r0
  @ %cc1f:
    cmp   r7, #42
    itt   ne
  @ %cc2t:
    strne.w       r5, [r8]
    movne pc, r10
  @ %bb1:
    ...

rdar://20192768
Differential Revision: http://reviews.llvm.org/D8509

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232872 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/IfConversion.cpp
test/CodeGen/ARM/ifcvt-iter-indbr.ll [new file with mode: 0644]