1. Aug 24, 2018
  2. Aug 23, 2018
    • Sanjay Patel's avatar
      [x86] add debug option for and-immediate shrinking · 40aa8675
      Sanjay Patel authored
        
      The commit that added this functionality:
      rL322957
      
      may be causing/exposing a miscompile in PR38648:
      https://bugs.llvm.org/show_bug.cgi?id=38648
      
      so allow enabling/disabling to make debugging easier.
      
      llvm-svn: 340540
      40aa8675
    • Kadir Cetinkaya's avatar
      [clangd] Check for include overlapping looks for only the line now. · 0d2e6251
      Kadir Cetinkaya authored
      Summary:
      Currently we match an include only if we are inside filename, with this patch we
      will match whenever we are on the starting line of the include.
      
      Reviewers: ilya-biryukov, hokein, ioeric
      
      Reviewed By: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D51163
      
      llvm-svn: 340539
      0d2e6251
    • David Bolvansky's avatar
      [InstCombine] Fold Select with binary op - FP opcodes · 43b0e258
      David Bolvansky authored
      Summary:
      Follow up for https://reviews.llvm.org/rL339520 and https://reviews.llvm.org/rL338300
      
      Alive:
      
      ```
      %A = fcmp oeq float %x, 0.0
      %B = fadd nsz float %x, %z
      %C = select i1 %A, float %B, float %y
      =>
      %C = select i1 %A, float %z, float %y
      ----------                                                                      
        %A = fcmp oeq float %x, 0.0
        %B = fadd nsz float %x, %z
        %C = select %A, float %B, float %y
      =>
        %C = select %A, float %z, float %y
      
      Done: 1                                                                         
      Optimization is correct
      
      %A = fcmp une float %x, -0.0
      %B = fadd nsz float %x, %z
      %C = select i1 %A, float %y, float %B
      =>
      %C = select i1 %A, float %y, float %z
      ----------                                                                      
        %A = fcmp une float %x, -0.0
        %B = fadd nsz float %x, %z
        %C = select %A, float %y, float %B
      =>
        %C = select %A, float %y, float %z
      
      Done: 1                                                                         
      Optimization is correct
      ```
      
      
      Reviewers: spatel, lebedev.ri
      
      Reviewed By: spatel
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D50714
      
      llvm-svn: 340538
      43b0e258
    • Brian Homerding's avatar
      [FunctionAttrs] Infer WriteOnly Function Attribute · 3ecabd70
      Brian Homerding authored
      These changes expand the FunctionAttr logic in order to mark functions as
      WriteOnly when appropriate. This is done through an additional bool variable
      and extended logic.
      
      Reviewers: hfinkel, jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D48387
      
      llvm-svn: 340537
      3ecabd70
    • Andrea Di Biagio's avatar
      [llvm-mca] Allow the definition of custom strategies for selecting processor resource units. · 1715efd7
      Andrea Di Biagio authored
      With this patch, users can now customize the pipeline selection strategy for
      scheduler resources. The resource selection strategy can be defined at processor
      resource granularity. This enables the definition of different strategies for
      different hardware schedulers.
      
      To override the strategy associated with a processor resource, users can call
      method ResourceManager::setCustomStrategy(), and pass a 'ResourceStrategy'
      object in input.
      
      Class ResourceStrategy is an abstract class which declares virtual method
      `ResourceStrategy::select()`. Method select() is meant to implement the actual
      strategy; it is responsible for picking the next best resource from a set of
      available pipeline resources.  Custom strategy must simply override that method.
      
      By default, processor resources are associated with instances of
      'DefaultResourceStrategy'.  A 'DefaultResourceStrategy' internally implements a
      simple round-robin selector. For more details, please refer to the code comments
      in Scheduler.h.
      
      llvm-svn: 340536
      1715efd7
    • Mikhail R. Gadelha's avatar
      [analyzer] added cache for SMT queries in the SMTConstraintManager · 9fa662b2
      Mikhail R. Gadelha authored
      Summary:
      This patch implements a new cache for the result of SMT queries; with this patch the regression tests are 25% faster.
      
      It's implemented as a `llvm::DenseMap` where the key is the hash of the set of the constraints in a state.
      
      There is still one method that does not use the cache, `getSymVal`, because it needs to get a symbol interpretation from the SMT, which is not cached yet.
      
      Reviewers: NoQ, george.karpenkov
      
      Reviewed By: george.karpenkov
      
      Subscribers: xazax.hun, szepet, a.sidorin, Szelethus
      
      Differential Revision: https://reviews.llvm.org/D50773
      
      llvm-svn: 340535
      9fa662b2
    • Mikhail R. Gadelha's avatar
      [analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. NFC. · 766a189d
      Mikhail R. Gadelha authored
      Summary:
      With this patch, the SMT backend is almost completely detached from the CSA.
      
      Unfortunate consequence is that we missed the `ConditionTruthVal` from the CSA and had to use `Optional<bool>`.
      
      The Z3 solver implementation is still in the same file as the `Z3ConstraintManager`, in `lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp` though, but except for that, the SMT API can be moved to anywhere in the codebase.
      
      Reviewers: NoQ, george.karpenkov
      
      Reviewed By: george.karpenkov
      
      Subscribers: xazax.hun, szepet, a.sidorin, Szelethus
      
      Differential Revision: https://reviews.llvm.org/D50772
      
      llvm-svn: 340534
      766a189d
    • Mikhail R. Gadelha's avatar
      [analyzer] Templatefy SMTConstraintManager so more generic code can be moved... · b0670d34
      Mikhail R. Gadelha authored
      [analyzer] Templatefy SMTConstraintManager so more generic code can be moved from solver specific implementations. NFC.
      
      Summary:
      By making SMTConstraintManager a template and passing the SMT constraint type and expr, we can further move code from the Z3ConstraintManager class to the generic SMT constraint Manager.
      
      Now, each SMT specific constraint manager only needs to implement the method `bool canReasonAbout(SVal X) const`.
      
      Reviewers: NoQ, george.karpenkov
      
      Reviewed By: george.karpenkov
      
      Subscribers: mgorny, xazax.hun, szepet, a.sidorin, Szelethus
      
      Differential Revision: https://reviews.llvm.org/D50770
      
      llvm-svn: 340533
      b0670d34
    • Mikhail R. Gadelha's avatar
      [analyzer] Delete SMTContext. NFC. · 2420ee9b
      Mikhail R. Gadelha authored
      Summary: There is no reason to have a base class for a context anymore as each SMT object carries a reference to the specific solver context.
      
      Reviewers: NoQ, george.karpenkov, hiraditya
      
      Reviewed By: hiraditya
      
      Subscribers: hiraditya, xazax.hun, szepet, a.sidorin, Szelethus
      
      Differential Revision: https://reviews.llvm.org/D50768
      
      llvm-svn: 340532
      2420ee9b
    • Mikael Holmen's avatar
      Change dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC] · b4a7546c
      Mikael Holmen authored
      The result of the dyn_cast wasn't used to we can just check isa.
      
      llvm-svn: 340531
      b4a7546c
    • Kadir Cetinkaya's avatar
      [clangd] Suggest code-completions for overriding base class virtual methods. · f8b85a3d
      Kadir Cetinkaya authored
      Summary:
      Whenever a code-completion is triggered within a class/struct/union looks at
      base classes and figures out non-overriden virtual functions. Than suggests
      completions for those.
      
      Reviewers: ilya-biryukov, hokein, ioeric
      
      Reviewed By: hokein
      
      Subscribers: MaskRay, jkorous, arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D50898
      
      llvm-svn: 340530
      f8b85a3d
    • John Brawn's avatar
      [GVN] Invalidate cached info for phis when setting dead predecessors to undef · 23cbf09f
      John Brawn authored
      When GVN sets the incoming value for a phi to undef because the incoming block
      is unreachable it needs to also invalidate the cached info for that phi in
      MemoryDependenceAnalysis, otherwise later queries will return stale information.
      
      Differential Revision: https://reviews.llvm.org/D51099
      
      llvm-svn: 340529
      23cbf09f
    • Victor Leschuk's avatar
      [DWARF] Unify warning callbacks. NFC. · cf1f714d
      Victor Leschuk authored
      Both DWARFDebugLine and DWARFDebugAddr used the same callback mechanism
      for handling recoverable errors. They both implemented similar warn() function
      to be used as such callbacks.
      
      In this revision we get rid of code duplication and move this warn() function
      to DWARFContext as DWARFContext::dumpWarning().
      
      Reviewers: lhames, jhenderson, aprantl, probinson, dblaikie, JDevlieghere
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D51033
      
      llvm-svn: 340528
      cf1f714d
    • Kadir Cetinkaya's avatar
      [clangd] Move function argument snippet disable mechanism from LSP rendering... · 516fcdac
      Kadir Cetinkaya authored
      [clangd] Move function argument snippet disable mechanism from LSP rendering to internal clangd reprensentation.
      
      Summary:
      We were handling the EnableFunctionArgSnippets only when we are producing LSP
      response. Move that code into CompletionItem generation so that internal clients
      can benefit from that as well.
      
      Reviewers: ilya-biryukov, ioeric, hokein
      
      Reviewed By: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D51102
      
      llvm-svn: 340527
      516fcdac
    • Florian Hahn's avatar
      [SCCP] Remove unused variable added in r340525. · 17e7ace5
      Florian Hahn authored
      llvm-svn: 340526
      17e7ace5
    • Florian Hahn's avatar
      Recommit r333268: [IPSCCP] Use PredicateInfo to propagate facts from cmp instructions. · 3052290d
      Florian Hahn authored
      This version of the patch fixes cleaning up ssa_copy intrinsics, so it does not
      crash for instructions in blocks that have been marked unreachable.
      
      This patch updates IPSCCP to use PredicateInfo to propagate
      facts to true branches predicated by EQ and to false branches
      predicated by NE.
      
      As a follow up, we should be able to extend it to also propagate additional
      facts about nonnull.
      
      Reviewers: davide, mssimpso, dberlin, efriedma
      
      Reviewed By: davide, dberlin
      
      Differential Revision: https://reviews.llvm.org/D45330
      
      llvm-svn: 340525
      3052290d
    • Mikael Holmen's avatar
      Removed unused variable [NFC] · 9f356dde
      Mikael Holmen authored
      The compiler warned:
      ../tools/clang/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp:329:19: error: unused variable 'MD' [-Werror,-Wunused-variable]
        if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
                        ^
      1 error generated.
      
      llvm-svn: 340524
      9f356dde
    • Ilya Biryukov's avatar
      [clangd] Increase the timeouts in TUScheduler tests to 10 seconds. · 1326145f
      Ilya Biryukov authored
      Some of them timeout on our buildbots in certain configurations.
      The timeouts are there to avoid hanging indefinitely on deadlocks, so
      the exact number we put there does not matter.
      
      llvm-svn: 340523
      1326145f
    • Alexander Richardson's avatar
      Update avr attributes test for output change in r340519 · 6cdd12a3
      Alexander Richardson authored
      After this commit there is an addrspace(1) before the attribute #. Since
      these tests are only checking the value of the attribute add a {{.*}} to
      make the test resilient to future output changes.
      
      llvm-svn: 340522
      6cdd12a3
    • Ivan Donchevskii's avatar
      [libclang] Fix cursors for arguments of Subscript and Call operators · b3ae2bc6
      Ivan Donchevskii authored
      The DeclRefExpr of CXXOperatorCallExpr refering to the custom operator
      is visited before the arguments to the operator call. For the Call and
      Subscript operator the range of this DeclRefExpr includes the whole call
      expression, so that all tokens in that range were mapped to the operator
      function, even the tokens of the arguments.
      
      Fix this by ensuring that this particular DeclRefExpr is visited last.
      
      Fixes PR25775.
      
      Fix by Nikolai Kosjar.
      
      Differential Revision: https://reviews.llvm.org/D40481
      
      llvm-svn: 340521
      b3ae2bc6
    • Sven van Haastregt's avatar
      [Support] Fix some Wundef warnings · 0dfbf6b6
      Sven van Haastregt authored
      For the _WIN32 macro, it is the definedness that matters rather than
      the value.  Most uses of the macro already rely on the definedness.
      This commit fixes the few remaining uses that relied on the value.
      
      Differential Revision: https://reviews.llvm.org/D51105
      
      llvm-svn: 340520
      0dfbf6b6
    • Alexander Richardson's avatar
      Allow creating llvm::Function in non-zero address spaces · 6bcf2ba2
      Alexander Richardson authored
      Most users won't have to worry about this as all of the
      'getOrInsertFunction' functions on Module will default to the program
      address space.
      
      An overload has been added to Function::Create to abstract away the
      details for most callers.
      
      This is based on https://reviews.llvm.org/D37054 but without the changes to
      make passing a Module to Function::Create() mandatory. I have also added
      some more tests and fixed the LLParser to accept call instructions for
      types in the program address space.
      
      Reviewed By: bjope
      
      Differential Revision: https://reviews.llvm.org/D47541
      
      llvm-svn: 340519
      6bcf2ba2
    • Nicolai Haehnle's avatar
      TableGen/SearchableTables: Cast enums to unsigned in generated code · ba9eee5f
      Nicolai Haehnle authored
      Summary:
      This should fix signedness warnings when compiling with MSVC.
      
      Change-Id: I4664cce0ba91e9b42d21a86fd4a7e82f2320c451
      
      Reviewers: RKSimon
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D51097
      
      llvm-svn: 340518
      ba9eee5f
    • Vitaly Buka's avatar
      Fix comparison of char and int64 in TestWriteFixNegativeInt · daab25b8
      Vitaly Buka authored
      It was broken on clang-ppc64le-linux-lnt bot.
      
      llvm-svn: 340517
      daab25b8
    • Peter Collingbourne's avatar
      Initialize the address-significance table fragment's layout order. · 6579c812
      Peter Collingbourne authored
      This fragment is created after layout, which is where the order
      normally gets set.
      
      Should fix a test failure under msan.
      
      llvm-svn: 340516
      6579c812
    • Chandler Carruth's avatar
      [x86/retpoline] Split the LLVM concept of retpolines into separate · ae0cafec
      Chandler Carruth authored
      subtarget features for indirect calls and indirect branches.
      
      This is in preparation for enabling *only* the call retpolines when
      using speculative load hardening.
      
      I've continued to use subtarget features for now as they continue to
      seem the best fit given the lack of other retpoline like constructs so
      far.
      
      The LLVM side is pretty simple. I'd like to eventually get rid of the
      old feature, but not sure what backwards compatibility issues that will
      cause.
      
      This does remove the "implies" from requesting an external thunk. This
      always seemed somewhat questionable and is now clearly not desirable --
      you specify a thunk the same way no matter which set of things are
      getting retpolines.
      
      I really want to keep this nicely isolated from end users and just an
      LLVM implementation detail, so I've moved the `-mretpoline` flag in
      Clang to no longer rely on a specific subtarget feature by that name and
      instead to be directly handled. In some ways this is simpler, but in
      order to preserve existing behavior I've had to add some fallback code
      so that users who relied on merely passing -mretpoline-external-thunk
      continue to get the same behavior. We should eventually remove this
      I suspect (we have never tested that it works!) but I've not done that
      in this patch.
      
      Differential Revision: https://reviews.llvm.org/D51150
      
      llvm-svn: 340515
      ae0cafec
    • Peter Collingbourne's avatar
      MC: Don't align COFF section contents. · a67161ff
      Peter Collingbourne authored
      Aligning section contents is not required, but only
      recommended, by the specification. Microsoft's documentation says
      (https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#section-table-section-headers):
      "For object files, the value should be aligned on a 4-byte boundary
      for best performance."
      
      However, according to my measurements, aligning section contents has
      a neutral to negative effect on performance.
      
      I measured the median run time of 100 links of Chromium's
      base_unittests on Linux with lld-link and on Windows with link.exe with
      both aligned and unaligned sections. On Linux I didn't see a measurable
      performance difference, and on Windows the link was slightly faster
      with unaligned sections (presumably because on Windows the bottleneck
      is I/O).
      
      Also, the sections created by cl.exe are unaligned, so we should expect
      tools to broadly accept unaligned sections.
      
      Differential Revision: https://reviews.llvm.org/D51149
      
      llvm-svn: 340514
      a67161ff
    • Chandler Carruth's avatar
      Revert r340508: [DebugInfo] Fix bug in LiveDebugVariables. · 8505dcf7
      Chandler Carruth authored
      This patch's test case relies on debug prints which isn't generally an
      OK way to test stuff in LLVM and fails whenever asserts aren't enabled.
      I've send a heads-up to the commit and detailed comments on the review.
      
      llvm-svn: 340513
      8505dcf7
    • David Bolvansky's avatar
      [LibCalls] Added returned attribute to libcalls · 8715e034
      David Bolvansky authored
      Reviewers: efriedma
      
      Reviewed By: efriedma
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D51092
      
      llvm-svn: 340512
      8715e034
    • JF Bastien's avatar
      Missing quote in previous commit · 20598b05
      JF Bastien authored
      The test was failing because I missed a quote.
      
      llvm-svn: 340511
      20598b05
    • JF Bastien's avatar
      Improve incompatible triple error · 4734fa14
      JF Bastien authored
      When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching.
      
      llvm-svn: 340510
      4734fa14
    • JF Bastien's avatar
      Improve incompatible triple error · a1cca516
      JF Bastien authored
      When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching.
      
      llvm-svn: 340509
      a1cca516
    • Hsiangkai Wang's avatar
      [DebugInfo] Fix bug in LiveDebugVariables. · 97edcbc4
      Hsiangkai Wang authored
      In lib/CodeGen/LiveDebugVariables.cpp, it uses std::prev(MBBI) to
      get DebugValue's SlotIndex. However, the previous instruction may be
      also a debug instruction. It could not use a debug instruction to query
      SlotIndex in mi2iMap.
      
      Scan all debug instructions and use the first debug instruction to query
      SlotIndex for following debug instructions. Only handle DBG_VALUE in
      handleDebugValue().
      
      Differential Revision: https://reviews.llvm.org/D50621
      
      llvm-svn: 340508
      97edcbc4
    • Scott Linder's avatar
      Fix undefined behavior in r340457 · a755f4d1
      Scott Linder authored
      llvm-svn: 340507
      a755f4d1
    • David Blaikie's avatar
      Add new .def file introduced for BinaryFormat/MsgPack · 560e1ed3
      David Blaikie authored
      Patch by Kristina Brooks!
      
      llvm-svn: 340506
      560e1ed3
    • Thomas Lively's avatar
      [WebAssembly] SIMD Bitwise binary arithmetic · c1742570
      Thomas Lively authored
      Summary: AND, OR, and XOR. This CL depends on D51113.
      
      Reviewers: aheejin, dschuff
      
      Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D51136
      
      llvm-svn: 340505
      c1742570