[PATCH] D57718: [PPC] Adjust the computed branch offset for the possible shorter distance
Jinsong Ji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 12 08:42:22 PST 2019
jsji added a comment.
Herald added a subscriber: jdoerfert.
I think we should be able to come up with a smaller test case that demonstrate the problem here?
No necessary causing run time problem due to wrong branch,
but causing `smaller` branch offset, and we can check that by adding a few `dbgs()` to check calculated branch offset in code?
Also , looks like to me that we don't need to get max alignment here?
================
Comment at: lib/Target/PowerPC/PPCBranchSelector.cpp:214
+ // ...
+ // bne Far 100 10c
+ // .p2align 4
----------------
Looks like to me that the root cause here is that
1. we **may have conservative (larger) MBBStartOffset** due to inline asm or alignment, (eg: `100` -> `10c`)
2. we are **subtracting MBBStartOffset** here (eg: `0x8108 - 0x10c`)
So instead of getting larger `BranchSize`, subtracting may lead us to getting smaller `BranchSize`.
For other blocks, even if we may still have conservative (larger) size, it should be OK, as we are adding them towards `BranchSize`.
So, shouldn't we just need to adjust the value of `MBBStartOffset` , checking inline asm & alignment when calculating it in previous loop?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57718/new/
https://reviews.llvm.org/D57718
More information about the llvm-commits
mailing list