[PATCH] D103458: [SLP]Improve gathering of scalar elements.

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 21:21:45 PDT 2021


Carrot added a comment.

Compile the following test case with

opt -slp-vectorizer -S test3.ll

Then I can get a poison value in the phi instruction.

  target triple = "x86_64-grtev4-linux-gnu"
  
  %S = type { i64, i40 }
  
  define void @foo(i1 %cond) {
  entry:
    %nb = alloca %S, align 8
    br i1 %cond, label %then, label %bug
  
  then:
    call void @baz()
    %ptr_2 = getelementptr inbounds %S, %S* %nb, i64 0, i32 0
    %load2 = load i64, i64* %ptr_2, align 8
    %bf_1 = getelementptr inbounds %S, %S* %nb, i64 0, i32 1
    %ptr_1 = bitcast i40* %bf_1 to i64*
    %load1 = load i64, i64* %ptr_1, align 8
    br label %bug
  
  bug:
    %word1 = phi i64 [ %load1, %then ], [ undef, %entry ]
    %word2 = phi i64 [ %load2, %then ], [ undef, %entry ]
    %ptr2 = getelementptr inbounds %S, %S* %nb, i64 0, i32 0
    %word2.clear = and i64 %word2, -1152921504606846976
    %word2.set = or i64 %word2.clear, 1
    store i64 %word2.set, i64* %ptr2, align 8
    %bf1 = getelementptr inbounds %S, %S* %nb, i64 0, i32 1
    %ptr1 = bitcast i40* %bf1 to i64*
    %word1.clear = and i64 %word1, -68719476736
    %word1.set = or i64 %word1.clear, 21
    store i64 %word1.set, i64* %ptr1, align 8
    call void @bar()
    br label %exit
  
  exit:
    ret void
  }
  
  declare void @bar()
  declare void @baz()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103458



More information about the llvm-commits mailing list