[PATCH] D23269: AArch64: Move remaining target specific BranchRelaxation bits to TII

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 13:41:38 PDT 2016


t.p.northover added a comment.

> I think it might be just a question of naming.


For me it's the code duplication, though I think we might be in agreement now and just looking at it from different angles. AArch64BranchRelaxation contains quite a bit of code basically copy/pasted from AArch64InstrInfo.cpp just because the Analyze/Insert/Remove branch interface wasn't quite right. This looks even sillier when both instances are in InstrInfo with subtly different semantics.

Adding a convenience `insertUnconditionalBranch` function (and even `insertInvertedConditionBranch`) seems reasonable, but one way or the other delegation with InsertBranch should be involved.

Anyway, a very preliminary and largely untested outline of what I have in mind is at https://github.com/TNorthover/llvm/tree/branch-relax (making use of a possibly buggy version of https://reviews.llvm.org/D23379 so we can analyze everything). The diff is +57/-174 at the moment. It seems like we'd just have to make InsertBranch return the bytes as well (if not for IfConversion we could do a straight swap) and accept optional `KnownOffset` args and it could do everything you need.


https://reviews.llvm.org/D23269





More information about the llvm-commits mailing list