1. Feb 25, 2017
    • Simon Pilgrim's avatar
      [APInt] Add APInt::extractBits() method to extract APInt subrange · bd9fb2ae
      Simon Pilgrim authored
      The current pattern for extract bits in range is typically:
      
      Mask.lshr(BitOffset).trunc(SubSizeInBits);
      
      Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation of memory for the temporary variable.
      
      This is another of the compile time issues identified in PR32037 (see also D30265).
      
      This patch adds the APInt::extractBits() helper method which avoids the temporary memory allocation.
      
      Differential Revision: https://reviews.llvm.org/D30336
      
      llvm-svn: 296141
      bd9fb2ae
    • Alex Lorenz's avatar
      [Preprocessor] Fix incorrect token caching that occurs when lexing _Pragma · 24a1bedf
      Alex Lorenz authored
      in macro argument pre-expansion mode when skipping a function body
      
      This commit fixes a token caching problem that currently occurs when clang is
      skipping a function body (e.g. when looking for a code completion token) and at
      the same time caching the tokens for _Pragma when lexing it in macro argument
      pre-expansion mode.
      
      When _Pragma is being lexed in macro argument pre-expansion mode, it caches the
      tokens so that it can avoid interpreting the pragma immediately (as the macro
      argument may not be used in the macro body), and then either backtracks over or
      commits these tokens. The problem is that, when we're backtracking/committing in
      such a scenario, there's already a previous backtracking position stored in
      BacktrackPositions (as we're skipping the function body), and this leads to a
      situation where the cached tokens from the pragma (like '(' 'string_literal'
      and ')') will remain in the cached tokens array incorrectly even after they're
      consumed (in the case of backtracking) or just ignored (in the case when they're
      committed). Furthermore, what makes it even worse, is that because of a previous
      backtracking position, the logic that deals with when should we call
      ExitCachingLexMode in CachingLex no longer works for us in this situation, and
      more tokens in the macro argument get cached, to the point where the EOF token
      that corresponds to the macro argument EOF is cached. This problem leads to all
      sorts of issues in code completion mode, where incorrect errors get presented
      and code completion completely fails to produce completion results.
      
      rdar://28523863
      
      Differential Revision: https://reviews.llvm.org/D28772
      
      llvm-svn: 296140
      24a1bedf
    • Simon Pilgrim's avatar
      Fixed IntOperandMatcher::emitCxxPredicateExpr arguments · d030291d
      Simon Pilgrim authored
      Extra const in the StringRef argument meant that MSVC complained about it not correctly overriding from OperandPredicateMatcher::emitCxxPredicateExpr (which didn't have the const)
      
      llvm-svn: 296138
      d030291d
    • Sanjay Patel's avatar
      [DAGCombiner] add missing folds for scalar select of {-1,0,1} · 832b1622
      Sanjay Patel authored
      The motivation for filling out these select-of-constants cases goes back to D24480, 
      where we discussed removing an IR fold from add(zext) --> select. And that goes back to:
      https://reviews.llvm.org/rL75531
      https://reviews.llvm.org/rL159230
      
      The idea is that we should always canonicalize patterns like this to a select-of-constants 
      in IR because that's the smallest IR and the best for value tracking. Note that we currently 
      do the opposite in some cases (like the cases in *this* patch). Ie, the proposed folds in 
      this patch already exist in InstCombine today:
      https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstCombineSelect.cpp#L1151
      
      As this patch shows, most targets generate better machine code for simple ext/add/not ops 
      rather than a select of constants. So the follow-up steps to make this less of a patchwork 
      of special-case folds and missing IR canonicalization:
      
      1. Have DAGCombiner convert any select of constants into ext/add/not ops.
      2  Have InstCombine canonicalize in the other direction (create more selects).
      
      Differential Revision: https://reviews.llvm.org/D30180
      
      llvm-svn: 296137
      832b1622
    • Ranjeet Singh's avatar
      [libcxxabi] Disable calls to fprintf for baremetal targets. · 4987856f
      Ranjeet Singh authored
      We've been having issues with using libcxxabi and libunwind for baremetal
      targets because fprintf is dependent on io functions, this patch disables calls
      to fprintf when building for baremetal in release mode.
      
      Differential Revision: https://reviews.llvm.org/D30339
      
      llvm-svn: 296136
      4987856f
    • Ranjeet Singh's avatar
      [libunwind] Disable calls to fprintf for baremetal targets. · 744dabcd
      Ranjeet Singh authored
      We've been having issues with using libcxxabi and libunwind for baremetal
      targets because fprintf is dependent on io functions, this patch disables calls
      to fprintf when building for baremetal in release mode.
      
      Differential Revision: https://reviews.llvm.org/D30340
      
      llvm-svn: 296135
      744dabcd
    • Simon Dardis's avatar
      Recommit "[mips] Fix atomic compare and swap at O0." · ae6f2bcb
      Simon Dardis authored
      This time with the missing files.
      
      Similar to PR/25526, fast-regalloc introduces spills at the end of basic
      blocks. When this occurs in between an ll and sc, the store can cause the
      atomic sequence to fail.
      
      This patch fixes the issue by introducing more pseudos to represent atomic
      operations and moving their lowering to after the expansion of postRA
      pseudos.
      
      This resolves PR/32020.
      
      Thanks to James Cowgill for reporting the issue!
      
      Reviewers: slthakur
      
      Differential Revision: https://reviews.llvm.org/D30257
      
      llvm-svn: 296134
      ae6f2bcb
    • Simon Dardis's avatar
      Revert "[mips] Fix atomic compare and swap at O0." · 3c58c18f
      Simon Dardis authored
      This reverts r296132. I forgot to include the tests.
      
      llvm-svn: 296133
      3c58c18f
    • Simon Dardis's avatar
      [mips] Fix atomic compare and swap at O0. · cf0e06d3
      Simon Dardis authored
      Similar to PR/25526, fast-regalloc introduces spills at the end of basic
      blocks. When this occurs in between an ll and sc, the store can cause the
      atomic sequence to fail.
      
      This patch fixes the issue by introducing more pseudos to represent atomic
      operations and moving their lowering to after the expansion of postRA
      pseudos.
      
      This resolves PR/32020.
      
      Thanks to James Cowgill for reporting the issue!
      
      Reviewers: slthakur
      
      Differential Revision: https://reviews.llvm.org/D30257
      
      llvm-svn: 296132
      cf0e06d3
  2. Feb 24, 2017