[clang] 2cc1194 - clang/AMDGPU: Fix default for frame-pointer attribute
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 6 10:40:17 PST 2019
Author: Matt Arsenault
Date: 2019-12-07T00:09:10+05:30
New Revision: 2cc11941a2e88236e0b4842229454ae6d85142cd
URL: https://github.com/llvm/llvm-project/commit/2cc11941a2e88236e0b4842229454ae6d85142cd
DIFF: https://github.com/llvm/llvm-project/commit/2cc11941a2e88236e0b4842229454ae6d85142cd.diff
LOG: clang/AMDGPU: Fix default for frame-pointer attribute
Enabling optimization should allow frame pointer elimination.
Added:
clang/test/Driver/frame-pointer-elim.cl
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 5ebf36f13ce9..02a365fa4969 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -538,6 +538,8 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args,
case llvm::Triple::ppc64le:
case llvm::Triple::riscv32:
case llvm::Triple::riscv64:
+ case llvm::Triple::amdgcn:
+ case llvm::Triple::r600:
return !areOptimizationsEnabled(Args);
default:
break;
diff --git a/clang/test/Driver/frame-pointer-elim.cl b/clang/test/Driver/frame-pointer-elim.cl
new file mode 100644
index 000000000000..c469d10a64be
--- /dev/null
+++ b/clang/test/Driver/frame-pointer-elim.cl
@@ -0,0 +1,8 @@
+// RUN: %clang -target amdgcn-amd-amdhsa -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKNONE %s
+// RUN: %clang -target amdgcn-amd-amdhsa -### -S -O3 -fno-omit-frame-pointer %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKALL %s
+// RUN: %clang -target amdgcn-amd-amdhsa -### -S %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKALL %s
+// RUN: %clang -target amdgcn-amd-amdhsa -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKALL %s
+// RUN: %clang -target amdgcn-amd-amdhsa -### -S -cl-opt-disable %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKALL %s
+
+// CHECKNONE: -mframe-pointer=none
+// CHECKALL: -mframe-pointer=all
More information about the cfe-commits
mailing list