[PATCH] D17606: [PPC64] Bug fix: when enable both sibling-call-opt and shrink-wrapping, the tail call branch instruction might disappear

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 06:46:54 PST 2016


cycheng created this revision.
cycheng added reviewers: kbarton, nemanjai, hfinkel, tjablin.
cycheng added a subscriber: llvm-commits.

Note! http://reviews.llvm.org/D16315 is depend on this patch.

Bug case (When enable both SCO and ShrinkWrapping):

```
# 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.

We handle this case in **processFunctionBeforeFrameFinalized**.

http://reviews.llvm.org/D17606

Files:
  lib/Target/PowerPC/PPCFrameLowering.cpp
  lib/Target/PowerPC/PPCFrameLowering.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17606.49051.patch
Type: text/x-patch
Size: 5362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160225/6cb70302/attachment.bin>


More information about the llvm-commits mailing list