aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorThurston Dang <thurston@google.com>2024-09-17 21:06:36 +0000
committerThurston Dang <thurston@google.com>2024-09-17 21:06:36 +0000
commit4a63f4d301c0e044073e1b1f8f110015ec1778a1 (patch)
treec70d6c3a36c1459ad609ebb10f05de08c9e3a303 /clang/lib/CodeGen/CodeGenModule.cpp
parente08c2178ef7806819b9a6334ca5d80f2baad56bc (diff)
downloadllvm-4a63f4d301c0e044073e1b1f8f110015ec1778a1.zip
llvm-4a63f4d301c0e044073e1b1f8f110015ec1778a1.tar.gz
llvm-4a63f4d301c0e044073e1b1f8f110015ec1778a1.tar.bz2
Revert "[HLSL] set alwaysinline on HLSL functions (#106588)"
This reverts commit a729e706de3fc6ebee49ede3c50afb47f2e29191. Reason:bBuildbot failure (https://lab.llvm.org/buildbot/#/builders/25/builds/2541): 'Clang :: CodeGenHLSL/builtins/StructuredBuffer-subscript.hlsl' failed
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 17b82b2..ba2d658 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2473,14 +2473,11 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
B.addAttribute(llvm::Attribute::StackProtectReq);
if (!D) {
- // Non-entry HLSL functions must always be inlined.
- if (getLangOpts().HLSL && !F->hasFnAttribute(llvm::Attribute::NoInline))
- B.addAttribute(llvm::Attribute::AlwaysInline);
// If we don't have a declaration to control inlining, the function isn't
// explicitly marked as alwaysinline for semantic reasons, and inlining is
// disabled, mark the function as noinline.
- else if (!F->hasFnAttribute(llvm::Attribute::AlwaysInline) &&
- CodeGenOpts.getInlining() == CodeGenOptions::OnlyAlwaysInlining)
+ if (!F->hasFnAttribute(llvm::Attribute::AlwaysInline) &&
+ CodeGenOpts.getInlining() == CodeGenOptions::OnlyAlwaysInlining)
B.addAttribute(llvm::Attribute::NoInline);
F->addFnAttrs(B);
@@ -2507,13 +2504,9 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
ShouldAddOptNone &= !D->hasAttr<MinSizeAttr>();
ShouldAddOptNone &= !D->hasAttr<AlwaysInlineAttr>();
- // Non-entry HLSL functions must always be inlined.
- if (getLangOpts().HLSL && !F->hasFnAttribute(llvm::Attribute::NoInline) &&
- !D->hasAttr<NoInlineAttr>()) {
- B.addAttribute(llvm::Attribute::AlwaysInline);
- } else if ((ShouldAddOptNone || D->hasAttr<OptimizeNoneAttr>()) &&
- !F->hasFnAttribute(llvm::Attribute::AlwaysInline)) {
- // Add optnone, but do so only if the function isn't always_inline.
+ // Add optnone, but do so only if the function isn't always_inline.
+ if ((ShouldAddOptNone || D->hasAttr<OptimizeNoneAttr>()) &&
+ !F->hasFnAttribute(llvm::Attribute::AlwaysInline)) {
B.addAttribute(llvm::Attribute::OptimizeNone);
// OptimizeNone implies noinline; we should not be inlining such functions.
@@ -2533,8 +2526,7 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
B.addAttribute(llvm::Attribute::NoInline);
} else if (D->hasAttr<NoDuplicateAttr>()) {
B.addAttribute(llvm::Attribute::NoDuplicate);
- } else if (D->hasAttr<NoInlineAttr>() &&
- !F->hasFnAttribute(llvm::Attribute::AlwaysInline)) {
+ } else if (D->hasAttr<NoInlineAttr>() && !F->hasFnAttribute(llvm::Attribute::AlwaysInline)) {
// Add noinline if the function isn't always_inline.
B.addAttribute(llvm::Attribute::NoInline);
} else if (D->hasAttr<AlwaysInlineAttr>() &&