This is an automated email from the ASF dual-hosted git repository.

kparzysz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 125bbb271b [LLVM] Add support for DeclBufferNode (#14103)
125bbb271b is described below

commit 125bbb271bc91e4a807af57a9c2fefa64b2fb547
Author: Anirudh Sundar Subramaniam <[email protected]>
AuthorDate: Fri Feb 24 02:19:12 2023 +0530

    [LLVM] Add support for DeclBufferNode (#14103)
    
    `DeclBufferNode` was added recently in #12300, but support to traverse it 
in codegen_llvm was not added. Since this just stmt just declares a new buffer 
for a body of TIR, we just need to traverse the body to properly generate code 
for LLVM.
---
 src/target/llvm/codegen_llvm.cc | 5 +++++
 src/target/llvm/codegen_llvm.h  | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/target/llvm/codegen_llvm.cc b/src/target/llvm/codegen_llvm.cc
index dcca337320..87b85290b0 100644
--- a/src/target/llvm/codegen_llvm.cc
+++ b/src/target/llvm/codegen_llvm.cc
@@ -1962,6 +1962,11 @@ void CodeGenLLVM::VisitStmt_(const SeqStmtNode* op) {
   }
 }
 
+void CodeGenLLVM::VisitStmt_(const DeclBufferNode* op) {
+  EmitDebugLocation(op);
+  VisitStmt(op->body);
+}
+
 void CodeGenLLVM::VisitStmt_(const EvaluateNode* op) {
   EmitDebugLocation(op);
   MakeValue(op->value);
diff --git a/src/target/llvm/codegen_llvm.h b/src/target/llvm/codegen_llvm.h
index 632cfaafc5..62b0b0cc4b 100644
--- a/src/target/llvm/codegen_llvm.h
+++ b/src/target/llvm/codegen_llvm.h
@@ -223,6 +223,7 @@ class CodeGenLLVM : public ExprFunctor<llvm::Value*(const 
PrimExpr&)>,
   void VisitStmt_(const LetStmtNode* op) override;
   void VisitStmt_(const SeqStmtNode* op) override;
   void VisitStmt_(const EvaluateNode* op) override;
+  void VisitStmt_(const DeclBufferNode* op) override;
 
   // Get constant string
   llvm::Constant* GetConstString(const std::string& str);

Reply via email to