<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - regression in WebAssembly backend with vectors, assertion triggered"
   href="https://bugs.llvm.org/show_bug.cgi?id=47375">47375</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>regression in WebAssembly backend with vectors, assertion triggered
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>andrew@ziglang.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Zig source code:

const std = @import("std");

pub fn main() anyerror!void {
    t(u24, 2, [_]u24{ 0x123456, 0x234567 }, [_]u24{ 0x563412, 0x674523 });
}
fn t(
    comptime I: type,
    comptime n: comptime_int,
    input: std.meta.Vector(n, I),
    expected_vector: std.meta.Vector(n, I),
) void {
    const actual_output: [n]I = @byteSwap(I, input);
    const expected_output: [n]I = expected_vector;
    std.testing.expectEqual(expected_output, actual_output);
}

With LLVM 10 (asserts enabled):
$ ./zig build-exe test.zig -target wasm32-wasi
$ wasmtime ./test.wasm

With LLVM 11 (asserts enabled):
$ ./zig build-exe test.zig -target wasm32-wasi
zig: ../include/llvm/CodeGen/ValueTypes.h:261: llvm::MVT
llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a
SimpleValueType!"' failed.
Aborted (core dumped)


Backtrace:
(gdb) bt
#0  0x00007ffff7abe15a in raise ()
   from /nix/store/xg6ilb9g9zhi2zg1dpi4zcp288rhnvns-glibc-2.30/lib/libc.so.6
#1  0x00007ffff7aa8548 in abort ()
   from /nix/store/xg6ilb9g9zhi2zg1dpi4zcp288rhnvns-glibc-2.30/lib/libc.so.6
#2  0x00007ffff7aa842f in __assert_fail_base.cold.0 ()
   from /nix/store/xg6ilb9g9zhi2zg1dpi4zcp288rhnvns-glibc-2.30/lib/libc.so.6
#3  0x00007ffff7ab6ad2 in __assert_fail ()
   from /nix/store/xg6ilb9g9zhi2zg1dpi4zcp288rhnvns-glibc-2.30/lib/libc.so.6
#4  0x0000000004a87197 in llvm::EVT::getSimpleVT (this=0x7fffffff66e0)
    at ../include/llvm/CodeGen/ValueTypes.h:261
#5  0x0000000004bd370c in llvm::SDValue::getSimpleValueType
(this=0x7fffffff6700)
    at ../include/llvm/CodeGen/SelectionDAGNodes.h:171
#6  0x0000000004f30ade in
llvm::WebAssemblyTargetLowering::isVectorLoadExtDesirable (this=0x1c2fbcf8, 
    ExtVal=...) at ../lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:604
#7  0x000000000659df12 in (anonymous namespace)::DAGCombiner::CombineExtLoad
(this=0x7fffffff7450, 
    N=0x2c4ea4c8) at ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9691
#8  0x00000000065a13c4 in (anonymous namespace)::DAGCombiner::visitSIGN_EXTEND
(this=0x7fffffff7450, 
    N=0x2c4ea4c8) at ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10090
#9  0x00000000065628e8 in (anonymous namespace)::DAGCombiner::visit
(this=0x7fffffff7450, N=0x2c4ea4c8)
    at ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1636
#10 0x0000000006562e8c in (anonymous namespace)::DAGCombiner::combine
(this=0x7fffffff7450, 
    N=0x2c4ea4c8) at ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1712
#11 0x0000000006562139 in (anonymous namespace)::DAGCombiner::Run
(this=0x7fffffff7450, 
    AtLevel=llvm::BeforeLegalizeTypes) at
../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1529
#12 0x00000000065f1433 in llvm::SelectionDAG::Combine (this=0xe0ab6b0, 
    Level=llvm::BeforeLegalizeTypes, AA=0x0, OptLevel=llvm::CodeGenOpt::None)
    at ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22157
#13 0x0000000006703035 in llvm::SelectionDAGISel::CodeGenAndEmitDAG
(this=0x2d729f60)
    at ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:788
#14 0x0000000006702806 in llvm::SelectionDAGISel::SelectBasicBlock
(this=0x2d729f60, Begin=..., 
    End=..., HadTailCall=@0x7fffffff822f: false)
    at ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:709
#15 0x000000000670714c in llvm::SelectionDAGISel::SelectAllBasicBlocks
(this=0x2d729f60, Fn=...)
    at ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1584
#16 0x0000000006701423 in llvm::SelectionDAGISel::runOnMachineFunction
(this=0x2d729f60, mf=...)
    at ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:504
#17 0x0000000004f2abb4 in (anonymous
namespace)::WebAssemblyDAGToDAGISel::runOnMachineFunction (
    this=0x2d729f60, MF=...) at
../lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp:56
#18 0x0000000006ba62d4 in llvm::MachineFunctionPass::runOnFunction
(this=0x2d729f60, F=...)
    at ../lib/CodeGen/MachineFunctionPass.cpp:73
#19 0x0000000007c0af7f in llvm::FPPassManager::runOnFunction (this=0xf603ed0,
F=...)
    at ../lib/IR/LegacyPassManager.cpp:1587
#20 0x0000000007c0b1e4 in llvm::FPPassManager::runOnModule (this=0xf603ed0,
M=...)
    at ../lib/IR/LegacyPassManager.cpp:1629
#21 0x0000000007c0b60e in (anonymous namespace)::MPPassManager::runOnModule
(this=0x17a9cca0, M=...)
    at ../lib/IR/LegacyPassManager.cpp:1698
#22 0x0000000007c06c04 in llvm::legacy::PassManagerImpl::run (this=0x2d729ad0,
M=...)
    at ../lib/IR/LegacyPassManager.cpp:614
#23 0x0000000007c0bdf3 in llvm::legacy::PassManager::run (this=0x7fffffff8d80,
M=...)
    at ../lib/IR/LegacyPassManager.cpp:1824
#24 0x0000000002089380 in ZigLLVMTargetMachineEmitToFile
(targ_machine_ref=0xda5f520, 
    module_ref=0xda5d610, error_message=0x7fffffff9070, is_debug=true,
is_small=false, 
    time_report=false, asm_filename=0x0, 
    bin_filename=0x275214a0
"/home/andy/tmp/zig/zig-cache/o/fe9YQ5-4hUaruXlD5NTucxQMkRxywEWsQPj_8oosIfczWigCzaDdqutnEYHeCQ38/test.o",
llvm_ir_filename=0x0) at ../src/zig_llvm.cpp:284
#25 0x0000000001bbeaf8 in zig_llvm_emit_output (g=0xda494d0) at
../src/codegen.cpp:8346
#26 0x0000000001bc9685 in codegen_build_and_link (g=0xda494d0) at
../src/codegen.cpp:11075
#27 0x0000000001b99a93 in main0 (argc=21, argv=0x7fffffff9d08) at
../src/main.cpp:1786
#28 0x0000000001b99ef4 in main (argc=21, argv=0x7fffffff9d08) at
../src/main.cpp:1864


I was unable to reproduce this with llc or clang directly. Here are the steps
to reproduce:

git clone <a href="https://github.com/ziglang/zig/">https://github.com/ziglang/zig/</a>
cd zig
git checkout llvm11
mkdir build
cd build
cmake ..  -DCMAKE_PREFIX_PATH=$HOME/local/llvm11-debug  -GNinja
ninja
vim test.zig # see source above
./zig build-exe test.zig -target wasm32-wasi</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>