From aa17ab0669c29a8857e663de2c34799fddbf08e5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 21 Jul 2009 23:49:55 +0000 Subject: [PATCH] simplify code now that it is inlined. llvm-svn: 76689 --- llvm/lib/Target/ELFTargetAsmInfo.cpp | 6 ++---- llvm/lib/Target/TargetAsmInfo.cpp | 15 +++------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Target/ELFTargetAsmInfo.cpp b/llvm/lib/Target/ELFTargetAsmInfo.cpp index 8ace00abd939..5deabee0ba21 100644 --- a/llvm/lib/Target/ELFTargetAsmInfo.cpp +++ b/llvm/lib/Target/ELFTargetAsmInfo.cpp @@ -61,10 +61,8 @@ ELFTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { // By default - all relocations in PIC mode would force symbol to be // placed in r/w section. - unsigned Reloc = (TM.getRelocationModel() != Reloc::Static ? - Reloc::LocalOrGlobal : Reloc::None); - - if (Reloc != Reloc::None && C->ContainsRelocations(Reloc)) + if (TM.getRelocationModel() != Reloc::Static && + C->ContainsRelocations(Reloc::LocalOrGlobal)) return (C->ContainsRelocations(Reloc::Global) ? (isConstant ? SectionKind::DataRelRO : SectionKind::DataRel) : diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp index e60855d3dd42..580c3fe4db03 100644 --- a/llvm/lib/Target/TargetAsmInfo.cpp +++ b/llvm/lib/Target/TargetAsmInfo.cpp @@ -209,20 +209,11 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { // note, there is no thread-local r/o section. Constant *C = GVar->getInitializer(); if (C->ContainsRelocations(Reloc::LocalOrGlobal)) { - // Decide, whether it is still possible to put symbol into r/o section. - unsigned Reloc = (TM.getRelocationModel() != Reloc::Static ? - Reloc::LocalOrGlobal : Reloc::None); - - // We already did a query for 'all' relocs, thus - early exits. - if (Reloc == Reloc::LocalOrGlobal) + // Decide whether it is still possible to put symbol into r/o section. + if (TM.getRelocationModel() != Reloc::Static) return SectionKind::Data; - else if (Reloc == Reloc::None) + else return SectionKind::ROData; - else { - // Ok, target wants something funny. Honour it. - return (C->ContainsRelocations(Reloc) ? - SectionKind::Data : SectionKind::ROData); - } } else { // Check, if initializer is a null-terminated string if (isConstantString(C))