aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCELFStreamer.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-03-07 17:41:00 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-03-07 17:41:00 +0000
commit867bfc53ee5424b467302f319a1a9215ca7f1752 (patch)
tree35427a9447e8995de9812bca3171edfad8f28b79 /llvm/lib/MC/MCELFStreamer.cpp
parentc6bf34418acc32f220ed352246e0768fe250550f (diff)
downloadllvm-867bfc53ee5424b467302f319a1a9215ca7f1752.zip
llvm-867bfc53ee5424b467302f319a1a9215ca7f1752.tar.gz
llvm-867bfc53ee5424b467302f319a1a9215ca7f1752.tar.bz2
Make constant arrays that are passed to functions as const.
In theory this allows the compiler to skip materializing the array on the stack. In practice clang often fails to do that, but that's a different story. NFC. llvm-svn: 231571
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index 199825e..47d1486 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -122,12 +122,11 @@ void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
// If neither T1 < T2 nor T2 < T1 according to this ordering, use T2 (the user
// provided type).
static unsigned CombineSymbolTypes(unsigned T1, unsigned T2) {
- unsigned TypeOrdering[] = {ELF::STT_NOTYPE, ELF::STT_OBJECT, ELF::STT_FUNC,
- ELF::STT_GNU_IFUNC, ELF::STT_TLS};
- for (unsigned i = 0; i != array_lengthof(TypeOrdering); ++i) {
- if (T1 == TypeOrdering[i])
+ for (unsigned Type : {ELF::STT_NOTYPE, ELF::STT_OBJECT, ELF::STT_FUNC,
+ ELF::STT_GNU_IFUNC, ELF::STT_TLS}) {
+ if (T1 == Type)
return T2;
- if (T2 == TypeOrdering[i])
+ if (T2 == Type)
return T1;
}