[llvm-dev] Loop branching inefficiencies in Backend output

Dilan Manatunga via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 10 13:41:17 PDT 2017

Thanks! That is exactly what I was looking for. I was basing most of my
stuff on NVPTX and apparently they don't bother implementing the

Also, thanks for print-after-all flag. Should be useful for me.

Thanks again for all the help.

On Mon, Jul 10, 2017 at 1:01 PM Friedman, Eli <efriedma at codeaurora.org>

> On 7/9/2017 4:36 PM, Dilan Manatunga via llvm-dev wrote:
> > When I looked at the debug output for the x86 backend though, I can't
> > figure out how they realize to get rid of that branch. Up to the last
> > point that MachineInstrs are printed (the rewrite virtual registers
> > pass), the MachineInstrs still show the two jump paradigm. But in the
> > final output, it somehow becomes one branch case.
> The "-print-after-all" flag is often useful to figure out what various
> passes do.
> >
> > I know one solution is for me to add a pass after basic block
> > placement to change these instructions, but I am wondering if there is
> > a recommended way to do this. Especially as this seems like a common
> > problem, where an existing generic pass would have some interface a
> > backend should support to allow branch re-writes to create the single
> > branch case.
> This transform already exists as target-independent code in
> BranchFolding.cpp.  Is TargetInstrInfo::reverseBranchCondition
> implemented for your target?
> -Eli
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170710/01691c87/attachment.html>

More information about the llvm-dev mailing list