[PATCH] D59112: [Bitcode] Fix bitcode compatibility issue with clang.arc.use intrinsic
Steven Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 21:27:21 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355663: [Bitcode] Fix bitcode compatibility issue with clang.arc.use intrinsic (authored by steven_wu, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59112?vs=189787&id=189812#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59112/new/
https://reviews.llvm.org/D59112
Files:
llvm/trunk/lib/IR/AutoUpgrade.cpp
llvm/trunk/test/Bitcode/upgrade-clang-arc-use.ll
llvm/trunk/test/Bitcode/upgrade-clang-arc-use.ll.bc
Index: llvm/trunk/test/Bitcode/upgrade-clang-arc-use.ll
===================================================================
--- llvm/trunk/test/Bitcode/upgrade-clang-arc-use.ll
+++ llvm/trunk/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(...)
Index: llvm/trunk/lib/IR/AutoUpgrade.cpp
===================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp
@@ -493,6 +493,12 @@
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 @@
// 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59112.189812.patch
Type: text/x-patch
Size: 1722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190308/b2809e2a/attachment.bin>
More information about the llvm-commits
mailing list