You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/05/27 21:34:18 UTC

[GitHub] [arrow] wesm commented on a change in pull request #7295: ARROW-8968: [C++][Gandiva] set data layout for pre-compiled IR to llvm::module

wesm commented on a change in pull request #7295:
URL: https://github.com/apache/arrow/pull/7295#discussion_r431454890



##########
File path: cpp/src/gandiva/engine.cc
##########
@@ -150,6 +152,27 @@ Status Engine::Make(const std::shared_ptr<Configuration>& conf,
   return Status::OK();
 }
 
+static void setDataLayout(llvm::Module* module) {

Review comment:
       nit: SetDataLayout

##########
File path: cpp/src/gandiva/engine.cc
##########
@@ -150,6 +152,27 @@ Status Engine::Make(const std::shared_ptr<Configuration>& conf,
   return Status::OK();
 }
 
+static void setDataLayout(llvm::Module* module) {
+  auto targetTriple = llvm::sys::getDefaultTargetTriple();

Review comment:
       nit: use lower_with_underscores for local variables

##########
File path: cpp/src/gandiva/engine.cc
##########
@@ -150,6 +152,27 @@ Status Engine::Make(const std::shared_ptr<Configuration>& conf,
   return Status::OK();
 }
 
+static void setDataLayout(llvm::Module* module) {
+  auto targetTriple = llvm::sys::getDefaultTargetTriple();
+  std::string errorMessage;
+  auto target = llvm::TargetRegistry::lookupTarget(targetTriple, errorMessage);
+  if (!target) {
+    return;
+  }
+
+  std::string cpu(llvm::sys::getHostCPUName());
+  llvm::SubtargetFeatures features;
+  llvm::StringMap<bool> hostFeatures;
+
+  if (llvm::sys::getHostCPUFeatures(hostFeatures))
+    for (auto& f : hostFeatures) features.AddFeature(f.first(), f.second);

Review comment:
       nit: please use braces




----------------------------------------------------------------
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.

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