[PPC64] Bug fix: when enabling sibling-call-opt and shrink-wrapping, the tail call...
authorChuang-Yu Cheng <cycheng@multicorewareinc.com>
Fri, 1 Apr 2016 06:44:32 +0000 (06:44 +0000)
committerChuang-Yu Cheng <cycheng@multicorewareinc.com>
Fri, 1 Apr 2016 06:44:32 +0000 (06:44 +0000)
commitf8b592f213816911adcd9c2e86a04d007ef3f6b1
treed7470b461d257201c566f24bda6e65b13904c62f
parentd7ad221c161dbf048c1d4f4f3ce3c24bbb203a13
[PPC64] Bug fix: when enabling sibling-call-opt and shrink-wrapping, the tail call branch instruction might disappear

Bug Pattern:
    # BB#0:                                 # %entry
    cmpldi  3, 0
    beq-  0, .LBB0_2
    # BB#1:                                 # %exit
    lwz 4, 0(3)
    #TC_RETURNd8 LVComputationKind 0
    .LBB0_2:                                # %cond.false
    mflr 0
    std 0, 16(1)
    stdu 1, -96(1)
    .Ltmp0:
    .cfi_def_cfa_offset 96
    .Ltmp1:
    .cfi_offset lr, 16
    bl __assert_fail
    nop

The branch instruction for tail call return is not generated, because the
shrink-wrapping pass choosing a new Restore Point: %cond.false, so %exit
block is not sent to emitEpilogue, that's why the branch is not generated.

Thanks Kit's opinions!
Reviewers: nemanjai hfinkel tjablin kbarton

http://reviews.llvm.org/D17606

llvm-svn: 265112
llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
llvm/lib/Target/PowerPC/PPCFrameLowering.h