1. Jan 08, 2015
    • Kristof Beyls's avatar
      Fix large stack alignment codegen for ARM and Thumb2 targets · 933de7aa
      Kristof Beyls authored
      This partially fixes PR13007 (ARM CodeGen fails with large stack
      alignment): for ARM and Thumb2 targets, but not for Thumb1, as it
      seems stack alignment for Thumb1 targets hasn't been supported at
      all.
      
      Producing an aligned stack pointer is done by zero-ing out the lower
      bits of the stack pointer. The BIC instruction was used for this.
      However, the immediate field of the BIC instruction only allows to
      encode an immediate that can zero out up to a maximum of the 8 lower
      bits. When a larger alignment is requested, a BIC instruction cannot
      be used; llvm was silently producing incorrect code in this case.
      
      This commit fixes code generation for large stack aligments by
      using the BFC instruction instead, when the BFC instruction is
      available.  When not, it uses 2 instructions: a right shift,
      followed by a left shift to zero out the lower bits.
      
      The lowering of ARM::Int_eh_sjlj_dispatchsetup still has code
      that unconditionally uses BIC to realign the stack pointer, so it
      very likely has the same problem. However, I wasn't able to
      produce a test case for that. This commit adds an assert so that
      the compiler will fail the assert instead of silently generating
      wrong code if this is ever reached.
      
      llvm-svn: 225446
      933de7aa
    • Tom Stellard's avatar
      R600/SI: Remove SIISelLowering::legalizeOperands() · 654d669e
      Tom Stellard authored
      Its functionality has been replaced by calling
      SIInstrInfo::legalizeOperands() from
      SIISelLowering::AdjstInstrPostInstrSelection() and running the
      SIFoldOperands and SIShrinkInstructions passes.
      
      llvm-svn: 225445
      654d669e
    • Daniel Jasper's avatar
      clang-format: Force line break between "endl" and "<<". · d05d3a89
      Daniel Jasper authored
      This makes piped output easier to read in many instances.
      
      Before:
        llvm::errs() << aaaa << std::endl << bbbb << std::endl;
      
      After:
        llvm::errs() << aaaa << std::endl
                     << bbbb << std::endl;
      
      Also fix a few instance of "don't use else after return" as per the
      coding standards.
      
      llvm-svn: 225444
      d05d3a89
    • Viktor Kutuzov's avatar
      [Sanitizers] Fix internal_lseek() to work on FreeBSD · e01a595d
      Viktor Kutuzov authored
      Differential Revision: http://reviews.llvm.org/D6825
      
      llvm-svn: 225443
      e01a595d
    • Logan Chien's avatar
      Frontend: Fix SourceColumnMap assertion failure on non-ascii characters. · d3d385d6
      Logan Chien authored
      If there are some non-ascii character in the input source code, the
      column index might be smallar than the byte index.  This will result
      in two possible assertion failures.  This CL fixes the computation of
      the column index and byte index.
      
      1. The assertion in startOfNextColumn() and startOfPreviousColumn()
         should not be raised when the byte index is greater than the column
         index since the non-ascii characters may use more than one bytes to
         store a character in a column.
      
      2. The length of the caret line should be equal to the number of columns
         of source line, instead of the length of the source line.  Otherwise,
         the assertion in selectInterestingSourceRegion will be raised because
         the removed columns plus the kept columns are not greater than the max
         column, which means that we should not remove any column at all.
      
      llvm-svn: 225442
      d3d385d6
    • Elena Demikhovsky's avatar
      Masked Load/Store - fixed a bug in type legalization. · 285fbd55
      Elena Demikhovsky authored
      llvm-svn: 225441
      285fbd55
    • Michael Kuperstein's avatar
      Fix a think-o in the test for r225438. · 381dc08b
      Michael Kuperstein authored
      llvm-svn: 225440
      381dc08b
    • Michael Kuperstein's avatar
      Fix include ordering, NFC. · 698ea3b4
      Michael Kuperstein authored
      llvm-svn: 225439
      698ea3b4
    • Michael Kuperstein's avatar
      [X86] Don't try to generate direct calls to TLS globals · 46f7d525
      Michael Kuperstein authored
      The call lowering assumes that if the callee is a global, we want to emit a direct call.
      This is correct for regular globals, but not for TLS ones.
      
      Differential Revision: http://reviews.llvm.org/D6862
      
      llvm-svn: 225438
      46f7d525
    • Michael Kuperstein's avatar
      Move SPAdj logic from PEI into the targets (NFC) · 8c65e31a
      Michael Kuperstein authored
      PEI tries to keep track of how much starting or ending a call sequence adjusts the stack pointer by, so that it can resolve frame-index references. Currently, it takes a very simplistic view of how SP adjustments are done - both FrameStartOpcode and FrameDestroyOpcode adjust it exactly by the amount written in its first argument.
      
      This view is in fact incorrect for some targets (e.g. due to stack re-alignment, or because it may want to adjust the stack pointer in multiple steps). However, that doesn't cause breakage, because most targets (the only in-tree exception appears to be 32-bit ARM) rely on being able to simplify the call frame pseudo-instructions earlier, so this code is never hit. 
      
      Moving the computation into TargetInstrInfo allows targets to override the way the adjustment is computed if they need to have a non-zero SPAdj.
      
      Differential Revision: http://reviews.llvm.org/D6863
      
      llvm-svn: 225437
      8c65e31a
    • Mohit K. Bhakkad's avatar
      [LLDB][MIPS] Adding SoftwareBreakpointTrapOpcode and RelocationJumpSlotType for MIPS · c9335a3f
      Mohit K. Bhakkad authored
      Patch by Bhushan Attarde
      
      Reviewers: clayborg
      
      Reviewed By: clayborg
      
      Subscribers: petarj, dsanders, mohit.bhakkad, lldb-commits
      
      Differential Revision: http://reviews.llvm.org/D6861
      
      llvm-svn: 225436
      c9335a3f
    • Daniel Jasper's avatar
      clang-format: Improve template parameter detection. · b13135bc
      Daniel Jasper authored
      Before:
        struct A < std::enable_if<sizeof(T2) <sizeof(int32)>::type>;
      
      After:
        struct A<std::enable_if<sizeof(T2) < sizeof(int32)>::type>;
      
      llvm-svn: 225435
      b13135bc
    • Craig Topper's avatar
      Fix test case I missed in r225432. · 0c4d51b7
      Craig Topper authored
      llvm-svn: 225434
      0c4d51b7
    • Andrew Wilkins's avatar
      [llgo] irgen: generate switch instructions · f3718a9b
      Andrew Wilkins authored
      Summary:
          With this patch, llgo uses ssautil.Switches
          to reconstitute (and synthesise) switches,
          which can then be lowered to lookup tables,
          trees, etc.
      
          We currently only handle integer const case
          switches. We erase the comparison blocks (other
          than the initial block), and generate a switch
          instruction at the end of the block starting
          the if-else-if chain. ssautil.Switches does
          not remove duplicate const cases (e.g. same
          operands for "||"), so we do this in llgo for
          now.
      
      Test Plan: lit test added
      
      Reviewers: pcc
      
      Reviewed By: pcc
      
      Subscribers: llvm-commits
      
      Differential Revision: http://reviews.llvm.org/D6831
      
      llvm-svn: 225433
      f3718a9b
    • Craig Topper's avatar
      [X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA... · 7c102529
      Craig Topper authored
      [X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA variants in Intel syntax. The memory operand is inherently unsized.
      
      llvm-svn: 225432
      7c102529
    • Jason Molenda's avatar
      Have AssemblyParse_x86::get_non_call_site_unwind_plan track · 4535ecb1
      Jason Molenda authored
      which registers have been spilled (saved to the stack) - and
      if we see that same register being saved to the stack again,
      don't record that, it's something specific to this stack frame.
      
      I found a code sequence for i386 where clang did a push %esi
      and then later in the function it did movl %esi, -0x7c(%ebp)
      and that second save of a scratch value overrode the original
      push location.
      
      <rdar://problem/19171178> 
      
      llvm-svn: 225431
      4535ecb1
    • Marshall Clow's avatar
      In early C++11 standard drafts, std::function derived from std::unary_function... · a257ab08
      Marshall Clow authored
      In early C++11 standard drafts, std::function derived from std::unary_function or std::binary_function if there was only one (or two) parameters. Before C++11 shipped, this restiction was lifted, but libc++ still does this (which is fine). However, the tests still check for this outdated requiremnt. Change then to check for the nested typedefs instead (which are still required by the standard). No change to the library.
      
      llvm-svn: 225430
      a257ab08
    • Marshall Clow's avatar
      Add checks to make sure the hash functor has the right typedefs · c51d3ecb
      Marshall Clow authored
      llvm-svn: 225429
      c51d3ecb
    • Saleem Abdulrasool's avatar
      PE/COFF: add support to import functions in ARM NT · b9c402ed
      Saleem Abdulrasool authored
      This is necessary to support linking a basic program which references symbols
      outside of the module itself.  Add the import thunk for ARM NT style imports.
      This allows us to create the reference.  However, it is still insufficient to
      generate executables that will run due to base relocations not being emitted for
      the import.
      
      llvm-svn: 225428
      b9c402ed
    • Jason Molenda's avatar
      Rearrange RegisterContextLLDB::SavedLocationForRegister a tiny bit · 341f0e6e
      Jason Molenda authored
      so that we will use the UnwindPlan's rule for providing the stack
      pointer BEFORE we use the trick of using the callee's CFA address
      as the stack pointer.  When we're in a _sigtramp frame, the CFA of
      the _sigtramp stack frame is not the same as the stack pointer value
      when the async interrupt occurred -- we need to use the eh_frame
      rules for retrieving the correct value.
      
      <rdar://problem/18913548> 
      
      llvm-svn: 225427
      341f0e6e
    • Richard Trieu's avatar
      Attempt to fix test from r225423 to get build bots green. · 8ac1419d
      Richard Trieu authored
      llvm-svn: 225426
      8ac1419d
    • Vince Harron's avatar
      Added documentation for test timeout · ede5965b
      Vince Harron authored
      Differential Revision: http://reviews.llvm.org/D6669
      
      Submitted for Chaoren Lin
      
      llvm-svn: 225425
      ede5965b
    • Adrian Prantl's avatar
      Revert "Reapply: Teach SROA how to update debug info for fragmented variables." · 2561bb88
      Adrian Prantl authored
      This reverts commit r225379 while investigating an assertion failure reported
      by Alexey.
      
      llvm-svn: 225424
      2561bb88
    • Richard Trieu's avatar
      When the diagnostic text is simply "%0", sanitize the string for any · b3b8bb00
      Richard Trieu authored
      unprintable characters.  Fixes PR22048.
      
      llvm-svn: 225423
      b3b8bb00
    • Quentin Colombet's avatar
      [RegAllocGreedy] Introduce a late pass to repair broken hints. · a799e2e0
      Quentin Colombet authored
      A broken hint is a copy where both ends are assigned different colors. When a
      variable gets evicted in the neighborhood of such copies, it is likely we can
      reconcile some of them.
      
      
      ** Context **
      
      Copies are inserted during the register allocation via splitting. These split
      points are required to relax the constraints on the allocation problem. When
      such a point is inserted, both ends of the copy would not share the same color
      with respect to the current allocation problem. When variables get evicted,
      the allocation problem becomes different and some split point may not be
      required anymore. However, the related variables may already have been colored.
      
      This usually shows up in the assembly with pattern like this:
      def A
      ...
      save A to B
      def A
      use A
      restore A from B
      ...
      use B
      
      Whereas we could simply have done:
      def B
      ...
      def A
      use A
      ...
      use B
      
      
      ** Proposed Solution **
      
      A variable having a broken hint is marked for late recoloring if and only if
      selecting a register for it evict another variable. Indeed, if no eviction
      happens this is pointless to look for recoloring opportunities as it means the
      situation was the same as the initial allocation problem where we had to break
      the hint.
      
      Finally, when everything has been allocated, we look for recoloring
      opportunities for all the identified candidates.
      The recoloring is performed very late to rely on accurate copy cost (all
      involved variables are allocated).
      The recoloring is simple unlike the last change recoloring. It propagates the
      color of the broken hint to all its copy-related variables. If the color is
      available for them, the recoloring uses it, otherwise it gives up on that hint
      even if a more complex coloring would have worked.
      
      The recoloring happens only if it is profitable. The profitability is evaluated
      using the expected frequency of the copies of the currently recolored variable
      with a) its current color and b) with the target color. If a) is greater or
      equal than b), then it is profitable and the recoloring happen.
      
      
      ** Example **
      
      Consider the following example:
      BB1:
        a =
        b =
      BB2:
        ...
         = b
         = a
      Let us assume b gets split:
      BB1:
        a =
        b =
      BB2:
        c = b
        ...
        d = c
        = d
        = a
      Because of how the allocation work, b, c, and d may be assigned different
      colors. Now, if a gets evicted to make room for c, assuming b and d were
      assigned to something different than a.
      We end up with:
      BB1:
        a =
        st a, SpillSlot
        b =
      BB2:
        c = b
        ...
        d = c
        = d
        e = ld SpillSlot
        = e
      This is likely that we can assign the same register for b, c, and d,
      getting rid of 2 copies.
      
      
      ** Performances **
      
      Both ARM64 and x86_64 show performance improvements of up to 3% for the
      llvm-testsuite + externals with Os and O3. There are a few regressions too that
      comes from the (in)accuracy of the block frequency estimate.
      
      <rdar://problem/18312047>
      
      llvm-svn: 225422
      a799e2e0
    • Ahmed Bougacha's avatar
      [SelectionDAG] Allow targets to specify legality of extloads' result · 2b6917b0
      Ahmed Bougacha authored
      type (in addition to the memory type).
      
      The *LoadExt* legalization handling used to only have one type, the
      memory type.  This forced users to assume that as long as the extload
      for the memory type was declared legal, and the result type was legal,
      the whole extload was legal.
      
      However, this isn't always the case.  For instance, on X86, with AVX,
      this is legal:
          v4i32 load, zext from v4i8
      but this isn't:
          v4i64 load, zext from v4i8
      Whereas v4i64 is (arguably) legal, even without AVX2.
      
      Note that the same thing was done a while ago for truncstores (r46140),
      but I assume no one needed it yet for extloads, so here we go.
      
      Calls to getLoadExtAction were changed to add the value type, found
      manually in the surrounding code.
      
      Calls to setLoadExtAction were mechanically changed, by wrapping the
      call in a loop, to match previous behavior.  The loop iterates over
      the MVT subrange corresponding to the memory type (FP vectors, etc...).
      I also pulled neighboring setTruncStoreActions into some of the loops;
      those shouldn't make a difference, as the additional types are illegal.
      (e.g., i128->i1 truncstores on PPC.)
      
      No functional change intended.
      
      Differential Revision: http://reviews.llvm.org/D6532
      
      llvm-svn: 225421
      2b6917b0
    • Nick Lewycky's avatar
      Remove empty statement. No functionality change. · c99cc196
      Nick Lewycky authored
      llvm-svn: 225420
      c99cc196
    • Matthias Braun's avatar
    • Enrico Granata's avatar
      Fix a problem where a ValueObject could fail to update itself, but since it... · 1a4d0785
      Enrico Granata authored
      Fix a problem where a ValueObject could fail to update itself, but since it was previously valid, we'd have an old checksum to compare aginst no new checksum (because failure to update), and assert() and die. Fix the problem by only caring about this assertion logic if updates succeed
      
      llvm-svn: 225418
      1a4d0785
    • Kevin Enderby's avatar
      Run clang-format on tools/llvm-objdump/MachODump.cpp again as some of my · 66d51fc4
      Kevin Enderby authored
      previous changes got in with incorrect formatting. No functional change.
      
      llvm-svn: 225417
      66d51fc4
    • Matthias Braun's avatar
      RegisterCoalescer: Do not remove IMPLICIT_DEFS if they are required for subranges. · 9d7bc087
      Matthias Braun authored
      The register coalescer used to remove implicit_defs when they are
      covered by the main range anyway. With subreg liveness tracking we can't
      do that anymore in places where the IMPLICIT_DEF is required as begin of
      a subregister liverange.
      
      llvm-svn: 225416
      9d7bc087
    • Matthias Braun's avatar
      RegisterCoalescer: Fix valuesIdentical() in some subrange merge cases. · d55e6dda
      Matthias Braun authored
      I got confused and assumed SrcIdx/DstIdx of the CoalescerPair is a
      subregister index in SrcReg/DstReg, but they are actually subregister
      indices of the coalesced register that get you back to SrcReg/DstReg
      when applied.
      
      Fixed the bug, improved comments and simplified code accordingly.
      
      Testcase by Tom Stellard!
      
      llvm-svn: 225415
      d55e6dda
    • Nico Weber's avatar
      Wrap to 80 columns. No behavior change. · 462fd1ed
      Nico Weber authored
      llvm-svn: 225414
      462fd1ed
    • Matthias Braun's avatar
      LiveInterval: Implement feedback by Quentin Colombet. · 4fe686af
      Matthias Braun authored
      llvm-svn: 225413
      4fe686af
    • Philip Reames's avatar
      [GC] improve testing around gc.relocate and fix a test · 76ebd154
      Philip Reames authored
      Patch by: Ramkumar Ramachandra <artagnon@gmail.com>
      
      "This patch started out as an exploration of gc.relocate, and an attempt
      to write a simple test in call-lowering. I then noticed that the
      arguments of gc.relocate were not checked fully, so I went in and fixed
      a few things. Finally, the most important outcome of this patch is that
      my new error handling code caught a bug in a callsite in
      stackmap-format."
      
      Differential Revision: http://reviews.llvm.org/D6824
      
      llvm-svn: 225412
      76ebd154
    • Ahmed Bougacha's avatar
      [CodeGen] Add MVT::isValid to replace manual validity checks. NFC. · 97fea8bb
      Ahmed Bougacha authored
      Now that we have MVT::FIRST_VALUETYPE (r225362), we can provide a method
      checking that the MVT is valid, that is, it's in
        [FIRST_VALUETYPE, LAST_VALUETYPE[.
      This commit also uses it in a few asserts, that would previously accept
      invalid MVTs, such as the default constructed -1.  In that case,
      the code following those asserts would do an out-of-bounds array access.
      Using MVT::isValid, those assertions fail as expected when passed
      invalid MVTs.
      It feels clunky to have such a validity checking function, but it's
      at least better than the alternative of broken manual checks.
      
      llvm-svn: 225411
      97fea8bb
    • Tom Stellard's avatar
      R600/SI: Commute instructions to enable more folding opportunities · 0599297c
      Tom Stellard authored
      llvm-svn: 225410
      0599297c
    • Nico Weber's avatar
      Add help text for mmacosx-version-min=, mios-version-min=. · e6264cf6
      Nico Weber authored
      I keep forgetting the exact spelling of -macosx-version-min=, and now I can
      run `bin/clang --help | grep version -A 2` to remind myself.  While here,
      also document -mios-version-min=.  Don't document -mios-simulator-version-min=
      as it's just an alias for -mios-version-min= these days.
      
      llvm-svn: 225409
      e6264cf6
    • Marshall Clow's avatar
      Missed a typename · 6855c93c
      Marshall Clow authored
      llvm-svn: 225408
      6855c93c
    • Greg Clayton's avatar
      Fix inlined test cases so they print out the correct command to run when they... · 70995584
      Greg Clayton authored
      Fix inlined test cases so they print out the correct command to run when they fail instead of printing out incorrect information.
      
      To fix this I added a new method to TestBase:
      
          def getRerunArgs(self):
              return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
              
      The InlineTest which inherits from TestBase then overrides this function with a custom version which does the right thing.
      
      llvm-svn: 225407
      70995584