[llvm-dev] {ARM} IfConversion does not detect BX instruction as a branch
Gaël Jobin via llvm-dev
llvm-dev at lists.llvm.org
Wed Oct 11 09:03:29 PDT 2017
On 2017-10-11 03:07, Kyle Butt wrote:
> Eli's right.
> Gaël, do you think you could patch ifconversion to remove the instructions rather than relying on removeBranch?
In fact, the BB has a IsBrAnalyzable attribute set to true
(=analyzeBranch() returned false) but the TrueBB and FalseBB of the
diamond have both IsBrAnalyzable set to false (=anayzeBranch() returned
true). But it is still detected as a valid diamond and later during the
processing of the diamond, the branches are removed without looking at
IsBrAnalyzable attribute (which does not work because indirect branches
are not supported by removeBranch())...
The thing is that I don't understand IfConversion MachinePass enough to
know what I should modify. Does indirect branches in TrueBB and FalseBB
should be supported as a diamond (a comment says that TailBB can be
empty, does that means it is a "good" diamond shape with indirect
branches? Does a valid diamond must have analyzeBranch() returning
false for TrueBB and FalseBB as well?
>From my point of view, when each TrueBB and FalseBB contain an indirect
branch, it cannot be a diamond since they can jump to anywhere. My
conservative approach would be to add a check inside ValidDiamond to
detect this case and return false to avoid the conversion.
Any idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171011/58447d14/attachment.html>
More information about the llvm-dev
mailing list