From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 70199] New: clang+llvm from svn crashes when generating opencl code for 64 bit types Date: Sun, 06 Oct 2013 16:40:20 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0071297689==" Return-path: Received: from culpepper.freedesktop.org (unknown [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 49527E644F for ; Sun, 6 Oct 2013 09:40:20 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0071297689== Content-Type: multipart/alternative; boundary="1381077620.C610ECB0.30432"; charset="us-ascii" --1381077620.C610ECB0.30432 Date: Sun, 6 Oct 2013 16:40:20 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=70199 Priority: medium Bug ID: 70199 Assignee: dri-devel@lists.freedesktop.org Summary: clang+llvm from svn crashes when generating opencl code for 64 bit types Severity: normal Classification: Unclassified OS: All Reporter: klondike@klondike.es Hardware: Other Status: NEW Version: 9.2 Component: Drivers/DRI/R600 Product: Mesa Created attachment 87199 --> https://bugs.freedesktop.org/attachment.cgi?id=87199&action=edit 64 bit unsigned integer divide it causes the first issue When generating code from opencl files containing 64 bit integer types the compiler crashes with messages similar to this: 0x67be970: i32 = ExternalSymbol'__udivdi3' Undefined function UNREACHABLE executed at /home/klondike/myllvm/llvm/lib/Target/R600/AMDGPUISelLowering.h:76! 0 clang 0x0000000001d2f795 llvm::sys::PrintStackTrace(_IO_FILE*) + 37 1 clang 0x0000000001d2fbe3 2 libpthread.so.0 0x00000337e68ffbf0 3 libc.so.6 0x00000337e54e5b05 gsignal + 53 4 libc.so.6 0x00000337e54e6f7b abort + 379 5 clang 0x0000000001d1f088 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 440 6 clang 0x0000000001597712 7 clang 0x00000000016696cf llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&) const + 2511 8 clang 0x000000000168e1b6 llvm::TargetLowering::makeLibCall(llvm::SelectionDAG&, llvm::RTLIB::Libcall, llvm::EVT, llvm::SDValue const*, unsigned int, bool, llvm::SDLoc, bool, bool) const + 806 9 clang 0x0000000001721c5e 10 clang 0x000000000171d390 11 clang 0x00000000016c1823 12 clang 0x00000000016c6964 llvm::SelectionDAG::LegalizeTypes() + 36 13 clang 0x000000000167d6fd llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1389 14 clang 0x000000000167c909 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 6249 15 clang 0x000000000167a3a7 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1319 16 clang 0x00000000017c876c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 124 17 clang 0x0000000001c6f3d3 llvm::FPPassManager::runOnFunction(llvm::Function&) + 355 18 clang 0x0000000001c6f64b llvm::FPPassManager::runOnModule(llvm::Module&) + 43 19 clang 0x0000000001c6f994 llvm::MPPassManager::runOnModule(llvm::Module&) + 420 20 clang 0x0000000001c7003b llvm::PassManagerImpl::run(llvm::Module&) + 539 21 clang 0x0000000001c701aa llvm::PassManager::run(llvm::Module&) + 10 22 clang 0x0000000000808137 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 6167 23 clang 0x0000000000805ab3 24 clang 0x000000000096db63 clang::ParseAST(clang::Sema&, bool, bool) + 515 25 clang 0x0000000000804f12 clang::CodeGenAction::ExecuteAction() + 514 26 clang 0x0000000000682461 clang::FrontendAction::Execute() + 113 27 clang 0x00000000006607bd clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 909 28 clang 0x00000000006474f5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3077 29 clang 0x000000000063efb4 cc1_main(char const**, char const**, char const*, void*) + 628 30 clang 0x0000000000645454 main + 8500 31 libc.so.6 0x00000337e54d25dd __libc_start_main + 237 32 clang 0x000000000063ec5d Stack dump: 0. Program arguments: /home/klondike/myllvm/build/Release+Asserts/bin/clang -cc1 -triple r600-- -S -disable-free -main-file-name ldiv.cl -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-cpu redwood -target-linker-version 2.23.1 -coverage-file /home/klondike/opencl-example/- -resource-dir /home/klondike/myllvm/build/Release+Asserts/bin/../lib/clang/3.4 -include clc/clc.h -D cl_clang_storage_class_specifiers -D cl_khr_fp64 -std=cl -fno-dwarf-directory-asm -fdebug-compilation-dir /home/klondike/opencl-example -ferror-limit 19 -fmessage-length 192 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o - -x cl ldiv.cl 1. parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module 'ldiv.cl'. 4. Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on function '@ldiv' clang: error: unable to execute command: Aborted clang: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.4 (trunk 192013) Target: r600-- Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/ldiv-5f4dde.cl clang: note: diagnostic msg: /tmp/ldiv-5f4dde.sh clang: note: diagnostic msg: ******************** And this: fatal error: error in backend: Cannot select: 0x5a141e0: ch = store 0x59d1bf0, 0x5a147e0, 0x5a127c0, 0x5a11bc0 [ORD=2] [ID=26] 0x5a147e0: i32 = add 0x5a146e0, 0x5a145e0 [ORD=1] [ID=23] 0x5a146e0: i32 = add 0x5a143e0, 0x5a144e0 [ORD=1] [ID=20] 0x5a143e0: i32 = mulhu 0x5a124c0, 0x5a120c0 [ORD=1] [ID=16] 0x5a124c0: i32 = CONST_ADDRESS 0x5a123c0 [ID=10] 0x5a123c0: i32 = Constant<8240> [ID=5] 0x5a120c0: i32 = CONST_ADDRESS 0x5a11fc0 [ID=12] 0x5a11fc0: i32 = Constant<8232> [ID=7] 0x5a144e0: i32 = mul 0x5a124c0, 0x5a122c0 [ORD=1] [ID=14] 0x5a124c0: i32 = CONST_ADDRESS 0x5a123c0 [ID=10] 0x5a123c0: i32 = Constant<8240> [ID=5] 0x5a122c0: i32 = CONST_ADDRESS 0x5a121c0 [ID=11] 0x5a121c0: i32 = Constant<8236> [ID=6] 0x5a145e0: i32 = mul 0x5a151f0, 0x5a120c0 [ORD=1] [ID=15] 0x5a151f0: i32 = CONST_ADDRESS 0x5a14fe0 [ID=9] 0x5a14fe0: i32 = Constant<8244> [ID=4] 0x5a120c0: i32 = CONST_ADDRESS 0x5a11fc0 [ID=12] 0x5a11fc0: i32 = Constant<8232> [ID=7] 0x5a127c0: i32 = DWORDADDR 0x5a125c0 [ORD=2] [ID=25] 0x5a125c0: i32 = srl 0x5a14ae0, 0x5a126c0 [ORD=2] [ID=22] 0x5a14ae0: i32 = add 0x5a11ec0, 0x5a149e0 [ORD=2] [ID=19] 0x5a11ec0: i32 = CONST_ADDRESS 0x5a11dc0 [ID=13] 0x5a11dc0: i32 = Constant<8228> [ID=8] 0x5a149e0: i32 = Constant<4> [ID=2] 0x5a126c0: i32 = Constant<2> [ID=3] 0x5a11bc0: i32 = undef [ID=1] In function: lmul clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 3.4 (trunk 192013) Target: r600-- Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/lmul-213f81.cl clang: note: diagnostic msg: /tmp/lmul-213f81.sh clang: note: diagnostic msg: ******************** The suggestion on the chat has been using TargetLowering to handle this issue. (See http://llvm.org/docs/doxygen/html/structllvm_1_1TargetLowering_1_1TargetLoweringOpt.html for details). Following come some examples of llvm ir that produces crashes despite being generated by clang from valid opencl programs. -- You are receiving this mail because: You are the assignee for the bug. --1381077620.C610ECB0.30432 Date: Sun, 6 Oct 2013 16:40:20 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"
Priority medium
Bug ID 70199
Assignee dri-devel@lists.freedesktop.org
Summary clang+llvm from svn crashes when generating opencl code for 64 bit types
Severity normal
Classification Unclassified
OS All
Reporter klondike@klondike.es
Hardware Other
Status NEW
Version 9.2
Component Drivers/DRI/R600
Product Mesa

