[llvm-dev] Global removal pass - potential for improvement?

Roman Lebedev via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 28 09:22:54 PST 2020

On Tue, Jan 28, 2020 at 8:09 PM Karl Rehm via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Hey everyone,
> I was looking into how the global optimization pass fares against things like what's reported in https://bugs.llvm.org/show_bug.cgi?id=44676
> Looking at this, I think it would be pretty trivial to optimize that down given that there are already threading assumptions made: https://godbolt.org/z/u6ZqoB
> Is this something I can look into?

> Another thing is that currently *all* external calls break this optimization, including calls to intrinsics that probably shouldn't: https://godbolt.org/z/pK7Cew
I think during load propagation, there is a legality check "here's a
load, and here's a store.
Is there anything in between that may have clobbered that memory location?".
For calls, there are some attributes that are helpful here:
So in this case, i guess `@llvm.x86.flags.write` intrinsic maybe can
be annotated with readonly attribute,
thus signalling that it won't clobber that memory location?

> Maybe add some sort of way (i.e. an attribute) to mark that a call can be optimized through in this way?


> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list