Provide better -O0 assembly on request

Sergey Dmitrouk sdmitrouk at accesssoftek.com
Mon May 18 13:53:17 PDT 2015


Hi Paul,

On Mon, May 18, 2015 at 12:04:17PM -0700, Robinson, Paul wrote:
> There's no doubt that fast-isel could do better with debug locations.
> The local value map does seem to be one source of problems in this area.
> It looks like you are trying the tactic of eliminating the local value
> map entirely.  This has the unfortunate effect of causing fast-isel to
> emit redundant constant loads, which is very sad.

I understand that, but emitting redundant loads is the only way to get
correct locations in *all* cases.  GCC does this for -O0 and assembly it
generates matches source code really closely.

> I wonder if a better tactic would be this: Don't attach any debug location
> to a local value map instruction at first; this avoids the "random" debug
> location problem.  Then when you are finishing up the block, find the first
> "real" debug location, and copy it to the first instruction in the block.
> This avoids having the beginning of the block implicitly use the last debug
> location of the physically preceding block, which will usually be wrong too.
>
> What do you think?

This would be a decent improvement on its own, I think I'll try to do this.
It solves the actual issue I'm fighting here.  I just thought that more
generic solution might be of interest, but this should do it for this case.
Thanks!

-- 
Sergey



More information about the llvm-commits mailing list