r329941 - [RISCV] Fix logic to check if frame pointer should be used
Mandeep Singh Grang via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 12 12:31:37 PDT 2018
Author: mgrang
Date: Thu Apr 12 12:31:37 2018
New Revision: 329941
URL: http://llvm.org/viewvc/llvm-project?rev=329941&view=rev
Log:
[RISCV] Fix logic to check if frame pointer should be used
Summary: The logic was broken for Linux triples as it returns true in the switch for Triple.isOSLinux().
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: kito-cheng, shiva0217, cfe-commits
Differential Revision: https://reviews.llvm.org/D45237
Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/frame-pointer.c
Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=329941&r1=329940&r2=329941&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Apr 12 12:31:37 2018
@@ -529,6 +529,9 @@ static bool useFramePointerForTargetByDe
// 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 @@ static bool useFramePointerForTargetByDe
}
}
- 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:
Modified: cfe/trunk/test/Driver/frame-pointer.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer.c?rev=329941&r1=329940&r2=329941&view=diff
==============================================================================
--- cfe/trunk/test/Driver/frame-pointer.c (original)
+++ cfe/trunk/test/Driver/frame-pointer.c Thu Apr 12 12:31:37 2018
@@ -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
More information about the cfe-commits
mailing list