[PATCH] D99037: [Matrix] Implement C-style explicit type conversions for matrix types

Saurabh Jha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 7 01:11:21 PDT 2021


SaurabhJha added a comment.

Okay interesting I should have posted before. Seems like when I move `MatrixCast` to the bottom of OperationKinds.def, and do nothing else, the matrix-cast CodeGen fails with this error. It is somehow not able to assign correct cast type.

  + /tmp/build/bin/clang -cc1 -internal-isystem /tmp/build/lib/clang/13.0.0/include -nostdsysteminc -fenable-matrix -triple x86_64-apple-darwin /tmp/clang/test/CodeGen/matrix-cast.c -emit-llvm -disable-llvm-passes -o -
  + /tmp/build/bin/FileCheck /tmp/clang/test/CodeGen/matrix-cast.c
  dependent cast kind in IR gen!
  UNREACHABLE executed at /tmp/clang/lib/CodeGen/CGExprScalar.cpp:1985!
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.	Program arguments: /tmp/build/bin/clang -cc1 -internal-isystem /tmp/build/lib/clang/13.0.0/include -nostdsysteminc -fenable-matrix -triple x86_64-apple-darwin /tmp/clang/test/CodeGen/matrix-cast.c -emit-llvm -disable-llvm-passes -o -
  1.	/tmp/clang/test/CodeGen/matrix-cast.c:22:1: current parser token 'void'
  2.	/tmp/clang/test/CodeGen/matrix-cast.c:12:6: LLVM IR generation of declaration 'cast_char_matrix_to_int'
  3.	/tmp/clang/test/CodeGen/matrix-cast.c:12:6: Generating code for declaration 'cast_char_matrix_to_int'
   #0 0x000000000974250a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /tmp/llvm/lib/Support/Unix/Signals.inc:565:11
   #1 0x00000000097426db PrintStackTraceSignalHandler(void*) /tmp/llvm/lib/Support/Unix/Signals.inc:632:1
   #2 0x0000000009740cab llvm::sys::RunSignalHandlers() /tmp/llvm/lib/Support/Signals.cpp:70:5
   #3 0x0000000009742e51 SignalHandler(int) /tmp/llvm/lib/Support/Unix/Signals.inc:407:1
   #4 0x00007f503b2923c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
   #5 0x00007f503ad4318b raise /build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
   #6 0x00007f503ad22859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
   #7 0x0000000009661fe4 /tmp/llvm/lib/Support/ErrorHandling.cpp:213:3
   #8 0x0000000009fd93fb (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) /tmp/clang/lib/CodeGen/CGExprScalar.cpp:1987:5
   #9 0x0000000009fd934e (anonymous namespace)::ScalarExprEmitter::VisitExplicitCastExpr(clang::ExplicitCastExpr*) /tmp/clang/lib/CodeGen/CGExprScalar.cpp:568:5
  #10 0x0000000009fd17b3 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::VisitCStyleCastExpr(clang::CStyleCastExpr*) /tmp/build/tools/clang/include/clang/AST/StmtNodes.inc:891:1
  #11 0x0000000009fcb9ff clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) /tmp/build/tools/clang/include/clang/AST/StmtNodes.inc:891:1
  #12 0x0000000009fc0d0b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) /tmp/clang/lib/CodeGen/CGExprScalar.cpp:415:3
  #13 0x0000000009fce242 (anonymous namespace)::ScalarExprEmitter::VisitBinAssign(clang::BinaryOperator const*) /tmp/clang/lib/CodeGen/CGExprScalar.cpp:4218:9
  #14 0x0000000009fca7fd clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) /tmp/clang/include/clang/AST/StmtVisitor.h:72:26
  #15 0x0000000009fc0d0b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) /tmp/clang/lib/CodeGen/CGExprScalar.cpp:415:3
  #16 0x0000000009fc0c66 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) /tmp/clang/lib/CodeGen/CGExprScalar.cpp:4807:3
  #17 0x0000000009e7edec clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) /tmp/clang/lib/CodeGen/CGExpr.cpp:218:12
  #18 0x0000000009e7ed1d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) /tmp/clang/lib/CodeGen/CGExpr.cpp:203:19
  #19 0x0000000009fed236 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) /tmp/clang/lib/CodeGen/CGStmt.cpp:118:5
  #20 0x0000000009ff664b clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) /tmp/clang/lib/CodeGen/CGStmt.cpp:453:3
  #21 0x0000000009e573c1 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) /tmp/clang/lib/CodeGen/CodeGenFunction.cpp:1194:5
  #22 0x0000000009e57e91 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) /tmp/clang/lib/CodeGen/CodeGenFunction.cpp:1358:3
  #23 0x0000000009d0b7de clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) /tmp/clang/lib/CodeGen/CodeGenModule.cpp:4780:3
  #24 0x0000000009d0215c clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) /tmp/clang/lib/CodeGen/CodeGenModule.cpp:3166:12
  #25 0x0000000009d071e4 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) /tmp/clang/lib/CodeGen/CodeGenModule.cpp:2919:5
  #26 0x0000000009d0f040 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) /tmp/clang/lib/CodeGen/CodeGenModule.cpp:5621:38
  #27 0x000000000a86b0f2 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) /tmp/clang/lib/CodeGen/ModuleBuilder.cpp:169:73
  #28 0x000000000a8654e4 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) /tmp/clang/lib/CodeGen/CodeGenAction.cpp:215:12
  #29 0x000000000cfe2475 clang::ParseAST(clang::Sema&, bool, bool) /tmp/clang/lib/Parse/ParseAST.cpp:162:20
  #30 0x000000000a688572 clang::ASTFrontendAction::ExecuteAction() /tmp/clang/lib/Frontend/FrontendAction.cpp:1058:1
  #31 0x000000000a861539 clang::CodeGenAction::ExecuteAction() /tmp/clang/lib/CodeGen/CodeGenAction.cpp:1039:5
  #32 0x000000000a687f38 clang::FrontendAction::Execute() /tmp/clang/lib/Frontend/FrontendAction.cpp:953:7
  #33 0x000000000a55a2f5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /tmp/clang/lib/Frontend/CompilerInstance.cpp:958:23
  #34 0x000000000a84ddc6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /tmp/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:8
  #35 0x000000000610c23d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /tmp/clang/tools/driver/cc1_main.cpp:246:13
  #36 0x00000000060fec59 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /tmp/clang/tools/driver/driver.cpp:338:5
  #37 0x00000000060fddee main /tmp/clang/tools/driver/driver.cpp:415:5
  #38 0x00007f503ad240b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
  #39 0x00000000060fd59e _start (/tmp/build/bin/clang+0x60fd59e)
  FileCheck error: '<stdin>' is empty.
  FileCheck command line:  /tmp/build/bin/FileCheck /tmp/clang/test/CodeGen/matrix-cast.c
  
  --
  
  ********************
  ********************
  Failed Tests (1):
    Clang :: CodeGen/matrix-cast.c
  
  
  Testing Time: 21.71s
    Failed: 1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99037/new/

https://reviews.llvm.org/D99037



More information about the cfe-commits mailing list