[llvm] r330173 - [IR] Upgrade comment token in objc retain release marker for asm call
Gerolf Hoflehner via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 16 21:02:24 PDT 2018
Author: ghoflehner
Date: Mon Apr 16 21:02:24 2018
New Revision: 330173
URL: http://llvm.org/viewvc/llvm-project?rev=330173&view=rev
Log:
[IR] Upgrade comment token in objc retain release marker for asm call
Older compiler issued '#' instead of ';'
Added:
llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll
llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll.bc (with props)
Modified:
llvm/trunk/include/llvm/IR/AutoUpgrade.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/IR/AutoUpgrade.cpp
Modified: llvm/trunk/include/llvm/IR/AutoUpgrade.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/AutoUpgrade.h?rev=330173&r1=330172&r2=330173&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/AutoUpgrade.h (original)
+++ llvm/trunk/include/llvm/IR/AutoUpgrade.h Mon Apr 16 21:02:24 2018
@@ -37,6 +37,10 @@ namespace llvm {
/// intrinsic function with a call to the specified new function.
void UpgradeIntrinsicCall(CallInst *CI, Function *NewFn);
+ // This upgrades the comment for objc retain release markers in inline asm
+ // calls
+ void UpgradeInlineAsmString(std::string *AsmStr);
+
/// This is an auto-upgrade hook for any old intrinsic function syntaxes
/// which need to have both the function updated as well as all calls updated
/// to the new function. This should only be run in a post-processing fashion
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=330173&r1=330172&r2=330173&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Apr 16 21:02:24 2018
@@ -2522,6 +2522,7 @@ Error BitcodeReader::parseConstants() {
for (unsigned i = 0; i != ConstStrSize; ++i)
ConstrStr += (char)Record[3+AsmStrSize+i];
PointerType *PTy = cast<PointerType>(CurTy);
+ UpgradeInlineAsmString(&AsmStr);
V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()),
AsmStr, ConstrStr, HasSideEffects, IsAlignStack);
break;
@@ -2547,6 +2548,7 @@ Error BitcodeReader::parseConstants() {
for (unsigned i = 0; i != ConstStrSize; ++i)
ConstrStr += (char)Record[3+AsmStrSize+i];
PointerType *PTy = cast<PointerType>(CurTy);
+ UpgradeInlineAsmString(&AsmStr);
V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()),
AsmStr, ConstrStr, HasSideEffects, IsAlignStack,
InlineAsm::AsmDialect(AsmDialect));
Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=330173&r1=330172&r2=330173&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Mon Apr 16 21:02:24 2018
@@ -1169,6 +1169,19 @@ static bool upgradeAVX512MaskToSelect(St
return true;
}
+/// Upgrade comment in call to inline asm that represents an objc retain release
+/// marker.
+void llvm::UpgradeInlineAsmString(std::string *AsmStr) {
+
+ unsigned long Pos;
+ if (AsmStr->find("mov\tfp") == 0 &&
+ AsmStr->find("objc_retainAutoreleaseReturnValue") != std::string::npos &&
+ (Pos = AsmStr->find("# marker")) != std::string::npos) {
+ AsmStr->replace(Pos, 1, ";");
+ }
+ return;
+}
+
/// Upgrade a call to an old intrinsic. All argument and return casting must be
/// provided to seamlessly integrate with existing context.
void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
Added: llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll?rev=330173&view=auto
==============================================================================
--- llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll (added)
+++ llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll Mon Apr 16 21:02:24 2018
@@ -0,0 +1,9 @@
+; Test that comment token for objc retain release is upgraded from '#' to ';'
+;
+; RUN: llvm-dis < %s.bc | FileCheck %s
+
+define void @inlineasm() {
+ call void asm sideeffect "mov\09fp, fp\09\09# marker for objc_retainAutoreleaseReturnValue", ""()
+ ;CHECK: call void asm sideeffect "mov\09fp, fp\09\09; marker for objc_retainAutoreleaseReturnValue", ""()
+ ret void
+}
Added: llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll.bc?rev=330173&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/Bitcode/upgrade-objcretainrelease-asm.ll.bc
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
More information about the llvm-commits
mailing list