Created attachment 87199 [details]
64 bit unsigned integer divide it causes the first issue

When generating code from opencl files containing 64 bit integer types the
compiler crashes with messages similar to this:
0x67be970: i32 = ExternalSymbol'__udivdi3'
Undefined function
UNREACHABLE executed at
/home/klondike/myllvm/llvm/lib/Target/R600/AMDGPUISelLowering.h:76!
0  clang           0x0000000001d2f795 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x0000000001d2fbe3
2  libpthread.so.0 0x00000337e68ffbf0
3  libc.so.6       0x00000337e54e5b05 gsignal + 53
4  libc.so.6       0x00000337e54e6f7b abort + 379
5  clang           0x0000000001d1f088 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 440
6  clang           0x0000000001597712
7  clang           0x00000000016696cf
llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&)
const + 2511
8  clang           0x000000000168e1b6
llvm::TargetLowering::makeLibCall(llvm::SelectionDAG&, llvm::RTLIB::Libcall,
llvm::EVT, llvm::SDValue const*, unsigned int, bool, llvm::SDLoc, bool, bool)
const + 806
9  clang           0x0000000001721c5e
10 clang           0x000000000171d390
11 clang           0x00000000016c1823
12 clang           0x00000000016c6964 llvm::SelectionDAG::LegalizeTypes() + 36
13 clang           0x000000000167d6fd
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1389
14 clang           0x000000000167c909
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 6249
15 clang           0x000000000167a3a7
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1319
16 clang           0x00000000017c876c
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 124
17 clang           0x0000000001c6f3d3
llvm::FPPassManager::runOnFunction(llvm::Function&) + 355
18 clang           0x0000000001c6f64b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
19 clang           0x0000000001c6f994
llvm::MPPassManager::runOnModule(llvm::Module&) + 420
20 clang           0x0000000001c7003b llvm::PassManagerImpl::run(llvm::Module&)
+ 539
21 clang           0x0000000001c701aa llvm::PassManager::run(llvm::Module&) +
10
22 clang           0x0000000000808137
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 6167
23 clang           0x0000000000805ab3
24 clang           0x000000000096db63 clang::ParseAST(clang::Sema&, bool, bool)
+ 515
25 clang           0x0000000000804f12 clang::CodeGenAction::ExecuteAction() +
514
26 clang           0x0000000000682461 clang::FrontendAction::Execute() + 113
27 clang           0x00000000006607bd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 909
28 clang           0x00000000006474f5
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3077
29 clang           0x000000000063efb4 cc1_main(char const**, char const**, char
const*, void*) + 628
30 clang           0x0000000000645454 main + 8500
31 libc.so.6       0x00000337e54d25dd __libc_start_main + 237
32 clang           0x000000000063ec5d
Stack dump:
0.      Program arguments:
/home/klondike/myllvm/build/Release+Asserts/bin/clang -cc1 -triple r600-- -S
-disable-free -main-file-name ldiv.cl -mrelocation-model static
-mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-cpu redwood
-target-linker-version 2.23.1 -coverage-file /home/klondike/opencl-example/-
-resource-dir /home/klondike/myllvm/build/Release+Asserts/bin/../lib/clang/3.4
-include clc/clc.h -D cl_clang_storage_class_specifiers -D cl_khr_fp64 -std=cl
-fno-dwarf-directory-asm -fdebug-compilation-dir /home/klondike/opencl-example
-ferror-limit 19 -fmessage-length 192 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o - -x cl ldiv.cl 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'ldiv.cl'.
4.      Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on
function '@ldiv'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 192013)
Target: r600--
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/ldiv-5f4dde.cl
clang: note: diagnostic msg: /tmp/ldiv-5f4dde.sh
clang: note: diagnostic msg: 

