diff options
author | Steven Wu <stevenwu@apple.com> | 2019-03-08 05:27:53 +0000 |
---|---|---|
committer | Steven Wu <stevenwu@apple.com> | 2019-03-08 05:27:53 +0000 |
commit | ed9822928626a45a749b3297a46c8fb7375c814e (patch) | |
tree | bfa486ee36040d6ed56ce30c98d7c669bd6b1c5d /llvm/lib/IR/AutoUpgrade.cpp | |
parent | 1488ee4bd5418a5536856676c350c9ee64488334 (diff) | |
download | bcm5719-llvm-ed9822928626a45a749b3297a46c8fb7375c814e.tar.gz bcm5719-llvm-ed9822928626a45a749b3297a46c8fb7375c814e.zip |
[Bitcode] Fix bitcode compatibility issue with clang.arc.use intrinsic
Summary:
In r349534, objc arc implementation is switched to use intrinsics and at
the same time, clang.arc.use is renamed to llvm.objc.clang.arc.use to
make the naming more consistent. The side-effect of that is llvm no
longer recognize it as intrinsics and codegen external references to
it instead.
Rather than upgrade the old intrinsics name to the new one and wait for
the arc-contract pass to remove it, simply remove it in the bitcode
upgrader.
rdar://problem/48607063
Reviewers: pete, ahatanak, erik.pilkington, dexonsmith
Reviewed By: pete, dexonsmith
Subscribers: jkorous, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59112
llvm-svn: 355663
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 8ebe55a1ea3..a7d7c2dbc64 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -493,6 +493,12 @@ static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name, static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { assert(F && "Illegal to upgrade a non-existent Function."); + // Upgrade intrinsics "clang.arc.use" which doesn't start with "llvm.". + if (F->getName() == "clang.arc.use") { + NewFn = nullptr; + return true; + } + // Quickly eliminate it, if it's not a candidate. StringRef Name = F->getName(); if (Name.size() <= 8 || !Name.startswith("llvm.")) @@ -1571,6 +1577,14 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { // Get the Function's name. StringRef Name = F->getName(); + // clang.arc.use is an old name for llvm.arc.clang.arc.use. It is dropped + // from upgrader because the optimizer now only recognizes intrinsics for + // ARC runtime calls. + if (Name == "clang.arc.use") { + CI->eraseFromParent(); + return; + } + assert(Name.startswith("llvm.") && "Intrinsic doesn't start with 'llvm.'"); Name = Name.substr(5); |