[llvm-bugs] [Bug 43769] New: Regression in "[DAGCombine][ARM] x ==/!= c -> (x - c) ==/!= 0 iff '-c' can be folded into the x node."

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 22 23:56:13 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43769

            Bug ID: 43769
           Summary: Regression in "[DAGCombine][ARM] x ==/!= c  ->  (x -
                    c) ==/!= 0  iff '-c' can be folded into the x node."
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: deadalnix at gmail.com, lebedev.ri at gmail.com,
                    llvm-bugs at lists.llvm.org

Created attachment 22706
  --> https://bugs.llvm.org/attachment.cgi?id=22706&action=edit
Reproduction sample

Since "[DAGCombine][ARM] x ==/!= c  ->  (x - c) ==/!= 0  iff '-c' can be folded
into the x node.", building of Qt, ffmpeg/libav and libgcrypt fail for
mingw-i686, with a failed assert `BitWidth == RHS.BitWidth && "Bit widths must
be the same"'.

To reproduce, build the attached sample like this:
$ clang -target i686-w64-mingw32 -c -O2 g723_1enc-preproc.c 
clang-10: ../lib/CodeGen/SelectionDAG/TargetLowering.cpp:3092: llvm::SDValue
llvm::TargetLowering::optimizeSetCCToComparisonWithZero(llvm::EVT,
llvm::SDValue, llvm::ConstantSDNode*, llvm::ISD::CondCode,
llvm::TargetLowering::DAGCombinerInfo&, const llvm::SDLoc&) const: Assertion
`NewC && "Constant-folding failed!"' failed.
Stack dump:
0.      Program arguments:
/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10 -cc1 -triple
i686-w64-windows-gnu -emit-obj -disable-free -main-file-name
g723_1enc-preproc.c -mrelocation-model static -mthread-model posix
-mframe-pointer=none -fmath-errno -masm-verbose -mconstructor-aliases
-target-cpu pentium4 -dwarf-column-info -debugger-tuning=gdb -resource-dir
/home/martin/code/llvm-project-bisect/llvm/build/lib/clang/10.0.0
-internal-isystem
/home/martin/code/llvm-project-bisect/llvm/build/lib/clang/10.0.0/include
-internal-isystem
/home/martin/clang-nightly/i686-w64-mingw32/sys-root/mingw/include
-internal-isystem /home/martin/clang-nightly/i686-w64-mingw32/include
-internal-isystem /home/martin/clang-nightly/include -O2
-fdebug-compilation-dir /home/martin/code/llvm-project-bisect/llvm/build
-ferror-limit 19 -fmessage-length 0 -fno-use-cxa-atexit -fgnuc-version=4.2.1
-fobjc-runtime=gcc -fdwarf-exceptions -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o
g723_1enc-preproc.o -x c g723_1enc-preproc.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'g723_1enc-preproc.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function
'@get_fcb_param'
 #0 0x000055706ddd251a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x48d651a)
 #1 0x000055706ddd0144 llvm::sys::RunSignalHandlers()
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x48d4144)
 #2 0x000055706ddd0282 SignalHandler(int)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x48d4282)
 #3 0x00007fd4e2b63890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fd4e1814e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fd4e1816801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fd4e180639a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fd4e1806412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x000055706ecae675
llvm::TargetLowering::optimizeSetCCToComparisonWithZero(llvm::EVT,
llvm::SDValue, llvm::ConstantSDNode*, llvm::ISD::CondCode,
llvm::TargetLowering::DAGCombinerInfo&, llvm::SDLoc const&) const
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x57b2675)
 #9 0x000055706ecd983c llvm::TargetLowering::SimplifySetCC(llvm::EVT,
llvm::SDValue, llvm::SDValue, llvm::ISD::CondCode, bool,
llvm::TargetLowering::DAGCombinerInfo&, llvm::SDLoc const&) const
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x57dd83c)
#10 0x000055706eb0c913 (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x5610913)
#11 0x000055706eb0e2af (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x56122af)
#12 0x000055706eb10051 llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults*, llvm::CodeGenOpt::Level)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x5614051)
#13 0x000055706ebeb8b0 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x56ef8b0)
#14 0x000055706ebf10db
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x56f50db)
#15 0x000055706ebf2b7c
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(.part.818)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x56f6b7c)
#16 0x000055706cf5b77f (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x3a5f77f)
#17 0x000055706d35232e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x3e5632e)
#18 0x000055706d77f779 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x4283779)
#19 0x000055706d780129 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x4284129)
#20 0x000055706d77e9d1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x42829d1)
#21 0x000055706e3ae89c (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x4eb289c)
#22 0x000055706e3b013c 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> >)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x4eb413c)
#23 0x000055706e7adcad
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x52b1cad)
#24 0x000055706f6bb109 clang::ParseAST(clang::Sema&, bool, bool)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x61bf109)
#25 0x000055706e7ab7d0 clang::CodeGenAction::ExecuteAction()
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x52af7d0)
#26 0x000055706e6ca1f9 clang::FrontendAction::Execute()
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x51ce1f9)
#27 0x000055706e636c4a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x513ac4a)
#28 0x000055706e7880ec
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x528c0ec)
#29 0x000055706c9238af cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x34278af)
#30 0x000055706c9213ca main
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x34253ca)
#31 0x00007fd4e17f7b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#32 0x000055706c91ca1a _start
(/home/martin/code/llvm-project-bisect/llvm/build/bin/clang-10+0x3420a1a)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191023/e6779079/attachment-0001.html>


More information about the llvm-bugs mailing list