********************

And this:
fatal error: error in backend: Cannot select: 0x5a141e0: ch = store 0x59d1bf0,
0x5a147e0, 0x5a127c0, 0x5a11bc0<ST4[%out+4]> [ORD=2] [ID=26]
  0x5a147e0: i32 = add 0x5a146e0, 0x5a145e0 [ORD=1] [ID=23]
    0x5a146e0: i32 = add 0x5a143e0, 0x5a144e0 [ORD=1] [ID=20]
      0x5a143e0: i32 = mulhu 0x5a124c0, 0x5a120c0 [ORD=1] [ID=16]
        0x5a124c0: i32 = CONST_ADDRESS 0x5a123c0 [ID=10]
          0x5a123c0: i32 = Constant<8240> [ID=5]
        0x5a120c0: i32 = CONST_ADDRESS 0x5a11fc0 [ID=12]
          0x5a11fc0: i32 = Constant<8232> [ID=7]
      0x5a144e0: i32 = mul 0x5a124c0, 0x5a122c0 [ORD=1] [ID=14]
        0x5a124c0: i32 = CONST_ADDRESS 0x5a123c0 [ID=10]
          0x5a123c0: i32 = Constant<8240> [ID=5]
        0x5a122c0: i32 = CONST_ADDRESS 0x5a121c0 [ID=11]
          0x5a121c0: i32 = Constant<8236> [ID=6]
    0x5a145e0: i32 = mul 0x5a151f0, 0x5a120c0 [ORD=1] [ID=15]
      0x5a151f0: i32 = CONST_ADDRESS 0x5a14fe0 [ID=9]
        0x5a14fe0: i32 = Constant<8244> [ID=4]
      0x5a120c0: i32 = CONST_ADDRESS 0x5a11fc0 [ID=12]
        0x5a11fc0: i32 = Constant<8232> [ID=7]
  0x5a127c0: i32 = DWORDADDR 0x5a125c0 [ORD=2] [ID=25]
    0x5a125c0: i32 = srl 0x5a14ae0, 0x5a126c0 [ORD=2] [ID=22]
      0x5a14ae0: i32 = add 0x5a11ec0, 0x5a149e0 [ORD=2] [ID=19]
        0x5a11ec0: i32 = CONST_ADDRESS 0x5a11dc0 [ID=13]
          0x5a11dc0: i32 = Constant<8228> [ID=8]
        0x5a149e0: i32 = Constant<4> [ID=2]
      0x5a126c0: i32 = Constant<2> [ID=3]
  0x5a11bc0: i32 = undef [ID=1]
In function: lmul
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 3.4 (trunk 192013)
Target: r600--
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/lmul-213f81.cl
clang: note: diagnostic msg: /tmp/lmul-213f81.sh
clang: note: diagnostic msg: 

********************


The suggestion on the chat has been using TargetLowering to handle this issue.
(See
http://llvm.org/docs/doxygen/html/structllvm_1_1TargetLowering_1_1TargetLoweringOpt.html
for details).

Following come some examples of llvm ir that produces crashes despite being
generated by clang from valid opencl programs.


You are receiving this mail because:
  • You are the assignee for the bug.
--1381077620.C610ECB0.30432-- --===============0071297689== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0071297689==--