Skip to content

Commit

Permalink
Fixes for top-of-tree LLVM (halide#7329)
Browse files Browse the repository at this point in the history
* Fixes for top-of-tree LLVM

* fix

* times ten

* Update LLVM_Output.cpp
  • Loading branch information
steven-johnson authored and ardier committed Mar 3, 2024
1 parent 2430538 commit 72ac3bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/LLVM_Headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#include <llvm/ADT/SmallVector.h>
#include <llvm/ADT/StringMap.h>
#include <llvm/ADT/StringRef.h>
#if LLVM_VERSION < 170
#include <llvm/ADT/Triple.h>
#endif
#include <llvm/ADT/Twine.h>
#include <llvm/Analysis/AliasAnalysis.h>
#include <llvm/Analysis/TargetLibraryInfo.h>
Expand Down Expand Up @@ -81,6 +83,9 @@
#include <llvm/Support/raw_ostream.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetOptions.h>
#if LLVM_VERSION >= 170
#include <llvm/TargetParser/Triple.h>
#endif
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/IPO/AlwaysInliner.h>
#include <llvm/Transforms/IPO/Inliner.h>
Expand Down
10 changes: 10 additions & 0 deletions src/LLVM_Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,18 @@ void emit_file(const llvm::Module &module_in, Internal::LLVMOStream &out,
// Make sure things marked as always-inline get inlined
pass_manager.add(llvm::createAlwaysInlinerLegacyPass());

#if LLVM_VERSION < 170
// Remove any stale debug info
//
// Note: this pass was added in https://github.com/halide/Halide/pull/2060;
// based on the comments, it looks like it was an attempt to fix an error,
// but didn't actually fix it, and (apparently) just got left in?
//
// There is a 'new' equivalent that we could add in the optimization pass
// in Codegen_LLVM.cpp, but since this seems to be have added in error,
// we're just going to elide it for LLVM >= 17.0
pass_manager.add(llvm::createStripDeadDebugInfoPass());
#endif

// Enable symbol rewriting. This allows code outside libHalide to
// use symbol rewriting when compiling Halide code (for example, by
Expand Down

0 comments on commit 72ac3bc

Please sign in to comment.