diff options
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 14 | ||||
-rw-r--r-- | llvm/test/Bitcode/upgrade-clang-arc-use.ll | 14 | ||||
-rw-r--r-- | llvm/test/Bitcode/upgrade-clang-arc-use.ll.bc | bin | 0 -> 1296 bytes |
3 files changed, 28 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); diff --git a/llvm/test/Bitcode/upgrade-clang-arc-use.ll b/llvm/test/Bitcode/upgrade-clang-arc-use.ll new file mode 100644 index 00000000000..db5481f06f6 --- /dev/null +++ b/llvm/test/Bitcode/upgrade-clang-arc-use.ll @@ -0,0 +1,14 @@ +; Test upgrade of clang.arc.use by removing it. +; Bitcode input generated from llvm 6.0 + +; RUN: llvm-dis %s.bc -o - | FileCheck %s + +%0 = type opaque +define void @foo() { + %1 = tail call %0* @foo0() +; CHECK-NOT: clang.arc.use + call void (...) @clang.arc.use(%0* %1) + ret void +} +declare %0* @foo0() +declare void @clang.arc.use(...) diff --git a/llvm/test/Bitcode/upgrade-clang-arc-use.ll.bc b/llvm/test/Bitcode/upgrade-clang-arc-use.ll.bc Binary files differnew file mode 100644 index 00000000000..ab9db6a0929 --- /dev/null +++ b/llvm/test/Bitcode/upgrade-clang-arc-use.ll.bc |