<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 - CodeGen crash legalizing half precision"
   href="https://bugs.llvm.org/show_bug.cgi?id=40273">40273</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CodeGen crash legalizing half precision
          </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>Linux
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following c++ code:
_Float16 f(_Float16 x) {
  bool ne_i1 = x != 0.0f;
  _Float16 ne_float = ne_i1;
  return ne_float;
}

generates the following LLVM IR:
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: norecurse nounwind readnone uwtable
define dso_local half @_Z1fDF16_(half) local_unnamed_addr #0 {
  %2 = fcmp une half %0, 0xH0000
  %3 = uitofp i1 %2 to half
  ret half %3
}

attributes #0 = { norecurse nounwind readnone uwtable
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false"
"less-precise-fpmad"="false" "min-legal-vector-width"="0"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false"
"use-soft-float"="false" }

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 8.0.0 (trunk 350681)"}

This crashes with the following backtrace:
Stack dump:

0.      Program arguments:
/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8 -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name example.cpp -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file
/tmp/compiler-explorer-compiler11909-53-g0meeu.nzow/output.gcno -resource-dir
/opt/compiler-explorer/clang-trunk-20190109/lib/clang/8.0.0 -internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-trunk-20190109/lib/clang/8.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdeprecated-macro -fdebug-compilation-dir
/tmp/compiler-explorer-compiler11909-53-g0meeu.nzow -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/compiler-explorer-compiler11909-53-g0meeu.nzow/output.s -x c++ <source>
-faddrsig 

1.      <eof> parser at end of file

2.      Code generation

3.      Running pass 'Function Pass Manager' on module '<source>'.

4.      Running pass 'X86 DAG->DAG Instruction Selection' on function
'@_Z1fDF16_'

 #0 0x00005584e4d275fa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x241e5fa)

 #1 0x00005584e4d25594 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x241c594)

 #2 0x00005584e4d256d2 SignalHandler(int)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x241c6d2)

 #3 0x00007f4e9a9c8890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)

 #4 0x00005584e58738f2 llvm::SelectionDAG::createOperands(llvm::SDNode*,
llvm::ArrayRef<llvm::SDValue>)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2f6a8f2)

 #5 0x00005584e588563a llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc
const&, llvm::EVT, llvm::ArrayRef<llvm::SDValue>, llvm::SDNodeFlags)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2f7c63a)

 #6 0x00005584e5887aae llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc
const&, llvm::EVT, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::SDValue,
llvm::SDValue)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2f7eaae)

 #7 0x00005584e5945a01
llvm::DAGTypeLegalizer::PromoteFloatRes_SELECT_CC(llvm::SDNode*)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x303ca01)

 #8 0x00005584e5945bc5
llvm::DAGTypeLegalizer::PromoteFloatResult(llvm::SDNode*, unsigned int)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x303cbc5)

 #9 0x00005584e58e8dd5 llvm::DAGTypeLegalizer::run()
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2fdfdd5)

#10 0x00005584e58e9406 llvm::SelectionDAG::LegalizeTypes()
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2fe0406)

#11 0x00005584e58a1eb0 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2f98eb0)

#12 0x00005584e58a7761
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2f9e761)

#13 0x00005584e58a9d5d
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(.part.821) (/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2fa0d5d)

#14 0x00005584e3f03040 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x15fa040)

#15 0x00005584e4438900
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x1b2f900)

#16 0x00005584e475f109 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x1e56109)

#17 0x00005584e475f191 llvm::FPPassManager::runOnModule(llvm::Module&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x1e56191)

#18 0x00005584e475e4b9 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x1e554b9)

#19 0x00005584e4f304fd (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x26274fd)

#20 0x00005584e4f32f3b clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2629f3b)

#21 0x00005584e59741af
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x306b1af)

#22 0x00005584e6101299 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x37f8299)

#23 0x00005584e59730a7 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x306a0a7)

#24 0x00005584e53ba116 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2ab1116)

#25 0x00005584e537c36c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2a7336c)

#26 0x00005584e547265b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0x2b6965b)

#27 0x00005584e33f6958 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0xaed958)

#28 0x00005584e333bcd9 main
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0xa32cd9)

#29 0x00007f4e99886b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)

#30 0x00005584e33f3bea _start
(/opt/compiler-explorer/clang-trunk-20190109/bin/clang-8+0xaeabea)

clang-8: error: unable to execute command: Segmentation fault (core dumped)

clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)

clang version 8.0.0 (trunk 350681)</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>