[PATCH] D45237: [RISCV] Fix logic to check if frame pointer should be used
Mandeep Singh Grang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 8 21:36:01 PDT 2018
mgrang updated this revision to Diff 141584.
mgrang retitled this revision from "[RISCV] Fix logic check if frame pointer should be used" to "[RISCV] Fix logic to check if frame pointer should be used".
mgrang added a comment.
Added unit tests.
https://reviews.llvm.org/D45237
Files:
lib/Driver/ToolChains/Clang.cpp
test/Driver/frame-pointer.c
Index: test/Driver/frame-pointer.c
===================================================================
--- test/Driver/frame-pointer.c
+++ test/Driver/frame-pointer.c
@@ -45,6 +45,18 @@
// RUN: %clang -target riscv64-unknown-elf -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-64 %s
// RUN: %clang -target riscv64-unknown-elf -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O2 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK2-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-32 %s
+
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O2 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK2-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
+
// CHECK0-32: -mdisable-fp-elim
// CHECK1-32-NOT: -mdisable-fp-elim
// CHECK2-32-NOT: -mdisable-fp-elim
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -529,6 +529,9 @@
// XCore never wants frame pointers, regardless of OS.
// WebAssembly never wants frame pointers.
return false;
+ case llvm::Triple::riscv32:
+ case llvm::Triple::riscv64:
+ return !areOptimizationsEnabled(Args);
default:
break;
}
@@ -552,14 +555,6 @@
}
}
- switch (Triple.getArch()) {
- case llvm::Triple::riscv32:
- case llvm::Triple::riscv64:
- return !areOptimizationsEnabled(Args);
- default:
- break;
- }
-
if (Triple.isOSWindows()) {
switch (Triple.getArch()) {
case llvm::Triple::x86:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45237.141584.patch
Type: text/x-patch
Size: 2458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180409/40767762/attachment.bin>
More information about the cfe-commits
mailing list