quic-sanirudh commented on code in PR #15953:
URL: https://github.com/apache/tvm/pull/15953#discussion_r1368570094


##########
src/target/llvm/codegen_arm.cc:
##########
@@ -55,7 +55,13 @@ class CodeGenARM final : public CodeGenCPU {
 
 llvm::Value* CodeGenARM::CreateIntrinsic(const CallNode* op) {
   if (op->op.same_as(builtin_call_llvm_intrin_) || 
op->op.same_as(builtin_call_llvm_pure_intrin_)) {
-    llvm::Intrinsic::ID id = 
static_cast<llvm::Intrinsic::ID>(Downcast<IntImm>(op->args[0])->value);
+    llvm::Intrinsic::ID id = 0;
+    if (op->args[0]->IsInstance<StringImmNode>()) {
+      id = 
llvm::Function::lookupIntrinsicID(Downcast<StringImm>(op->args[0])->value.c_str());
+    } else if (op->args[0]->IsInstance<IntImmNode>()) {
+      id = 
static_cast<llvm::Intrinsic::ID>(Downcast<IntImm>(op->args[0])->value);
+    }
+    assert(id != 0);

Review Comment:
   Thanks for the clarification. I agree that this seems logical, however I 
think it might have been better to keep the check as now the code has an `if - 
else if` without an else or assertion.
   
   Without the assertion, we're assuming that a call to the python API is the 
only way the LLVM intrinsic would be inserted, but what if a pass inserts the 
intrinsic call from cpp directly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to