Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions llvm/lib/Target/ARM/ARMAsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,20 +610,23 @@ void ARMAsmPrinter::emitEndOfAsmFile(Module &M) {
// to appear in the .ARM.attributes section in ELF.
// Instead of subclassing the MCELFStreamer, we do the work here.

// Returns true if all functions have the same function attribute value.
// It also returns true when the module has no functions.
// Returns true if all function definitions have the same function attribute
// value. It also returns true when the module has no functions.
static bool checkFunctionsAttributeConsistency(const Module &M, StringRef Attr,
StringRef Value) {
return !any_of(M, [&](const Function &F) {
return F.getFnAttribute(Attr).getValueAsString() != Value;
});
return !any_of(M, [&](const Function &F) {
if (F.isDeclaration())
return false;
return F.getFnAttribute(Attr).getValueAsString() != Value;
});
}
// Returns true if all functions have the same denormal mode.
// Returns true if all functions definitions have the same denormal mode.
// It also returns true when the module has no functions.
static bool checkDenormalAttributeConsistency(const Module &M,
StringRef Attr,
static bool checkDenormalAttributeConsistency(const Module &M, StringRef Attr,
DenormalMode Value) {
return !any_of(M, [&](const Function &F) {
if (F.isDeclaration())
return false;
StringRef AttrVal = F.getFnAttribute(Attr).getValueAsString();
return parseDenormalFPAttribute(AttrVal) != Value;
});
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/CodeGen/ARM/build-attributes-fn-attr3.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

define i32 @foo() local_unnamed_addr #0 {
entry:
%a = call float @llvm.fma.f32(float 0.0, float 0.0, float 0.0)
ret i32 42
}

declare float @llvm.fma.f32(float, float, float)

attributes #0 = { minsize norecurse nounwind optsize readnone "no-trapping-math"="true" "denormal-fp-math"="ieee"}
3 changes: 3 additions & 0 deletions llvm/test/CodeGen/ARM/build-attributes-fn-attr4.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

define i32 @foo1() local_unnamed_addr #0 {
entry:
%a = call float @llvm.fma.f32(float 0.0, float 0.0, float 0.0)
ret i32 42
}

declare float @llvm.fma.f32(float, float, float)

attributes #0 = { minsize norecurse nounwind optsize readnone "denormal-fp-math"="positive-zero,positive-zero" }
3 changes: 3 additions & 0 deletions llvm/test/CodeGen/ARM/build-attributes-fn-attr5.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

define i32 @foo1() local_unnamed_addr #0 {
entry:
%a = call float @llvm.fma.f32(float 0.0, float 0.0, float 0.0)
ret i32 42
}

declare float @llvm.fma.f32(float, float, float)

attributes #0 = { minsize norecurse nounwind optsize readnone "denormal-fp-math"="preserve-sign,preserve-sign"}
3 changes: 3 additions & 0 deletions llvm/test/CodeGen/ARM/build-attributes-fn-attr6.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

define i32 @foo1() local_unnamed_addr #0 {
entry:
%a = call float @llvm.fma.f32(float 0.0, float 0.0, float 0.0)
ret i32 42
}

Expand All @@ -19,5 +20,7 @@ entry:
ret i32 42
}

declare float @llvm.fma.f32(float, float, float)

attributes #0 = { minsize norecurse nounwind optsize readnone "denormal-fp-math"="preserve-sign,preserve-sign"}
attributes #1 = { minsize norecurse nounwind optsize readnone "denormal-fp-math"="positive-zero,positive-zero"}
Loading