<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/114009>114009</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Building libclc on s390x failed with `Invalid operands for select instruction!`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:SystemZ,
            build-problem,
            libclc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sylvestre
      </td>
    </tr>
</table>

<pre>
    on Linux Debian bookworm:

```

[846/2673] cd /build/source/libclc/build && /build/source/build-llvm/tools/clang/stage2-bins/bin/opt -O3 -o builtins.opt.tahiti-amdgcn--.bc /build/source/libclc/build/builtins.link.tahiti-amdgcn--.bc
FAILED: builtins.opt.tahiti-amdgcn--.bc /build/source/libclc/build/builtins.opt.tahiti-amdgcn--.bc
cd /build/source/libclc/build && /build/source/build-llvm/tools/clang/stage2-bins/bin/opt -O3 -o builtins.opt.tahiti-amdgcn--.bc /build/source/libclc/build/builtins.link.tahiti-amdgcn--.bc
Invalid operands for select instruction!
  %23 = select <3 x i1> %17, <4 x i32> <i32 0, i32 0, i32 0, i32 undef>, <4 x i32> %22
Invalid operands for select instruction!
  %23 = select <3 x i1> %17, <4 x i32> <i32 0, i32 0, i32 0, i32 undef>, <4 x i32> %22
Invalid operands for select instruction!
  %23 = select <3 x i1> %17, <4 x i32> <i32 0, i32 0, i32 0, i32 undef>, <4 x i32> %22
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: /build/source/build-llvm/tools/clang/stage2-bins/bin/opt -O3 -o builtins.opt.tahiti-amdgcn--.bc /build/source/libclc/build/builtins.link.tahiti-amdgcn--.bc
1.      Running pass "verify" on module "/build/source/libclc/build/builtins.link.tahiti-amdgcn--.bc"
 #0 0x000003ff82c6d122 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0x000003ff82c6d9b8 RunSignalHandlers build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Signals.cpp:106:18
 #2 0x000003ff82c6d9b8 SignalHandler(int) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:403:3
 #3 0x000002aa12a84d5e
 #4 0x000003ff8169872a (/lib/s390x-linux-gnu/libc.so.6+0x9872a)
 #5 0x000003ff816487a8 raise (/lib/s390x-linux-gnu/libc.so.6+0x487a8)
 #6 0x000003ff8162b5f4 abort (/lib/s390x-linux-gnu/libc.so.6+0x2b5f4)
 #7 0x000003ff82b88b02 llvm::report_fatal_error(llvm::Twine const&, bool) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/ErrorHandling.cpp:126:5
 #8 0x000003ff82b88936 (/build/source/build-llvm/tools/clang/stage2-bins/lib/libLLVM.so.20.0+0xf88936)
 #9 0x000003ff82ed3bb4 llvm::VerifierPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) build-llvm/tools/clang/stage2-bins/llvm/lib/IR/Verifier.cpp:0:5
#10 0x000003ff82e91678 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) build-llvm/tools/clang/stage2-bins/llvm/include/llvm/IR/PassManagerImpl.h:85:8
#11 0x000002aa11ea806c isSmall build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/SmallPtrSet.h:219:33
#12 0x000002aa11ea806c ~SmallPtrSetImplBase build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/SmallPtrSet.h:85:10
#13 0x000002aa11ea806c ~PreservedAnalyses build-llvm/tools/clang/stage2-bins/llvm/include/llvm/IR/Analysis.h:111:7
#14 0x000002aa11ea806c 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) build-llvm/tools/clang/stage2-bins/llvm/tools/opt/NewPMDriver.cpp:541:3
#15 0x000002aa11e9f17e _M_data /usr/lib/gcc/s390x-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:234:28
#16 0x000002aa11e9f17e _M_is_local /usr/lib/gcc/s390x-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:274:16
#17 0x000002aa11e9f17e _M_dispose /usr/lib/gcc/s390x-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:285:7
#18 0x000002aa11e9f17e ~basic_string /usr/lib/gcc/s390x-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:795:9
#19 0x000002aa11e9f17e optMain build-llvm/tools/clang/stage2-bins/llvm/tools/opt/optdriver.cpp:747:3
#20 0x000002aa11e9cb3a main build-llvm/tools/clang/stage2-bins/llvm/tools/opt/opt.cpp:0:42
#21 0x000003ff8162b89a (/lib/s390x-linux-gnu/libc.so.6+0x2b89a)
#22 0x000003ff8162b982 __libc_start_main (/lib/s390x-linux-gnu/libc.so.6+0x2b982)
#23 0x000002aa11e9ca40 _start (/build/source/build-llvm/tools/clang/stage2-bins/bin/opt+0x1ca40)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWEtv47oV_jX0hrAhHeq58MJ5GB006QTJ9C66MSiKktnQpEBSeWzuby9I2ZaVcYpmJnPbog0M2SF5zvl4Hh-PSK0VreJ8idILlF7NaO-22iztq3zi1hk-q3T9utQK3wjVv-ArXgmqcKX147M2O0RWKLpC0eGZRfvP6WB6USQZgjVkOUHpFWY1RrCueiFrBGure8M4grUUFZPsMIMRZAiysyvDwFzKpx2CtdNaWgRrJq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