1. Sep 11, 2017
    • Marcello Maggioni's avatar
      [ScalarEvolution] Refactor forgetLoop() to improve performance · ce90060d
      Marcello Maggioni authored
      forgetLoop() has pretty bad performance because it goes over
      the same instructions over and over again in particular when
      nested loop are involved.
      The refactoring changes the function to a not-recursive function
      and reusing the allocation for data-structures and the Visited
      set.
      
      NFCI
      
      Differential Revision: https://reviews.llvm.org/D37659
      
      llvm-svn: 312920
      ce90060d
    • Matt Arsenault's avatar
      Fix typo · eb4474cf
      Matt Arsenault authored
      llvm-svn: 312919
      eb4474cf
    • Martin Probst's avatar
      clang-format: [JS] wrap and indent `goog.setTestOnly` calls. · 103a7b5b
      Martin Probst authored
      Summary:
      While `goog.setTestOnly` usually appears in the imports section of a file, it is
      not actually an import, and also usually doesn't take long parameters (nor
      namespaces as a parameter, it's a description/message that should be wrapped).
      
      This fixes a regression where a `goog.setTestOnly` call nested in a function was
      not wrapped.
      
      Reviewers: djasper
      
      Subscribers: klimek
      
      Differential Revision: https://reviews.llvm.org/D37685
      
      llvm-svn: 312918
      103a7b5b
    • Cameron Desrochers's avatar
      [PCH] Allow VFS to be used for tests that generate PCH files · b5b48db1
      Cameron Desrochers authored
      When using a virtual file-system (VFS) and a preamble file (PCH) is generated,
      it is generated on-disk in the real file-system instead of in the VFS (which
      makes sense, since the VFS is read-only). However, when subsequently reading
      the generated PCH, the frontend passes through the VFS it has been given --
      resulting in an error and a failed parse (since the VFS doesn't contain the
      PCH; the real filesystem does).
      
      This patch fixes that by detecting when a VFS is being used for a parse that
      needs to work with a PCH file, and creating an overlay VFS that includes the
      PCH file from the real file-system.
      
      This allows tests to be written which make use of both PCH files and a VFS.
      
      Differential Revision: https://reviews.llvm.org/D37474
      
      llvm-svn: 312917
      b5b48db1
    • Simon Pilgrim's avatar
      [X86][SSE] Add support for X86ISD::PACKSS to ComputeNumSignBitsForTargetNode · b092bd32
      Simon Pilgrim authored
      Helps improve combineLogicBlendIntoPBLENDV support by allowing us to peek into through PACKSS truncations of vector comparison results.
      
      Differential Revision: https://reviews.llvm.org/D37680
      
      llvm-svn: 312916
      b092bd32
    • Tim Renouf's avatar
      [AMDGPU] exp should not be in WQM mode · 660ba2b8
      Tim Renouf authored
      A mrt exp with vm=1 must be in exact (non-WQM) mode, as it also exports
      the exec mask as the valid mask to determine which pixels to render.
      
      This commit marks any exp as needing to be in exact mode.
      
      Actually, if there are multiple mrt exps, only one needs to have vm=1,
      and only that one needs to be in exact mode. But that is an optimization
      for another day.
      
      Differential Revision: https://reviews.llvm.org/D36305
      
      llvm-svn: 312915
      660ba2b8
    • Francis Ricci's avatar
      [TableGen] Ensure that __lsan_is_turned_off isn't removed by DCE in llvm-tblgen · 8a1c2b41
      Francis Ricci authored
      Summary:
      Since asan is linked dynamically on Darwin, the weak interface symbol
      is removed by -Wl,-dead_strip.
      
      Reviewers: kcc, compnerd, aaron.ballman
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D37636
      
      llvm-svn: 312914
      8a1c2b41
    • Sanjay Patel's avatar
      [InstSimplify] reorder methods; NFC · fa877fd4
      Sanjay Patel authored
      I'm trying to refactor some shared code for integer div/rem,
      but I keep having to scroll through fdiv. The FP ops have
      nothing in common with the integer ops, so I'm moving FP
      below everything else. 
      
      While here, improve a couple of comments and fix some formatting.
      
      llvm-svn: 312913
      fa877fd4
    • Roman Lebedev's avatar
      [clang-tidy] FunctionSizeCheck: wrap FunctionASTVisitor into anon namespace, NFC · 728284dc
      Roman Lebedev authored
      This check is relatively simple, and is often being used
      as an example. I'm aware of at least two cases, when
      simply copying the FunctionASTVisitor class to a new
      check resulted in a rather unobvious segfault. Having it
      in anonymous namespace prevents such a problem.
      
      No functionality change, so i opted to avoid phabricator,
      especially since clang-tidy reviews are seriously jammed.
      
      llvm-svn: 312912
      728284dc
    • Johannes Altmanninger's avatar
      [AST] Make RecursiveASTVisitor visit TemplateDecls in source order · c6ea4deb
      Johannes Altmanninger authored
      Summary:
      This causes template arguments to be traversed before the templated
      declaration, which is useful for clients that expect the nodes in
      the same order as they are in the source code. Additionally, there
      seems to be no good reason not to do so.
      
      This was moved here from LexicallyOrderedRecursiveASTVisitor. The tests
      still reside in LexicallyOrderedRecursiveASTVisitorTest.cpp under
      VisitTemplateDecls.
      
      Reviewers: arphaman, rsmith, klimek
      
      Subscribers: cfe-commits, klimek
      
      Differential Revision: https://reviews.llvm.org/D37662
      
      llvm-svn: 312911
      c6ea4deb
    • Simon Pilgrim's avatar
      [X86][SSE] Add further test cases showing failure to compute sign bits through PACKSS · d0ff65b5
      Simon Pilgrim authored
      Suggested in D37680
      
      Note: had to drop AVX512VL tests as there is an infinite loop in the new tests that needs further investigation (not relevant to D37680).
      llvm-svn: 312910
      d0ff65b5
    • Gadi Haber's avatar
      [X86][SKX][KNL] Updating several CodeGen tests to use the attr flag instead of mcpu flag · 3ddffced
      Gadi Haber authored
      NFC.
       Updated 3 Codegen regression tests to use the -mattr flag instead of the -mcpu flags as follows:
       Instead of -mcpu=skx use -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq
       Instead of -mcpu=knl use -mattr=+avx512f
      
      Reviewers: delena
      Revision: https://reviews.llvm.org/D37674
      llvm-svn: 312909
      3ddffced
    • Andre Vieira's avatar
      [ARM] Enable the use of SVC anywhere in an IT block · c429aabb
      Andre Vieira authored
      Differential Revision: https://reviews.llvm.org/D37374
      
      llvm-svn: 312908
      c429aabb
    • Michael Zuckerman's avatar
      9707ba09
    • Simon Pilgrim's avatar
      [X86][SSE] Add test showing failure to compute sign bits through PACKSS · f6fa1d03
      Simon Pilgrim authored
      Prevents combineLogicBlendIntoPBLENDV from merging to PBLENDV
      
      llvm-svn: 312906
      f6fa1d03
    • Dylan McKay's avatar
      [AVR] Enable the '__do_copy_data' function · 0fc5fe0a
      Dylan McKay authored
      Also enables '__do_clear_bss'.
      
      These functions are automaticalled called by the CRT if they are
      declared.
      
      We need these to be called otherwise RAM will start completely
      uninitialised, even though we need to copy RAM variables from progmem to
      RAM.
      
      llvm-svn: 312905
      0fc5fe0a
    • Krasimir Georgiev's avatar
      [clang-format] Fixed one-line if statement · 3b0b50ba
      Krasimir Georgiev authored
      Summary:
      **Short overview:**
      
      Fixed bug: https://bugs.llvm.org/show_bug.cgi?id=34001
      Clang-format bug resulting in a strange behavior of control statements short blocks. Different flags combinations do not guarantee expected result. Turned on option AllowShortBlocksOnASingleLine does not work as intended.
      
      **Description of the problem:**
      
      Cpp source file UnwrappedLineFormatter does not handle AllowShortBlocksOnASingleLine flag as it should. Putting a single-line control statement without any braces, clang-format works as expected (depending on AllowShortIfStatementOnASingleLine or AllowShortLoopsOnASingleLine value). Putting a single-line control statement in braces, we can observe strange and incorrect behavior.
      Our short block is intercepted by tryFitMultipleLinesInOne function. The function returns a number of lines to be merged. Unfortunately, our control statement block is not covered properly. There are several if-return statements, but none of them handles our block. A block is identified by the line first token and by left and right braces. A function block works as expected, there is such an if-return statement doing proper job. A control statement block, from the other hand, falls into strange conditional construct, which depends on BraceWrapping.AfterFunction flag (with condition that the line’s last token is left brace, what is possible in our case) or goes even further. That should definitely not happen.
      
      **Description of the patch:**
      
      By adding three different if statements, we guarantee that our short control statement block, however it looks like (different brace wrapping flags may be turned on), is handled properly and does not fall into wrong conditional construct. Depending on appropriate options we return either 0 (when something disturbs our merging attempt) or let another function (tryMergeSimpleBlock) take the responsibility of returned result (number of merged lines). Nevertheless, one more correction is required in mentioned tryMergeSimpleBlock function. The function, previously, returned either 0 or 2. The problem was that this did not handle the case when our block had the left brace in a separate line, not the header one. After change, after adding condition, we return the result compatible with block’s structure. In case of left brace in the header’s line we do everything as before the patch. In case of left brace in a separate line we do the job similar to the one we do in case of a “non-header left brace” function short block. To be precise, we try to merge the block ignoring the header line. Then, if success, we increment our returned result.
      
      **After fix:**
      
      **CONFIG:**
      ```
      AllowShortBlocksOnASingleLine: true
      AllowShortIfStatementsOnASingleLine: true
      BreakBeforeBraces: Custom
      BraceWrapping: {
      AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true
      }
      ```
      **BEFORE:**
      ```
      if (statement) doSomething();
      if (statement) { doSomething(); }
      if (statement) {
          doSomething();
      }
      if (statement)
      {
          doSomething();
      }
      if (statement)
          doSomething();
      if (statement) {
          doSomething1();
          doSomething2();
      }
      ```
      **AFTER:**
      ```
      if (statement) doSomething();
      if (statement) { doSomething(); }
      if (statement) { doSomething(); }
      if (statement) { doSomething(); }
      if (statement) doSomething();
      if (statement)
      {
        doSomething1();
        doSomething2();
      }
      ```
      
      Contributed by @PriMee!
      
      Reviewers: krasimir, djasper
      
      Reviewed By: krasimir
      
      Subscribers: cfe-commits, klimek
      
      Differential Revision: https://reviews.llvm.org/D37140
      
      llvm-svn: 312904
      3b0b50ba
    • Igor Breger's avatar
      [GlobalISel][X86] G_ANYEXT support. · 1f14364d
      Igor Breger authored
      Summary: G_ANYEXT support
      
      Reviewers: zvi, delena
      
      Reviewed By: delena
      
      Subscribers: rovka, kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D37675
      
      llvm-svn: 312903
      1f14364d
    • Ilya Biryukov's avatar
      Fixed a typo in llvm-cov/deferred-region.cpp test. · d386c299
      Ilya Biryukov authored
      Input redirection was using `2&>1` instead of `2>&1`.
      
      llvm-svn: 312902
      d386c299
    • Jonas Toth's avatar
      [clang-tidy] add more aliases for the hicpp module · a7358038
      Jonas Toth authored
      This patch will introduce even more aliases for the hicpp-module to already existing
      checks and is a follow up for D30383 finishing the other sections.
      It fixes a forgotten highlight in hicpp-braces-around-statements.rst, too.
      
      llvm-svn: 312901
      a7358038
    • Tim Renouf's avatar
      AMDGPU: trivial comment change · 6cb007fc
      Tim Renouf authored
      ... to check commit access for new committer.
      
      llvm-svn: 312900
      6cb007fc
    • Roger Ferrer Ibanez's avatar
      [ARM] Use ADDCARRY / SUBCARRY · 12b20f23
      Roger Ferrer Ibanez authored
      This is a preparatory step for D34515 and also is being recommitted as its
      first version caused PR34045.
      
      This change:
       - makes nodes ISD::ADDCARRY and ISD::SUBCARRY legal for i32
       - lowering is done by first converting the boolean value into the carry flag
         using (_, C) ← (ARMISD::ADDC R, -1) and converted back to an integer value
         using (R, _) ← (ARMISD::ADDE 0, 0, C). An ARMISD::ADDE between the two
         operations does the actual addition.
       - for subtraction, given that ISD::SUBCARRY second result is actually a
         borrow, we need to invert the value of the second operand and result before
         and after using ARMISD::SUBE. We need to invert the carry result of
         ARMISD::SUBE to preserve the semantics.
       - given that the generic combiner may lower ISD::ADDCARRY and
         ISD::SUBCARRYinto ISD::UADDO and ISD::USUBO we need to update their lowering
         as well otherwise i64 operations now would require branches. This implies
         updating the corresponding test for unsigned.
       - add new combiner to remove the redundant conversions from/to carry flags
         to/from boolean values (ARMISD::ADDC (ARMISD::ADDE 0, 0, C), -1) → C
       - fixes PR34045
      
      Differential Revision: https://reviews.llvm.org/D35192
      
      llvm-svn: 312898
      12b20f23
    • Daniel Jasper's avatar
      Revert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get... · 7af729b3
      Daniel Jasper authored
      Revert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr"."
      
      This triggers llvm.org/PR31620 in several of our internal builds. I'll
      forward reproduction instructions to the original author.
      
      llvm-svn: 312897
      7af729b3
    • Elena Demikhovsky's avatar
      Fixed a bug in splitting Scatter operation in the Type Legalizer. · cc477bbc
      Elena Demikhovsky authored
      After the split of the Scatter operation, the order of the new instructions is well defined - Lo goes before Hi. Otherwise the semantic of Scatter (from LSB to MSB) is broken.
      I'm chaining 2 nodes to prevent reordering.
      
      Differential Revision https://reviews.llvm.org/D37670
      
      llvm-svn: 312894
      cc477bbc
    • Lang Hames's avatar
      [ORC] Kill off a dead typedef. · 70a6929f
      Lang Hames authored
      llvm-svn: 312893
      70a6929f
    • Eric Fiselier's avatar
      Fix PR34298 - Allow std::function with an incomplete return type. · 94d55511
      Eric Fiselier authored
      This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
      the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
      whenever the copy constructor or copy assignment operator
      was required. This patch further constrains that constructor to short
      circut before evaluating the troublesome SFINAE when `Tp` matches
      std::function.
      
      The original patch is from Alex Lorenz.
      
      llvm-svn: 312892
      94d55511
    • Eric Fiselier's avatar
      Revert "Fix PR34298 - Allow std::function with an incomplete return type." · 85cde7d2
      Eric Fiselier authored
      This reverts commit r312890 because the test case fails to compile for
      older versions of Clang that reject initializing a const object without
      a user defined constructor.
      
      Since this patch should go into 5.0.1, I want to keep it an atomic change,
      and will re-commit it with a fixed test case.
      
      llvm-svn: 312891
      85cde7d2
    • Eric Fiselier's avatar
      Fix PR34298 - Allow std::function with an incomplete return type. · 358ca0c0
      Eric Fiselier authored
      This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
      the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
      whenever the copy constructor or copy assignment operator
      was required. This patch further constrains that constructor to short
      circut before evaluating the troublesome SFINAE when `Tp` matches
      std::function.
      
      The original patch is from Alex Lorenz.
      
      llvm-svn: 312890
      358ca0c0
    • Dave Lee's avatar
      Add objcImplementationDecl matcher · e6d362ce
      Dave Lee authored
      Summary:
      Add the `objcImplementationDecl` matcher. See related: D30854
      
      Tested with:
      
      ```
      ./tools/clang/unittests/ASTMatchers/ASTMatchersTests
      ```
      
      Reviewers: aaron.ballman, compnerd, alexshap
      
      Reviewed By: aaron.ballman
      
      Subscribers: klimek, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D37643
      
      llvm-svn: 312889
      e6d362ce
    • Simon Pilgrim's avatar
      Use llvm_unreachable for unknown TargetCostKind. · b1db6b7d
      Simon Pilgrim authored
      TargetTransformInfo::getInstructionCost's switch covers all TargetCostKind cases so we shouldn't return for a default case.
      
      llvm-svn: 312888
      b1db6b7d
    • Simon Pilgrim's avatar
      [X86][SSE] Tidyup + clang-format combineX86ShuffleChain call. NFCI. · 5e2ed8be
      Simon Pilgrim authored
      llvm-svn: 312887
      5e2ed8be
    • Simon Pilgrim's avatar
      [X86][SSE] Move combineTo call out of combineX86ShufflesConstants. NFCI. · ff347d3e
      Simon Pilgrim authored
      Move towards making it possible to use the shuffle combines for cases where we don't want to call DCI.CombineTo() with the result.
      
      llvm-svn: 312886
      ff347d3e
    • Sanjay Patel's avatar
      [InstSimplify] refactor udiv/urem code and add tests; NFCI · 5876189f
      Sanjay Patel authored
      This removes some duplicated code and makes it easier to support signed div/rem
      in a similar way if we want to do that. Note that the existing comments were not
      accurate - we don't need a constant divisor to simplify; icmp simplification does
      more than that. But as the added tests show, it could go even further.
      
      llvm-svn: 312885
      5876189f
  2. Sep 10, 2017