[PATCH] D29153: [BranchFolding] Tail common all identical unreachable blocks

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 11:09:54 PST 2017

iteratee added inline comments.

Comment at: lib/CodeGen/BranchFolding.cpp:521
+static bool blockEndsInUnreachable(const MachineBasicBlock *MBB) {
+  return MBB->succ_empty() && !MBB->isReturnBlock();
rengolin wrote:
> iteratee wrote:
> > rnk wrote:
> > > iteratee wrote:
> > > > Unforturnately there are platforms where this isn't sufficient. I believe ARM is one of them.
> > > For all the ARM examples I constructed, isReturnBlock appeared to be accurate.
> > OK, I have data.
> > 
> > isReturnBlock is currently insufficient for Thumb (That's why I thought ARM), Hexagon, Mips and XCore.
> > Arguably, this should go in anyway and those platforms should be fixed.
> > 
> > Funnily enough, this could cause switching away from Thumb to reduce code size.
> Can you be more specific for "insufficient"?
> What's the risk/cost? If they're too big, than "fixing it later" might not be a good idea.
> Also, who's fixing it?
Those platforms don't correctly mark return instructions as returns.

Given that this is a size decrease on all platforms where return instructions are correctly marked, I see no problem with it going in as is.

The platform owners should fix it if they care.


More information about the llvm-commits mailing list