[PATCH] ScheduleDAGInstrs should toggle kill flags on bundled instrs

Pete Cooper peter_cooper at apple.com
Fri May 1 17:48:01 PDT 2015


Hi Andy

The attached patch (and test case) is a bug found by the machine verifier.  The problem is that prior to scheduling we had

%R3<def> = t2ANDrr %R0 …
	BUNDLE %ITSTATE<imp-def,dead>, %R6<imp-def>, %R0<imp-use,kill>, %R4<imp-use,kill>, %CPSR<imp-use,kill>, %R6<imp-use,kill>
	  * t2IT 1, 24, %ITSTATE<imp-def>
	  * %R6<def,tied6> = t2ORRrr %R0<kill>, %R4<kill>, pred:1, pred:%CPSR<kill>, opt:%noreg, %R6<imp-use,kill,tied0>, %ITSTATE<imp-use,kill,internal>

but after scheduling we moved the AND later, and cleared the kill flag only from the imp-use on the BUNDLE, not the kill on any of the instructions inside the bundle.

The verifier then thinks that this bundle killed R0, and so the AND after it is reading an undefined physreg.

This patch updates toggleKillFlag to also toggle the kill flags of instructions inside the bundle to match.  It does this bottom up in the bundle as if we are setting a kill flag then we only want to set it on the last use.

The test here demonstrates the issue, although i don’t think its suitable for commit.  Constructing a test which will have these bundled instructions along with guaranteeing that the AND will be scheduled later just isn’t feasible.  I hope this is ok.

Let me know what you think.

Cheers
Pete

-------------- next part --------------
A non-text attachment was scrubbed...
Name: scheduler-bundle-kills.diff
Type: application/octet-stream
Size: 3106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150501/83683d0f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt.ll
Type: application/octet-stream
Size: 6459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150501/83683d0f/attachment-0001.obj>


More information about the llvm-commits mailing list