access-softek / llvm-project

Other
0 stars 0 forks source link

LLVM ERROR: Do not know how to expand the result of this operaton" for t13: i32 = lround t12 #13

Closed atrosinenko closed 11 months ago

atrosinenko commented 4 years ago

Another error while compiling newlib, specifically the newlib/libm/common/lroundl.c file. Except for the copyright notice, all its contents are:

#include <math.h>
#include "local.h"

/* On platforms where long double is as wide as double.  */
#ifdef _LDBL_EQ_DBL
long
lroundl (long double x)
{
  return lround(x);
}
#endif

With some minimization, the emitted bitcode can be reduced to:

target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
target triple = "msp430"

define i32 @lroundl(double %x) local_unnamed_addr #0 {
entry:
  %0 = tail call i32 @llvm.lround.i32.f64(double %x)
  ret i32 %0
}

declare i32 @llvm.lround.i32.f64(double) #1

attributes #0 = { "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable }

This produces the following output:

$ /path/to/bin/llc bugpoint-reduced-simplified.ll
ExpandIntegerResult #0: t13: i32 = lround t12

LLVM ERROR: Do not know how to expand the result of this operator!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /old_ssd/ast/msp430-projects/llvm-project/build-rel-assert/bin/llc bugpoint-reduced-simplified.ll 
1.      Running pass 'Function Pass Manager' on module 'bugpoint-reduced-simplified.ll'.
2.      Running pass 'MSP430 DAG->DAG Pattern Instruction Selection' on function '@lroundl'
 #0 0x0000561e5219cf2e llvm::sys::PrintStackTrace(llvm::raw_ostream&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/Support/Unix/Signals.inc:568:3
 #1 0x0000561e5219aca4 llvm::sys::RunSignalHandlers() /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/Support/Signals.cpp:68:20
 #2 0x0000561e5219b3e5 SignalHandler(int) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/Support/Unix/Signals.inc:396:31
 #3 0x00007fc2d7592540 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x15540)
 #4 0x00007fc2d70273eb raise /build/glibc-t7JzpG/glibc-2.30/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007fc2d7006899 abort /build/glibc-t7JzpG/glibc-2.30/stdlib/abort.c:81:7
 #6 0x0000561e52121979 llvm::SmallVectorBase::SmallVectorBase(void*, unsigned long) /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:45:48
 #7 0x0000561e52121979 llvm::SmallVectorTemplateCommon<char, void>::SmallVectorTemplateCommon(unsigned long) /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:95:43
 #8 0x0000561e52121979 llvm::SmallVectorTemplateBase<char, true>::SmallVectorTemplateBase(unsigned long) /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:261:75
 #9 0x0000561e52121979 llvm::SmallVectorImpl<char>::SmallVectorImpl(unsigned int) /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:327:37
#10 0x0000561e52121979 llvm::SmallVector<char, 64u>::SmallVector() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:839:39
#11 0x0000561e52121979 llvm::report_fatal_error(llvm::Twine const&, bool) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/Support/ErrorHandling.cpp:113:27
#12 0x0000561e52121a9e (/old_ssd/ast/msp430-projects/llvm-project/build-rel-assert/bin/llc+0x1650a9e)
#13 0x0000561e520dbe0c llvm::DAGTypeLegalizer::ExpandIntegerResult(llvm::SDNode*, unsigned int) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1890:23
#14 0x0000561e52056b5a llvm::DAGTypeLegalizer::run() /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:258:14
#15 0x0000561e52057979 llvm::SmallVectorTemplateCommon<llvm::SDNode*, void>::end() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:129:35
#16 0x0000561e52057979 llvm::SmallVector<llvm::SDNode*, 128u>::~SmallVector() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/SmallVector.h:843:5
#17 0x0000561e52057979 llvm::DAGTypeLegalizer::~DAGTypeLegalizer() /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h:31:31
#18 0x0000561e52057979 llvm::SelectionDAG::LegalizeTypes() /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1041:10
#19 0x0000561e51fe86ee llvm::TimeRegion::~TimeRegion() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/Support/Timer.h:152:9
#20 0x0000561e51fe86ee llvm::NamedRegionTimer::~NamedRegionTimer() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/Support/Timer.h:160:8
#21 0x0000561e51fe86ee llvm::SelectionDAGISel::CodeGenAndEmitDAG() /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:836:61
#22 0x0000561e51fede67 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1616:33
#23 0x0000561e51ff0002 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:504:22
#24 0x0000561e51622f59 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:33
#25 0x0000561e51622f59 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:38:6
#26 0x0000561e51a362a3 llvm::FPPassManager::runOnFunction(llvm::Function&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1483:7
#27 0x0000561e51a36d19 llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true, false, void> >::getNext() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/ilist_node.h:66:66
#28 0x0000561e51a36d19 llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true, false, void>, false, false>::operator++() /old_ssd/ast/msp430-projects/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:157:25
#29 0x0000561e51a36d19 llvm::FPPassManager::runOnModule(llvm::Module&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1517:22
#30 0x0000561e51a370d3 runOnModule /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1584:7
#31 0x0000561e51a370d3 llvm::legacy::PassManagerImpl::run(llvm::Module&) /old_ssd/ast/msp430-projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1695:55
#32 0x0000561e50e9f25b compileModule /old_ssd/ast/msp430-projects/llvm-project/llvm/tools/llc/llc.cpp:627:66
#33 0x0000561e50e9f25b main /old_ssd/ast/msp430-projects/llvm-project/llvm/tools/llc/llc.cpp:360:35
#34 0x00007fc2d70081e3 __libc_start_main /build/glibc-t7JzpG/glibc-2.30/csu/../csu/libc-start.c:342:3
#35 0x0000561e50eecbde _start (/old_ssd/ast/msp430-projects/llvm-project/build-rel-assert/bin/llc+0x41bbde)