This change makes it possible for tail-duplication and tail-merging to
be disjoint.
Don't special case fallthrough if it requires replacing a conditional jump with an unconditional jump.
Differential D22317
Codegen: Tail Merge: Be less aggressive with special cases. iteratee on Jul 13 2016, 3:18 PM. Authored by
Details
This change makes it possible for tail-duplication and tail-merging to Don't special case fallthrough if it requires replacing a conditional jump with an unconditional jump.
Diff Detail Event Timeline
Comment Actions This also looks like some problem in later pass that get exposed by tail foo: @foo { r1 = #0 ; jump .LBB0_2 } .p2align 4 .LBB0_1: // %while.cond // in Loop: Header=BB0_2 Depth=1 { r1 = r0 r0 = memw(r0 + #0) } .LBB0_2: // %while.cond // =>This Inner Loop Header: Depth=1 { if (!cmp.eq(r0.new, #0)) jump .LBB0_1 } { jumpr:nt r31 } .LBB0_3: // %if.end I am fine having special handling to disable cases like this, but not too David Comment Actions I've looked over the results with and without this patch, and I've come to the conclusion that It's correct to make this less aggressive generally. For an unconditional branch, ignoring the threshold because of fallthrough is correct, because there is no runtime cost if the jump happens earlier. It was going to happen anyway. Comment Actions There are two independent issues here
We shall probably proceed with 1) and make tailDup enhancement your have in. The right way to approach 2) can be handled later. WDT?
Comment Actions lgtm with more suggested restriction.
|
This looks fine but should it be done only in layout mode?