Skip to content
  1. May 28, 2013
  2. May 27, 2013
    • Preston Gurd's avatar
      Convert sqrt functions into sqrt instructions when -ffast-math is in effect. · 048f99de
      Preston Gurd authored
      When -ffast-math is in effect (on Linux, at least), clang defines
      __FINITE_MATH_ONLY__ > 0 when including <math.h>. This causes the
      preprocessor to include <bits/math-finite.h>, which renames the sqrt functions.
      For instance, "sqrt" is renamed as "__sqrt_finite". 
      
      This patch adds the 3 new names in such a way that they will be treated
      as equivalent to their respective original names.
      
      llvm-svn: 182739
      048f99de
    • Hal Finkel's avatar
      PPC: Add a isConsecutiveLS utility function · 8ebfe6c2
      Hal Finkel authored
      isConsecutiveLS is a slightly more general form of
      SelectionDAG::isConsecutiveLoad. Aside from also handling stores, it also does
      not assume equality of the chain operands is necessary. In the case of the PPC
      backend, this chain condition is checked in a more general way by the
      surrounding code.
      
      Mostly, this part of the refactoring in preparation for supporting optimized
      unaligned stores.
      
      llvm-svn: 182723
      8ebfe6c2
  3. May 26, 2013
    • Hal Finkel's avatar
      Prefer to duplicate PPC Altivec loads when expanding unaligned loads · 7d8a691b
      Hal Finkel authored
      When expanding unaligned Altivec loads, we use the decremented offset trick to
      prevent page faults. Unfortunately, if we have a sequence of consecutive
      unaligned loads, this leads to suboptimal code generation because the 'extra'
      load from the first unaligned load can be combined with the base load from the
      second (but only if the decremented offset trick is not used for the first).
      Search up and down the chain, through loads and token factors, looking for
      consecutive loads, and if one is found, don't use the offset reduction trick.
      These duplicate loads are later combined to yield the desired sequence (in the
      future, we might want a more-powerful chain search, but that will require some
      changes to allow the combiner routines to access the AA object).
      
      This should complete the initial implementation of the optimized unaligned
      Altivec load expansion. There is some refactoring that should be done, but
      that will happen when the unaligned store expansion is added.
      
      llvm-svn: 182719
      7d8a691b
    • Andrew Trick's avatar
      Fix PR16143: Insert DEBUG_VALUE before terminator. · c66d26ad
      Andrew Trick authored
      llvm-svn: 182717
      c66d26ad
  4. May 25, 2013
  5. May 24, 2013
    • Michael J. Spencer's avatar
      Add missing header for atexit. · 4fd69975
      Michael J. Spencer authored
      llvm-svn: 182672
      4fd69975
    • Michael Gottesman's avatar
      [objc-arc] KnownSafe does not imply that it is safe to perform code motion... · e67f40c5
      Michael Gottesman authored
      [objc-arc] KnownSafe does not imply that it is safe to perform code motion across CFG edges since even if it is safe to remove RR pairs, we may still be able to move a retain/release into a loop.
      
      rdar://13949644
      
      llvm-svn: 182670
      e67f40c5
    • Michael Gottesman's avatar
      [objc-arc] Make sure that multiple owners is propogated correctly through the... · 5a91bbf3
      Michael Gottesman authored
      [objc-arc] Make sure that multiple owners is propogated correctly through the pass via the usage of a global data structure.
      
      rdar://13750319
      
      llvm-svn: 182669
      5a91bbf3
    • Benjamin Kramer's avatar
      LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it,... · 6ac1e623
      Benjamin Kramer authored
      LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases.
      
      Fixes PR16139.
      
      llvm-svn: 182656
      6ac1e623
    • Diego Novillo's avatar
    • Richard Sandiford's avatar
      [SystemZ] Improve AsmParser handling of invalid instructions · dc5ed713
      Richard Sandiford authored
      Previously, an invalid instruction like:
      
      	foo     %r1, %r0
      
      would generate the rather odd error message:
      
      ....: error: unknown token in expression
      	foo     %r1, %r0
      		^
      
      We now get the more informative:
      
      ....: error: invalid instruction
      	foo     %r1, %r0
      	^
      
      The same would happen if an address were used where a register was expected.
      We now get "invalid operand for instruction" instead.
      
      llvm-svn: 182644
      dc5ed713
    • Richard Sandiford's avatar
      [SystemZ] Improve AsmParser register parsing · 675f8699
      Richard Sandiford authored
      The idea is to make sure that:
      
      (1) "register expected" is restricted to cases where ParseRegister()
          is called and the token obviously isn't a register.
      
      (2) "invalid register" is restricted to cases where a register-like "%..."
          sequence is found, but the "..." makes no sense.
      
      (3) the generic "invalid operand for instruction" is used in cases where
          the wrong register type is used (GPR instead of FPR, etc.).
      
      (4) the new "invalid register pair" is used if the register has the right type,
          but is not a valid register pair.
      
      Testing of (1)-(3) is now restricted to regs-bad.s.  It uses a representative
      instruction for each register class to make sure that only registers from
      that class are accepted.
      
      (4) is tested by both regs-bad.s (which checks all invalid register pairs)
      and insn-bad.s (which tests one invalid pair for each instruction that
      requires a pair).
      
      While there, I changed "Number" to "Num" for consistency with the
      operand class.
      
      llvm-svn: 182643
      675f8699
    • Joey Gouly's avatar
      Run clang-format over the scalarizePHI function. · b34294d0
      Joey Gouly authored
      llvm-svn: 182640
      b34294d0
    • Joey Gouly's avatar
      scalarizePHI needs to insert the next ExtractElement in the same block · 83699284
      Joey Gouly authored
      as the BinaryOperator, *not* in the block where the IRBuilder is currently
      inserting into. Fixes a bug where scalarizePHI would create instructions
      that would not dominate all uses.
      
      llvm-svn: 182639
      83699284
    • Diego Novillo's avatar
      Add a new function attribute 'cold' to functions. · c6399539
      Diego Novillo authored
      Other than recognizing the attribute, the patch does little else.
      It changes the branch probability analyzer so that edges into
      blocks postdominated by a cold function are given low weight.
      
      Added analysis and code generation tests.  Added documentation for the
      new attribute.
      
      llvm-svn: 182638
      c6399539
    • Benjamin Kramer's avatar
      Remove the Copied parameter from MemoryObject::readBytes. · 534d3a46
      Benjamin Kramer authored
      There was exactly one caller using this API right, the others were relying on
      specific behavior of the default implementation. Since it's too hard to use it
      right just remove it and standardize on the default behavior.
      
      Defines away PR16132.
      
      llvm-svn: 182636
      534d3a46
    • Daniel Jasper's avatar
      Fix unused warning in opt builds. · 01a8079b
      Daniel Jasper authored
      In these builds, the asserts() are completely compiled out of the code
      leaving "End" unused. Directly accessing it, should not have a
      performance impact, as it is just a data member.
      
      llvm-svn: 182634
      01a8079b
    • Ahmed Bougacha's avatar
      MC: Disassembled CFG reconstruction. · aa790681
      Ahmed Bougacha authored
      This patch builds on some existing code to do CFG reconstruction from
      a disassembled binary:
      - MCModule represents the binary, and has a list of MCAtoms.
      - MCAtom represents either disassembled instructions (MCTextAtom), or
        contiguous data (MCDataAtom), and covers a specific range of addresses.
      - MCBasicBlock and MCFunction form the reconstructed CFG. An MCBB is
        backed by an MCTextAtom, and has the usual successors/predecessors.
      - MCObjectDisassembler creates a module from an ObjectFile using a
        disassembler. It first builds an atom for each section. It can also
        construct the CFG, and this splits the text atoms into basic blocks.
      
      MCModule and MCAtom were only sketched out; MCFunction and MCBB were
      implemented under the experimental "-cfg" llvm-objdump -macho option.
      This cleans them up for further use; llvm-objdump -d -cfg now generates
      graphviz files for each function found in the binary.
      
      In the future, MCObjectDisassembler may be the right place to do
      "intelligent" disassembly: for example, handling constant islands is just
      a matter of splitting the atom, using information that may be available
      in the ObjectFile. Also, better initial atom formation than just using
      sections is possible using symbols (and things like Mach-O's
      function_starts load command).
      
      This brings two minor regressions in llvm-objdump -macho -cfg:
      - The printing of a relocation's referenced symbol.
      - An annotation on loop BBs, i.e., which are their own successor.
      
      Relocation printing is replaced by the MCSymbolizer; the basic CFG
      annotation will be superseded by more related functionality.
      
      llvm-svn: 182628
      aa790681
    • Ahmed Bougacha's avatar
      Add MCSymbolizer for symbolic/annotated disassembly. · ad1084de
      Ahmed Bougacha authored
      This is a basic first step towards symbolization of disassembled
      instructions. This used to be done using externally provided (C API)
      callbacks. This patch introduces:
      - the MCSymbolizer class, that mimics the same functions that were used
        in the X86 and ARM disassemblers to symbolize immediate operands and
        to annotate loads based off PC (for things like c string literals).
      - the MCExternalSymbolizer class, which implements the old C API.
      - the MCRelocationInfo class, which provides a way for targets to
        translate relocations (either object::RelocationRef, or disassembler
        C API VariantKinds) to MCExprs.
      - the MCObjectSymbolizer class, which does symbolization using what it
        finds in an object::ObjectFile. This makes simple symbolization (with
        no fancy relocation stuff) work for all object formats!
      - x86-64 Mach-O and ELF MCRelocationInfos.
      - A basic ARM Mach-O MCRelocationInfo, that provides just enough to
        support the C API VariantKinds.
      
      Most of what works in otool (the only user of the old symbolization API
      that I know of) for x86-64 symbolic disassembly (-tvV) works, namely:
      - symbol references: call _foo; jmp 15 <_foo+50>
      - relocations:       call _foo-_bar; call _foo-4
      - __cf?string:       leaq 193(%rip), %rax ## literal pool for "hello"
      Stub support is the main missing part (because libObject doesn't know,
      among other things, about mach-o indirect symbols).
      
      As for the MCSymbolizer API, instead of relying on the disassemblers
      to call the tryAdding* methods, maybe this could be done automagically
      using InstrInfo? For instance, even though PC-relative LEAs are used
      to get the address of string literals in a typical Mach-O file, a MOV
      would be used in an ELF file. And right now, the explicit symbolization
      only recognizes PC-relative LEAs. InstrInfo should have already have
      most of what is needed to know what to symbolize, so this can
      definitely be improved.
      
      I'd also like to remove object::RelocationRef::getValueString (it seems
      only used by relocation printing in objdump), as simply printing the
      created MCExpr is definitely enough (and cleaner than string concats).
      
      llvm-svn: 182625
      ad1084de
    • Ulrich Weigand's avatar
      · 99485469
      Ulrich Weigand authored
      [PowerPC] Remove symbolLo/symbolHi instruction operand types
      
      Now that there is no longer any distinction between symbolLo
      and symbolHi operands in either printing, encoding, or parsing,
      the operand types can be removed in favor of simply using
      s16imm.
      
      This completes the patch series to decouple lo/hi operand part
      processing from the particular instruction whose operand it is.
      
      No change in code generation expected from this patch.
      
      llvm-svn: 182618
      99485469
    • Daniel Malea's avatar
      Re-implement DebugIR in a way that does not subclass AssemblyWriter: · fddddbea
      Daniel Malea authored
      - move AsmWriter.h from public headers into lib
      - marked all AssemblyWriter functions as non-virtual; no need to override them
      - DebugIR now "plugs into" AssemblyWriter with an AssemblyAnnotationWriter helper
      - exposed flags to control hiding of a) debug metadata b) debug intrinsic calls
      
      C/R: Paul Redmond
      
      llvm-svn: 182617
      fddddbea
Loading