[llvm] 702a4d8 - [llvm-reduce] Reduce function calling convention
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 15:19:43 PDT 2023
Author: Arthur Eubanks
Date: 2023-07-17T15:17:37-07:00
New Revision: 702a4d89b413dfcd6619007de1056a48b60f367a
URL: https://github.com/llvm/llvm-project/commit/702a4d89b413dfcd6619007de1056a48b60f367a
DIFF: https://github.com/llvm/llvm-project/commit/702a4d89b413dfcd6619007de1056a48b60f367a.diff
LOG: [llvm-reduce] Reduce function calling convention
Added:
llvm/test/tools/llvm-reduce/reduce-calling-convention.ll
Modified:
llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-reduce/reduce-calling-convention.ll b/llvm/test/tools/llvm-reduce/reduce-calling-convention.ll
new file mode 100644
index 00000000000000..165a2cd6795475
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/reduce-calling-convention.ll
@@ -0,0 +1,18 @@
+; Test that llvm-reduce can remove function calling conventions.
+;
+; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=function-data --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-FINAL --implicit-check-not=fastcc %s < %t
+
+; CHECK-INTERESTINGNESS: declare
+; CHECK-INTERESTINGNESS-SAME: void @f
+
+; CHECK-FINAL: declare void @f()
+
+declare void @f()
+
+; CHECK-INTERESTINGNESS: declare
+; CHECK-INTERESTINGNESS-SAME: void @g
+
+; CHECK-FINAL: declare void @g()
+
+declare fastcc void @g()
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp b/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
index 21875ba00cf8b2..16ab3571588e53 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctionBodies.cpp
@@ -54,6 +54,9 @@ static void reduceFunctionData(Oracle &O, ReducerWorkItem &WorkItem) {
if (F.hasPrologueData() && !O.shouldKeep())
F.setPrologueData(nullptr);
+
+ if (F.getCallingConv() != CallingConv::C && !O.shouldKeep())
+ F.setCallingConv(CallingConv::C);
}
}
More information about the llvm-commits
mailing list