diff --git a/src/target/llvm/codegen_cpu.cc b/src/target/llvm/codegen_cpu.cc index ab96d6e69d14..2e0463d899f0 100644 --- a/src/target/llvm/codegen_cpu.cc +++ b/src/target/llvm/codegen_cpu.cc @@ -440,9 +440,11 @@ void CodeGenCPU::CreateComputeScope(const AttrStmtNode* op) { // $xxx_compute_ functions are not global. They should be marked as static (via InternalLinkage) // to call them correctly on MIPS platform (CALL16 issue) // Linkage ld Error: CALL16 reloc at 0x290 not against global symbol - llvm::Function* fcompute = llvm::Function::Create( - ftype, llvm::Function::InternalLinkage, - op->value.as()->value.operator llvm::StringRef(), module_.get()); + const StringImmNode* value = op->value.as(); + ICHECK(value != nullptr); + llvm::Function* fcompute = + llvm::Function::Create(ftype, llvm::Function::InternalLinkage, + value->value.operator llvm::StringRef(), module_.get()); BasicBlock* compute_call_end = CheckCallSuccess(builder_->CreateCall(fcompute, arg_values)); // setup compute function. std::unordered_map new_vmap; @@ -941,7 +943,9 @@ void CodeGenCPU::VisitStmt_(const AssertStmtNode* op) { void CodeGenCPU::VisitStmt_(const AttrStmtNode* op) { if (op->attr_key == tir::attr::coproc_uop_scope) { - this->CreateStaticInit(op->value.as()->value, op->body); + const StringImmNode* value = op->value.as(); + ICHECK(value != nullptr); + this->CreateStaticInit(value->value, op->body); } else if (op->attr_key == tir::attr::compute_scope) { this->CreateComputeScope(op); } else if (tir::attr::IsPragmaKey(op->attr_key)) {