[PATCH] D57718: [PPC] Adjust the computed branch offset for the possible shorter distance

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 20 14:48:32 PST 2019


Carrot added inline comments.


================
Comment at: lib/Target/PowerPC/PPCBranchSelector.cpp:200
+          BranchSize += BlockSizes[DestBlock].first;
+          for (unsigned i = DestBlock+1, e = MBB.getNumber(); i < e; ++i) {
             BranchSize += BlockSizes[i].first;
----------------
nemanjai wrote:
> nemanjai wrote:
> > I don't actually follow why we don't count the size of the destination block since we're branching to the top of it. Could you add a comment explaining why?
> Oh, nvm. I just realized that you moved the addition of the size of the destination block to before the loop. I suppose the idea is that we do want to consider the destination block's size but not its alignment.
Exactly.


================
Comment at: lib/Target/PowerPC/PPCBranchSelector.cpp:207
+          NeedExtraAdjustment = (MinImpreciseBlock >= 0) &&
+                                (DestBlock >= MinImpreciseBlock);
         } else {
----------------
nemanjai wrote:
> I also don't understand this... How about if the first "imprecise block" is between the destination block and the branch block? Wouldn't we still possibly need the extra adjustment? Namely, shouldn't this say something like `MBB.getNumber() >= MinImpreciseBlock`?
Added comment to explain this situation.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57718/new/

https://reviews.llvm.org/D57718





More information about the llvm-commits mailing list