Issue 127128
Summary SLPVectorizer miscompilation
Labels new issue
Assignees
Reporter Zentrik
    ```llvm
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-unknown-linux-gnu"

define swiftcc { ptr addrspace(10), i8 } @julia__dir2ori_404(float %0) {
  %2 = fdiv float 0.000000e+00, 0.000000e+00
  %3 = fdiv float 0.000000e+00, 0.000000e+00
  %4 = fdiv float %0, 0.000000e+00
  br label %5

5: ; preds = %1
  %6 = fmul float %4, 0.000000e+00
  %7 = fsub float 0.000000e+00, %6
  %8 = fmul float %3, 0.000000e+00
  %9 = fsub float 0.000000e+00, %8
  br label %11

10: ; No predecessors!
  br label %11

11: ; preds = %10, %5
  %12 = phi float [ %7, %5 ], [ 0.000000e+00, %10 ]
  %13 = phi float [ %9, %5 ], [ 0.000000e+00, %10 ]
 br label %14

14:                                               ; preds = %11
  %15 = fmul float %2, 0.000000e+00
  %16 = fsub float %12, %15
  %17 = fmul float %4, 0.000000e+00
  %18 = fsub float %13, %17
  %19 = fadd float %16, %18
  %20 = call float @llvm.fabs.f32(float %19)
  ret { ptr addrspace(10), i8 } zeroinitializer
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
```
produces 
```
Instruction does not dominate all uses!
  %4 = insertelement <2 x float> <float poison, float 0.000000e+00>, float %0, i32 0
  %2 = shufflevector <2 x float> %4, <2 x float> <float 0.000000e+00, float poison>, <2 x i32> <i32 2, i32 0>
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer -mcpu=haswell <source>
1.	Running pass "verify" on module "<source>"
 #0 0x00000000054edec8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x54edec8)
 #1 0x00000000054eb884 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007faaea842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007faaea8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007faaea842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007faaea8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000082790d llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
 #7 0x000000000542b6e8 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x542b6e8)
 #8 0x0000000005329278 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5329278)
 #9 0x000000000095605e llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x95605e)
#10 0x00000000052e7b50 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x52e7b50)
#11 0x000000000096174a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96174a)
#12 0x0000000000953c7c optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x953c7c)
#13 0x00007faaea829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#14 0x00007faaea829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#15 0x000000000094b555 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x94b555)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
on 19 and trunk.
Godbolt: https://godbolt.org/z/qxKP6198T
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to