<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 - "Assertion `NewC && "Constant folding failed"' failed." with SVE"
   href="https://bugs.llvm.org/show_bug.cgi?id=49781">49781</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Assertion `NewC && "Constant folding failed"' failed." with SVE
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>efriedma@quicinc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Testcase:

define <vscale x 2 x i64> @foo(<vscale x 2 x i64> %a) {
%idx = shufflevector <vscale x 2 x i64> insertelement (<vscale x 2 x i64>
undef, i64 1, i32 0), <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i32>
zeroinitializer
 %b = sub <vscale x 2 x i64> %a, %idx
 %c = sub <vscale x 2 x i64> %b, %idx
 ret <vscale x 2 x i64> %c
}

With "llc -mtriple=aarch64 -mattr=+sve":

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3335: llvm::SDValue (anonymous
namespace)::DAGCombiner::visitSUB(llvm::SDNode *): Assertion `NewC && "Constant
folding failed"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: bin/llc -mtriple=aarch64 -mattr=+sve
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'AArch64 Instruction Selection' on function '@foo'
 #0 0x0000000004c81c03 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(bin/llc+0x4c81c03)
 #1 0x0000000004c7f7ce llvm::sys::RunSignalHandlers() (bin/llc+0x4c7f7ce)
 #2 0x0000000004c820d6 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007faebbb7a390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00007faeba564438 raise
/build/glibc-e6zv40/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #5 0x00007faeba56603a abort /build/glibc-e6zv40/glibc-2.23/stdlib/abort.c:91:0
 #6 0x00007faeba55cbe7 __assert_fail_base
/build/glibc-e6zv40/glibc-2.23/assert/assert.c:92:0
 #7 0x00007faeba55cc92 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc92)
 #8 0x00000000049291f4 (anonymous
namespace)::DAGCombiner::visitSUB(llvm::SDNode*) DAGCombiner.cpp:0:0
 #9 0x00000000048f8691 (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*)
DAGCombiner.cpp:0:0
#10 0x00000000048f3f31 (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x00000000048f1254 llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults*, llvm::CodeGenOpt::Level) (bin/llc+0x48f1254)
#12 0x0000000004ab258f llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(bin/llc+0x4ab258f)
#13 0x0000000004ab15b1
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(bin/llc+0x4ab15b1)
#14 0x0000000004aadc06
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(bin/llc+0x4aadc06)
#15 0x0000000003ff8b2a
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (bin/llc+0x3ff8b2a)
#16 0x00000000044353c2 llvm::FPPassManager::runOnFunction(llvm::Function&)
(bin/llc+0x44353c2)
#17 0x000000000443c1f8 llvm::FPPassManager::runOnModule(llvm::Module&)
(bin/llc+0x443c1f8)
#18 0x0000000004435a6e llvm::legacy::PassManagerImpl::run(llvm::Module&)
(bin/llc+0x4435a6e)
#19 0x00000000029f3b00 main (bin/llc+0x29f3b00)
#20 0x00007faeba54f840 __libc_start_main
/build/glibc-e6zv40/glibc-2.23/csu/../csu/libc-start.c:325:0
#21 0x00000000029f1029 _start (bin/llc+0x29f1029)
Aborted</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>