Skip to content

Commit 551006c

Browse files
committed
[win][arm64ec] Fix duplicate errors with the dontcall attribute
1 parent f9cb95c commit 551006c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,11 @@ bool FastISel::lowerCall(const CallInst *CI) {
11481148
CLI.setCallee(RetTy, FuncTy, CI->getCalledOperand(), std::move(Args), *CI)
11491149
.setTailCall(IsTailCall);
11501150

1151-
diagnoseDontCall(*CI);
1152-
1153-
return lowerCallTo(CLI);
1151+
if (lowerCallTo(CLI)) {
1152+
diagnoseDontCall(*CI);
1153+
return true;
1154+
} else
1155+
return false;
11541156
}
11551157

11561158
bool FastISel::selectCall(const User *I) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: not llc -mtriple arm64ec-windows-msvc -o - %s 2>&1 | FileCheck %s
2+
3+
define void @baz() #0 {
4+
call void @foo()
5+
ret void
6+
}
7+
8+
define void @foo() #1 {
9+
ret void
10+
}
11+
12+
attributes #0 = { noinline optnone }
13+
attributes #1 = { "dontcall-error"="oh no foo" }
14+
15+
; Regression test for `dontcall-error` for Arm64EC. Since this attribute is
16+
; checked both by FastISel and SelectionDAGBuilder, and FastISel was bailing for
17+
; Arm64EC AFTER doing the check, we ended up with duplicate copies of this
18+
; error.
19+
20+
; CHECK: error: call to #foo marked "dontcall-error": oh no foo
21+
; CHECK-NOT: error:

0 commit comments

Comments
 (0)