[llvm-dev] GVN vs. LoopVectorizer

Michael Ferguson via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 12 07:32:48 PST 2018


Hi -

I'm writing to start discussion about which approach is better for
solving an undesirable interaction between GVN and the loop
vectorizer.

A while ago I posted this bug:

  https://bugs.llvm.org/show_bug.cgi?id=39235

I ran into this bug when updating our front-end (for the Chapel
compiler) to emit !noalias metadata in certain situations. I was very
surprised when I discovered that the !noalias metadata actually
*reduced* performance for certain programs!

The reason for that is that GVN does a PRE of a load and this prevents
the loop vectorizer from vectorizing that loop. The linked bug report
includes a complete example.

I can imagine two strategies to resolve this problem:
 1. Make GVN's load-PRE optimization avoid cases that interfere with
vectorization
 2. Teach the LoopVectorizer to undo such a PRE so that the loop can
be vectorized

Of course there might be other good approaches. What do you think -
how we should solve this problem?

Thanks,

-michael


More information about the llvm-dev mailing list