diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-02-02 15:29:20 -0800 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-03-14 12:41:46 -0700 |
commit | a4d3bc68142e67c1cbceef3ac33cdaf9b78fd84a (patch) | |
tree | 2884ffc7f7a8c4223b2c78d230e88c97c5b0399b /llvm/lib/IR/AutoUpgrade.cpp | |
parent | cb743dd8371597f75fac62b8b854e068d215373a (diff) | |
download | llvm-a4d3bc68142e67c1cbceef3ac33cdaf9b78fd84a.zip llvm-a4d3bc68142e67c1cbceef3ac33cdaf9b78fd84a.tar.gz llvm-a4d3bc68142e67c1cbceef3ac33cdaf9b78fd84a.tar.bz2 |
[AutoUpgrade] Add flag to disable autoupgrading debug info
Auto-upgrade can be expensive, especially UpgradeDebugInfo() since it runs the verifier.
With this patch, we can specify that the imported bitcode is built with the same revision of LLVM, meaning there's no need to run any auto-upgrading. For now, limit this to just debug info since projects like Rust want to support multiple versions of LLVM at the same time (at compiler build time, not at Rust source code build time) and run a subset of the autoupgrade functionality for simplicity.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D143229
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 9ca86c9..f68c492 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -32,12 +32,18 @@ #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" #include "llvm/IR/Verifier.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Regex.h" #include "llvm/TargetParser/Triple.h" #include <cstring> + using namespace llvm; +static cl::opt<bool> + DisableAutoUpgradeDebugInfo("disable-auto-upgrade-debug-info", + cl::desc("Disable autoupgrade of debug info")); + static void rename(GlobalValue *GV) { GV->setName(GV->getName() + ".old"); } // Upgrade the declarations of the SSE4.1 ptest intrinsics whose arguments have @@ -4480,6 +4486,9 @@ Constant *llvm::UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy) { /// Check the debug info version number, if it is out-dated, drop the debug /// info. Return true if module is modified. bool llvm::UpgradeDebugInfo(Module &M) { + if (DisableAutoUpgradeDebugInfo) + return false; + unsigned Version = getDebugMetadataVersionFromModule(M); if (Version == DEBUG_METADATA_VERSION) { bool BrokenDebugInfo = false; @@ -4988,7 +4997,6 @@ void llvm::UpgradeAttributes(AttrBuilder &B) { } void llvm::UpgradeOperandBundles(std::vector<OperandBundleDef> &Bundles) { - // clang.arc.attachedcall bundles are now required to have an operand. // If they don't, it's okay to drop them entirely: when there is an operand, // the "attachedcall" is meaningful and required, but without an operand, |