[PATCH] D149548: [IR] Update to use new shufflevector semantics

Manuel Brito via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 9 10:42:34 PDT 2023


ManuelJBrito added a comment.

In D149548#4405173 <https://reviews.llvm.org/D149548#4405173>, @qiucf wrote:

> Why this changes IR output of following case?
>
>   // RUN: clang vecpromote.c -S -o - -O0 -target s390x-linux-gnu -fzvector -emit-llvm
>   #include <vecintrin.h>
>   
>   vector int si;
>   int g;
>   int i;
>   
>   void foo() {
>     si = vec_promote(g, i);
>   }
>   
>   // store <4 x i32> undef, ptr %__vec.i, align 16, !noalias !6  ; this undef becomes poison after this patch
>   // %2 = load i32, ptr %__scalar.addr.i, align 4, !noalias !6
>   // %3 = load i32, ptr %__index.addr.i, align 4, !noalias !6
>   // %4 = load <4 x i32>, ptr %__vec.i, align 16, !noalias !6
>   // %vecins.i = insertelement <4 x i32> %4, i32 %2, i32 %and.i

I think it's because vec_promote is implemented in clang using a shufflevector with an undefined mask (-1). 
ConstantFold sees that we have a fully undefined mask and it folds the shufflevector to poison.(previously undef)
My concern : is it Ok to have the undefined values of the vector be poison or was the undef used to abide to some specific semantics?
Hope this makes sense.

> I see no PowerPC related case changes. Maybe adding SystemZ folks for comments @uweigand @jonpa

My bad I pinged the wrong people, thanks for adding SystemZ folks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149548



More information about the cfe-commits mailing list