[PATCH] D93229: [VectorCombine] allow peeking through GEPs when creating a vector load

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 11:36:38 PST 2020


nlopes added a comment.

In D93229#2452695 <https://reviews.llvm.org/D93229#2452695>, @lebedev.ri wrote:

>   /builddirs/llvm-project/build-Clang11-unknown$ /builddirs/llvm-project/build-Clang11-unknown/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -tv -vector-combine -mtriple=x86_64-- -mattr=avx2 -tv -o /dev/null --tv-smt-to=60000 /tmp/D93229.ll 
>   
>   ----------------------------------------
>   define <8 x i16> @t(* dereferenceable(128) align(128) %base) {
>   %0:
>     %ptr = gep inbounds * dereferenceable(128) align(128) %base, 1 x i64 1
>     %p = bitcast * %ptr to *
>     %gep = gep inbounds * %p, 16 x i64 0, 2 x i64 1
>     %s = load i16, * %gep, align 1
>     %r = insertelement <8 x i16> undef, i16 %s, i64 0
>     ret <8 x i16> %r
>   }
>   =>
>   define <8 x i16> @t(* dereferenceable(128) align(128) %base) {
>   %0:
>     %ptr = gep inbounds * dereferenceable(128) align(128) %base, 1 x i64 1
>     %p = bitcast * %ptr to *
>     %gep = gep inbounds * %p, 16 x i64 0, 2 x i64 1
>     %1 = bitcast * %gep to *
>     %r = load <8 x i16>, * %1, align 1
>     ret <8 x i16> %r
>   }
>   Transformation doesn't verify!

Makes sense; it replaces an undef vector with a potential poison vector that might be in memory.
We need to switch to using poison as vector placeholders rather than undef so these problems go away. I guess clang needs a bit of patching (or IRBuilder, or both?).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93229/new/

https://reviews.llvm.org/D93229



More information about the llvm-commits mailing list