[llvm] r352945 - [AutoUpgrade] Fix AutoUpgrade for x86.seh.recoverfp

Mandeep Singh Grang via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 17:32:49 PST 2019


Author: mgrang
Date: Fri Feb  1 17:32:48 2019
New Revision: 352945

URL: http://llvm.org/viewvc/llvm-project?rev=352945&view=rev
Log:
[AutoUpgrade] Fix AutoUpgrade for x86.seh.recoverfp

Summary: This fixes the bug in https://reviews.llvm.org/D56747#inline-502711.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: javed.absar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57614

Added:
    llvm/trunk/test/CodeGen/AArch64/eh_recoverfp.ll
Modified:
    llvm/trunk/lib/IR/AutoUpgrade.cpp

Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=352945&r1=352944&r2=352945&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Fri Feb  1 17:32:48 2019
@@ -482,6 +482,11 @@ static bool UpgradeX86IntrinsicFunction(
     }
   }
 
+  if (Name == "seh.recoverfp") {
+    NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::eh_recoverfp);
+    return true;
+  }
+
   return false;
 }
 
@@ -557,10 +562,6 @@ static bool UpgradeIntrinsicFunction1(Fu
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::thread_pointer);
       return true;
     }
-    if (Name == "x86.seh.recoverfp") {
-      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::eh_recoverfp);
-      return true;
-    }
     break;
   }
 

Added: llvm/trunk/test/CodeGen/AArch64/eh_recoverfp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/eh_recoverfp.ll?rev=352945&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/eh_recoverfp.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/eh_recoverfp.ll Fri Feb  1 17:32:48 2019
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple arm64-windows %s -o - 2>&1 | FileCheck %s
+
+define i8* @foo(i8* %a) {
+; CHECK-LABEL: foo
+; CHECK-NOT: llvm.x86.seh.recoverfp
+  %1 = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 ()* @f to i8*), i8* %a)
+  ret i8* %1
+}
+
+declare i8* @llvm.x86.seh.recoverfp(i8*, i8*)
+declare i32 @f()




More information about the llvm-commits mailing list