Skip to content

Commit 2be4eab

Browse files
author
Mandeep Singh Grang
committed
[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 llvm-svn: 352945
1 parent d911ed1 commit 2be4eab

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,11 @@ static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name,
482482
}
483483
}
484484

485+
if (Name == "seh.recoverfp") {
486+
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::eh_recoverfp);
487+
return true;
488+
}
489+
485490
return false;
486491
}
487492

@@ -557,10 +562,6 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
557562
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::thread_pointer);
558563
return true;
559564
}
560-
if (Name == "x86.seh.recoverfp") {
561-
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::eh_recoverfp);
562-
return true;
563-
}
564565
break;
565566
}
566567

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; RUN: llc -mtriple arm64-windows %s -o - 2>&1 | FileCheck %s
2+
3+
define i8* @foo(i8* %a) {
4+
; CHECK-LABEL: foo
5+
; CHECK-NOT: llvm.x86.seh.recoverfp
6+
%1 = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 ()* @f to i8*), i8* %a)
7+
ret i8* %1
8+
}
9+
10+
declare i8* @llvm.x86.seh.recoverfp(i8*, i8*)
11+
declare i32 @f()

0 commit comments

Comments
 (0)