1. Nov 01, 2018
    • Jonas Toth's avatar
      [clang-tidy] new check 'readability-isolate-declaration' · 0ea5af7a
      Jonas Toth authored
      Summary:
      This patch introduces a new clang-tidy check that matches on all `declStmt` that declare more then one variable
      and transform them into one statement per declaration if possible.
      
      It currently only focusses on variable declarations but should be extended to cover more kinds of declarations in the future.
      It is related to https://reviews.llvm.org/D27621 and does use it's extensive test-suite. Thank you to firolino for his work!
      
      Reviewers: rsmith, aaron.ballman, alexfh, hokein, kbobyrev
      
      Reviewed By: aaron.ballman
      
      Subscribers: ZaMaZaN4iK, mgehre, nemanjai, kbarton, lebedev.ri, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
      
      Tags: #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D51949
      
      llvm-svn: 345735
      0ea5af7a
    • Sanjay Patel's avatar
      [InstCombine] refactor fabs+fcmp fold; NFC · 1c254c67
      Sanjay Patel authored
      Also, remove/replace/minimize/enhance the tests for this fold.
      The code drops FMF, so it needs more tests and at least 1 fix.
      
      llvm-svn: 345734
      1c254c67
    • George Rimar's avatar
      [LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC. · 0f46e34f
      George Rimar authored
      This is NFC to clean up the `DWARFFormValue::ExtractValue`.
      It groups similar `DW_FORM_*` and removes an excessive
      assignment of `ref_addr_size` (it was assigned right after in any case).
      
      llvm-svn: 345733
      0f46e34f
  2. Oct 31, 2018
    • Krzysztof Parzyszek's avatar
      [Hexagon] Make sure not to use GP-relative addressing with PIC · 977a1fe5
      Krzysztof Parzyszek authored
      Make sure that -relocation-model=pic prevents use of GP-relative
      addressing modes.
      
      llvm-svn: 345731
      977a1fe5
    • Andrea Di Biagio's avatar
      52578ac6
    • Kadir Cetinkaya's avatar
      Delete dependency on config.h · 8e422d67
      Kadir Cetinkaya authored
      Summary:
      Since llvm/Config/config.h is not available on standalone builds,
      use __USE_POSIX instead of HAVE_PTHREAD_H and get rid of the include.
      
      Reviewers: sammccall
      
      Reviewed By: sammccall
      
      Subscribers: lebedev.ri, krytarowski, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D53935
      
      llvm-svn: 345729
      8e422d67
    • Sanjay Patel's avatar
      [InstSimplify] fold 'fcmp nnan ult X, 0.0' when X is not negative · d4dc30c2
      Sanjay Patel authored
      This is the inverted case for the transform added with D53874 / rL345725.
      
      llvm-svn: 345728
      d4dc30c2
    • Sanjay Patel's avatar
      [InstCombine] add assertion that InstSimplify has folded a fabs+fcmp; NFC · b9fe3fbb
      Sanjay Patel authored
      The 'OLT' case was updated at rL266175, so I assume it was just an
      oversight that 'UGE' was not included because that patch handled
      both predicates in InstSimplify.
      
      llvm-svn: 345727
      b9fe3fbb
    • Kamil Rytarowski's avatar
      Update ioctl(2) operations for NetBSD 8.99.25 · 84484609
      Kamil Rytarowski authored
      Eliminate dropped operations, add new operations.
      
      Update included headers for newer need.
      
      Add a fallback definition of nvlist_ref_t, becaue this type
      is internal to libnpf and the kernel, not exported into public
      headers.
      
      llvm-svn: 345726
      84484609
    • Sanjay Patel's avatar
      [InstSimplify] fold 'fcmp nnan oge X, 0.0' when X is not negative · 85cba3b6
      Sanjay Patel authored
      This re-raises some of the open questions about how to apply and use fast-math-flags in IR from PR38086:
      https://bugs.llvm.org/show_bug.cgi?id=38086
      ...but given the current implementation (no FMF on casts), this is likely the only way to predicate the 
      transform.
      
      This is part of solving PR39475:
      https://bugs.llvm.org/show_bug.cgi?id=39475
      
      Differential Revision: https://reviews.llvm.org/D53874
      
      llvm-svn: 345725
      85cba3b6
    • Kristof Umann's avatar
      [analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag · 7d6d9eb6
      Kristof Umann authored
      This is the first part of the implementation of the inclusion of macro
      expansions into the plist output. It adds a new flag that adds a new
      "macro_expansions" entry to each report that has PathDiagnosticPieces that were
      expanded from a macro. While there's an entry for each macro expansion, both
      the name of the macro and what it expands to is missing, and will be implemented
      in followup patches.
      
      Differential Revision: https://reviews.llvm.org/D52742
      
      llvm-svn: 345724
      7d6d9eb6
    • Fedor Sergeev's avatar
      [LoopUnroll] allow customization for new-pass-manager version of LoopUnroll · 412ed347
      Fedor Sergeev authored
      Unlike its legacy counterpart new pass manager's LoopUnrollPass does
      not provide any means to select which flavors of unroll to run
      (runtime, peeling, partial), relying on global defaults.
      
      In some cases having ability to run a restricted LoopUnroll that
      does more than LoopFullUnroll is needed.
      
      Introduced LoopUnrollOptions to select optional unroll behaviors.
      Added 'unroll<peeling>' to PassRegistry mainly for the sake of testing.
      
      Reviewers: chandlerc, tejohnson
      Differential Revision: https://reviews.llvm.org/D53440
      
      llvm-svn: 345723
      412ed347
    • Sanjay Patel's avatar
      [InstSimplify] add tests for fcmp and known positive; NFC · 1cd9917e
      Sanjay Patel authored
      llvm-svn: 345722
      1cd9917e
    • David Bolvansky's avatar
      [DAGCombiner] Fold 0 div/rem X to 0 · d0080c3a
      David Bolvansky authored
      Reviewers: RKSimon, spatel, javed.absar, craig.topper, t.p.northover
      
      Reviewed By: RKSimon
      
      Subscribers: craig.topper, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D52504
      
      llvm-svn: 345721
      d0080c3a
    • George Rimar's avatar
      [LLDB] - Removed unused variable. NFC. · 103a0559
      George Rimar authored
      Introduced in r344119.
      
      Thanks to Dávid Bolvanský fo reporting.
      
      llvm-svn: 345720
      103a0559
    • Nicolai Haehnle's avatar
      AMDGPU: Rewrite SILowerI1Copies to always stay on SALU · 814abb59
      Nicolai Haehnle authored
      Summary:
      Instead of writing boolean values temporarily into 32-bit VGPRs
      if they are involved in PHIs or are observed from outside a loop,
      we use bitwise masking operations to combine lane masks in a way
      that is consistent with wave control flow.
      
      Move SIFixSGPRCopies to before this pass, since that pass
      incorrectly attempts to move SGPR phis to VGPRs.
      
      This should recover most of the code quality that was lost with
      the bug fix in "AMDGPU: Remove PHI loop condition optimization".
      
      There are still some relevant cases where code quality could be
      improved, in particular:
      
      - We often introduce redundant masks with EXEC. Ideally, we'd
        have a generic computeKnownBits-like analysis to determine
        whether masks are already masked by EXEC, so we can avoid this
        masking both here and when lowering uniform control flow.
      
      - The criterion we use to determine whether a def is observed
        from outside a loop is conservative: it doesn't check whether
        (loop) branch conditions are uniform.
      
      Change-Id: Ibabdb373a7510e426b90deef00f5e16c5d56e64b
      
      Reviewers: arsenm, rampitec, tpr
      
      Subscribers: kzhuravl, jvesely, wdng, mgorny, yaxunl, dstuttard, t-tye, eraman, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D53496
      
      llvm-svn: 345719
      814abb59
    • Nicolai Haehnle's avatar
      AMDGPU: Remove PHI loop condition optimization · 28212cc6
      Nicolai Haehnle authored
      
      
      Summary:
      The optimization to early break out of loops if all threads are dead was
      never fully implemented.
      
      But the PHI node analyzing is actually causing a number of problems, so
      remove all the extra code for it.
      
      (This does actually regress code quality in a few places because it
       ends up relying more heavily on phi's of i1, which we don't do a
       great job with. However, since it fixes real bugs in the wild, we
       should take this change. I have some prototype changes to improve
       i1 lowering in general -- not just for control flow -- which should
       help recover the code quality, I just need to make those changes
       fit for general consumption. -- Nicolai)
      
      Change-Id: I6fc6c6c8961857ac6009fcfb9f7e5e48dc23fbb1
      Patch-by: default avatarChristian König <christian.koenig@amd.com>
      
      Reviewers: arsenm, rampitec, tpr
      
      Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D53359
      
      llvm-svn: 345718
      28212cc6
    • Sanjay Patel's avatar
      [InstSimplify] fold icmp based on range of abs/nabs · 2efccd2c
      Sanjay Patel authored
      This is a fix for PR39475:
      https://bugs.llvm.org/show_bug.cgi?id=39475
      
      We managed to get some of these patterns using computeKnownBits in D47041, but that 
      can't be used for nabs(). Instead, put in some range-based logic, so we can fold 
      both abs/nabs with icmp with a constant value.
      
      Alive proofs:
      https://rise4fun.com/Alive/21r
      
      Name: abs_nsw_is_positive
        %cmp = icmp slt i32 %x, 0
        %negx = sub nsw i32 0, %x
        %abs = select i1 %cmp, i32 %negx, i32 %x
        %r = icmp sgt i32 %abs, -1
          =>
        %r = i1 true
       
      Name: abs_nsw_is_not_negative
        %cmp = icmp slt i32 %x, 0
        %negx = sub nsw i32 0, %x
        %abs = select i1 %cmp, i32 %negx, i32 %x
        %r = icmp slt i32 %abs, 0
          =>
        %r = i1 false
       
      Name: nabs_is_negative_or_0
        %cmp = icmp slt i32 %x, 0
        %negx = sub i32 0, %x
        %nabs = select i1 %cmp, i32 %x, i32 %negx
        %r = icmp slt i32 %nabs, 1
          =>
        %r = i1 true
      
      Name: nabs_is_not_over_0
        %cmp = icmp slt i32 %x, 0
        %negx = sub i32 0, %x
        %nabs = select i1 %cmp, i32 %x, i32 %negx
        %r = icmp sgt i32 %nabs, 0
          =>
        %r = i1 false
      
      Differential Revision: https://reviews.llvm.org/D53844
      
      llvm-svn: 345717
      2efccd2c
    • Sam McCall's avatar
      [clang-tidy] Remove false decoupling in ClangTidyContext. NFC · dd2120c0
      Sam McCall authored
      These getters/setters don't encapsulate any behavior, and can only be
      called by friends.
      
      llvm-svn: 345716
      dd2120c0
    • Kamil Rytarowski's avatar
      Update generate_netbsd_ioctls.awk for NetBSD 8.99.25 · ec37188a
      Kamil Rytarowski authored
      Add dynamic detection of header files in /usr/include.
      Handle "nvlist_ref_t" needed by npf(4) ioctl(2) operations.
      
      llvm-svn: 345715
      ec37188a
    • Andrea Di Biagio's avatar
      [tblgen][PredicateExpander] Add the ability to describe more complex... · 3d2b7176
      Andrea Di Biagio authored
      [tblgen][PredicateExpander] Add the ability to describe more complex constraints on instruction operands.
      
      Before this patch, class PredicateExpander only knew how to expand simple
      predicates that performed checks on instruction operands.
      In particular, the new scheduling predicate syntax was not rich enough to
      express checks like this one:
      
        Foo(MI->getOperand(0).getImm()) == ExpectedVal;
      
      Here, the immediate operand value at index zero is passed in input to function
      Foo, and ExpectedVal is compared against the value returned by function Foo.
      
      While this predicate pattern doesn't show up in any X86 model, it shows up in
      other upstream targets. So, being able to support those predicates is
      fundamental if we want to be able to modernize all the scheduling models
      upstream.
      
      With this patch, we allow users to specify if a register/immediate operand value
      needs to be passed in input to a function as part of the predicate check. Now,
      register/immediate operand checks all derive from base class CheckOperandBase.
      
      This patch also changes where TIIPredicate definitions are expanded by the
      instructon info emitter. Before, definitions were expanded in class
      XXXGenInstrInfo (where XXX is a target name).
      With the introduction of this new syntax, we may want to have TIIPredicates
      expanded directly in XXXInstrInfo. That is because functions used by the new
      operand predicates may only exist in the derived class (i.e. XXXInstrInfo).
      
      This patch is a non functional change for the existing scheduling models.
      In future, we will be able to use this richer syntax to better describe complex
      scheduling predicates, and expose them to llvm-mca.
      
      Differential Revision: https://reviews.llvm.org/D53880
      
      llvm-svn: 345714
      3d2b7176
    • Max Kazantsev's avatar
      [NFC] Add tests for loop-simplifycfg for further development · ea35455d
      Max Kazantsev authored
      llvm-svn: 345713
      ea35455d
    • Florian Hahn's avatar
      [ADT] Remove illegal comparison of singular iterators from SmallSetTest · 60243ca4
      Florian Hahn authored
      This removes the assertion that a copy of a moved-from SmallSetIterator
      equals the original, which is illegal due to SmallSetIterator including
      an instance of a standard `std::set` iterator.
      
      C++ [iterator.requirements.general] states that comparing singular
      iterators has undefined result:
      
      > Iterators can also have singular values that are not associated with
      > any sequence. [...] Results of most expressions are undefined for
      > singular values; the only exceptions are destroying an iterator that
      > holds a singular value, the assignment of a non-singular value to an
      > iterator that holds a singular value, and, for iterators that satisfy
      > the Cpp17DefaultConstructible requirements, using a value-initialized
      > iterator as the source of a copy or move operation.
      
      This assertion triggers the following error in the GNU C++ Library in
      debug mode under EXPENSIVE_CHECKS:
      
        /usr/include/c++/8.2.1/debug/safe_iterator.h:518:
        Error: attempt to compare a singular iterator to a singular iterator.
      
        Objects involved in the operation:
            iterator "lhs" @ 0x0x7fff86420670 {
              state = singular;
            }
            iterator "rhs" @ 0x0x7fff86420640 {
              state = singular;
            }
      
      Patch by Eugene Sharygin.
      
      Reviewers: fhahn, dblaikie, chandlerc
      
      Reviewed By: fhahn, dblaikie
      
      Differential Revision: https://reviews.llvm.org/D53793
      
      llvm-svn: 345712
      60243ca4
    • Shoaib Meenai's avatar
      [lldb] Fix race condition in framework installation · 67a633a7
      Shoaib Meenai authored
      We need the install-liblldb-stripped target to depend on the
      lldb-framework target in order for the installation to be guaranteed to
      behave correctly, otherwise it's possible for the lldb-framework and
      install-liblldb-stripped targets to run in parallel, resulting in
      temporary or partially processed files being copied into the framework.
      install-liblldb already depends on lldb-framework for this reason.
      
      Differential Revision: https://reviews.llvm.org/D53917
      
      llvm-svn: 345711
      67a633a7
    • Neil Henning's avatar
      [AMDGPU] support image load/store a16 · 63718b21
      Neil Henning authored
      Our a16 support was only enabled for sample/gather and buffer
      load/store, but not for image load/store operations (which take an i16
      as the pixel index rather than a half).
      
      Fix our isel lowering and add test cases to prove it out.
      
      Differential Revision: https://reviews.llvm.org/D53750
      
      llvm-svn: 345710
      63718b21
    • Hans Wennborg's avatar
      Follow-up to r345699: Call CheckStaticLocalForDllExport later for templates · 262baa47
      Hans Wennborg authored
      Calling it too early might cause dllimport to get inherited onto the
      VarDecl before the initializer got attached. See the test case for an
      example where this broke things.
      
      llvm-svn: 345709
      262baa47
    • Max Kazantsev's avatar
      [IndVars] Strengthen restricton in rewriteLoopExitValues · 541f824d
      Max Kazantsev authored
      For some unclear reason rewriteLoopExitValues considers recalculation
      after the loop profitable if it has some "soft uses" outside the loop (i.e. any
      use other than call and return), even if we have proved that it has a user inside
      the loop which we think will not be optimized away.
      
      There is no existing unit test that would explain this. This patch provides an
      example when rematerialisation of exit value is not profitable but it passes
      this check due to presence of a "soft use" outside the loop.
      
      It makes no sense to recalculate value on exit if we are going to compute it
      due to some irremovable within the loop. This patch disallows applying this
      transform in the described situation.
      
      Differential Revision: https://reviews.llvm.org/D51581
      Reviewed By: etherzhhb
      
      llvm-svn: 345708
      541f824d
    • Kamil Rytarowski's avatar
      Diable test suppressions-library for NetBSD/i386 · 3d2ab50d
      Kamil Rytarowski authored
      This is a part of the ASan test-suite.
      
      llvm-svn: 345707
      3d2ab50d
    • George Rimar's avatar
      [LLDB] - Add support for DW_FORM_addrx[1-4]? forms. · c3e5dec0
      George Rimar authored
      This adds the support for DW_FORM_addrx, DW_FORM_addrx1, 
      DW_FORM_addrx2, DW_FORM_addrx3, DW_FORM_addrx4 forms.
      
      Differential revision: https://reviews.llvm.org/D53813
      
      llvm-svn: 345706
      c3e5dec0
    • Dorit Nuzman's avatar
      [LV] Support vectorization of interleave-groups that require an epilog under · 34da6dd6
      Dorit Nuzman authored
      optsize using masked wide loads 
      
      Under Opt for Size, the vectorizer does not vectorize interleave-groups that
      have gaps at the end of the group (such as a loop that reads only the even
      elements: a[2*i]) because that implies that we'll require a scalar epilogue
      (which is not allowed under Opt for Size). This patch extends the support for
      masked-interleave-groups (introduced by D53011 for conditional accesses) to
      also cover the case of gaps in a group of loads; Targets that enable the
      masked-interleave-group feature don't have to invalidate interleave-groups of
      loads with gaps; they could now use masked wide-loads and shuffles (if that's
      what the cost model selects).
      
      Reviewers: Ayal, hsaito, dcaballe, fhahn
      
      Reviewed By: Ayal
      
      Differential Revision: https://reviews.llvm.org/D53668
      
      llvm-svn: 345705
      34da6dd6
    • Kristina Brooks's avatar
      [llvm-objdump] Mark syms/t flags as NotHidden. NFC. · 889356eb
      Kristina Brooks authored
      Slight improvement to help output of llvm-objdump that exposes the
      shorter -t flag for -syms instead of it being hidden away.
      
      llvm-svn: 345704
      889356eb
    • Kristina Brooks's avatar
      [llvm-objdump] Add --reloc alias for -r (PR39407) · 31579e9d
      Kristina Brooks authored
      This addresses PR39407 (https://bugs.llvm.org/show_bug.cgi?id=39407)
      improving compatibility with GNU binutils counterparts.
      
      Reviewed By: kristina
      
      Patch by Higuoxing (Xing).
      
      Differential Revision: https://reviews.llvm.org/D53804
      
      llvm-svn: 345703
      31579e9d
    • Alexander Potapenko's avatar
      [MSan] another take at instrumenting inline assembly - now with calls · c1c4c9a4
      Alexander Potapenko authored
      Turns out it's not always possible to figure out whether an asm()
      statement argument points to a valid memory region.
      One example would be per-CPU objects in the Linux kernel, for which the
      addresses are calculated using the FS register and a small offset in the
      .data..percpu section.
      To avoid pulling all sorts of checks into the instrumentation, we replace
      actual checking/unpoisoning code with calls to
      msan_instrument_asm_load(ptr, size) and
      msan_instrument_asm_store(ptr, size) functions in the runtime.
      
      This patch doesn't implement the runtime hooks in compiler-rt, as there's
      been no demand in assembly instrumentation for userspace apps so far.
      
      llvm-svn: 345702
      c1c4c9a4
    • Sanjin Sijaric's avatar
      [ARM64] [Windows] Exception handling support in frame lowering · fadebc8a
      Sanjin Sijaric authored
      Emit pseudo instructions indicating unwind codes corresponding to each
      instruction inside the prologue/epilogue.  These are used by the MCLayer to
      populate the .xdata section.
      
      Differential Revision: https://reviews.llvm.org/D50288
      
      llvm-svn: 345701
      fadebc8a
    • David Carlier's avatar
      [clangd] fix non linux build · 13727da7
      David Carlier authored
      There is no SCHED_IDLE semantic equivalent in BSD systems.
      
      Reviewers: kadircet, sammccall
      
      Revieweed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D53922
      
      llvm-svn: 345700
      13727da7
    • Hans Wennborg's avatar
      [clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496) · 59f18f1b
      Hans Wennborg authored
      In the course of D51340, @takuto.ikuta discovered that Clang fails to put
      dllexport/import attributes on static locals during template instantiation.
      
      For regular functions, this happens in Sema::FinalizeDeclaration(), however for
      template instantiations we need to do something in or around
      TemplateDeclInstantiator::VisitVarDecl(). This patch does that, and extracts
      the code to a utility function.
      
      Differential Revision: https://reviews.llvm.org/D53870
      
      llvm-svn: 345699
      59f18f1b
    • Martin Storsjo's avatar
      [AArch64] Mark condition flags and x16/x17 as clobbered when calling __chkstk · 315357fa
      Martin Storsjo authored
      This is similar to SVN r311061 for ARM.
      
      Differential Revision: https://reviews.llvm.org/D53878
      
      llvm-svn: 345698
      315357fa
    • Kristina Brooks's avatar
      [llvm-objdump] support '--syms' as an alias of -t · 3baa5f79
      Kristina Brooks authored
      This adds support for '--syms' as an alias of '-t' for llvm-objdump,
      fixing PR39406 (https://bugs.llvm.org/show_bug.cgi?id=39406).
      
      Patch by Higuoxing (Xing).
      
      Differential Revision: https://reviews.llvm.org/D53803
      
      llvm-svn: 345697
      3baa5f79
    • Lang Hames's avatar
      [ORC] Fix hex printing of uint64_t values. · 91449355
      Lang Hames authored
      A plain "%x" format string will drop the high 32-bits. Use the PRIx64 macro
      instead.
      
      llvm-svn: 345696
      91449355
    • Bill Wendling's avatar
      Change "struct" to "class" to avoid warnings · 86d122ec
      Bill Wendling authored
      llvm-svn: 345695
      86d122ec