When we have a diamond ifcvt the fallthough block will have a branch at the end of it that disappears when predicated, so discount it from the predication cost.
Details
Diff Detail
Event Timeline
lib/Target/ARM/ARMBaseInstrInfo.cpp | ||
---|---|---|
1885 | IfConversion sets the cost of an instruction to be 1 + (latency-1) if latency > 1, but looking at the various sched models latency of branches is either 0 or 1 as a branch doesn't produce any result. Also getting the latency of an instruction requires having a TargetSchedModel which isn't available here, so I'd have to plumb it in from IfConversion. | |
test/CodeGen/Thumb2/ifcvt-no-branch-predictor.ll | ||
98 | It doesn't, I've adjusted the function (see the extra store in if.then below) to make sure we see a difference between bp and nobp (because with the new heuristic both produced the same code for the current version of this function). |
Does the '1' represent the single branch instruction that we will not have to execute? Does it not have to be the number of cycles saved?