raulcd commented on code in PR #45697:
URL: https://github.com/apache/arrow/pull/45697#discussion_r1984872002


##########
cpp/src/gandiva/decimal_ir.cc:
##########
@@ -79,13 +79,22 @@ void DecimalIR::AddGlobals(Engine* engine) {
   globalScaleMultipliers->setAlignment(LLVM_ALIGN(16));
 }
 
+#if LLVM_VERSION_MAJOR < 20
+namespace {
+inline llvm::Function* getOrInsertDeclaration(llvm::Module* M, 
llvm::Intrinsic::ID id,
+                                              llvm::ArrayRef<llvm::Type*> Tys) 
{
+  return llvm::Intrinsic::getDeclaration(M, id, Tys);
+}
+}  // namespace
+#endif
+
 // Lookup intrinsic functions
 void DecimalIR::InitializeIntrinsics() {
-  sadd_with_overflow_fn_ = llvm::Intrinsic::getDeclaration(
+  sadd_with_overflow_fn_ = getOrInsertDeclaration(

Review Comment:
   I am curious on why if LLVM > 20 we don't have to specifically add `using 
llvm::Intrinsic::getOrInsertDeclaration`. Basically, how does it know the 
symbol is on that namespace if this is in declared in the `gandiva` namespace.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to