Skip to content
  1. Mar 18, 2017
  2. Mar 17, 2017
    • Duncan P. N. Exon Smith's avatar
      Modules: Cache PCMs in memory and avoid a use-after-free · 079c40e8
      Duncan P. N. Exon Smith authored
      Clang's internal build system for implicit modules uses lock files to
      ensure that after a process writes a PCM it will read the same one back
      in (without contention from other -cc1 commands).  Since PCMs are read
      from disk repeatedly while invalidating, building, and importing, the
      lock is not released quickly.  Furthermore, the LockFileManager is not
      robust in every environment.  Other -cc1 commands can stall until
      timeout (after about eight minutes).
      
      This commit changes the lock file from being necessary for correctness
      to a (possibly dubious) performance hack.  The remaining benefit is to
      reduce duplicate work in competing -cc1 commands which depend on the
      same module.  Follow-up commits will change the internal build system to
      continue after a timeout, and reduce the timeout.  Perhaps we should
      reconsider blocking at all.
      
      This also fixes a use-after-free, when one part of a compilation
      validates a PCM and starts using it, and another tries to swap out the
      PCM for something new.
      
      The PCMCache is a new type called MemoryBufferCache, which saves memory
      buffers based on their filename.  Its ownership is shared by the
      CompilerInstance and ModuleManager.
      
        - The ModuleManager stores PCMs there that it loads from disk, never
          touching the disk if the cache is hot.
      
        - When modules fail to validate, they're removed from the cache.
      
        - When a CompilerInstance is spawned to build a new module, each
          already-loaded PCM is assumed to be valid, and is frozen to avoid
          the use-after-free.
      
        - Any newly-built module is written directly to the cache to avoid the
          round-trip to the filesystem, making lock files unnecessary for
          correctness.
      
      Original patch by Manman Ren; most testcases by Adrian Prantl!
      
      llvm-svn: 298165
      079c40e8
    • Sanjay Patel's avatar
      [x86] regenerate checks; NFC · 77e6ebe7
      Sanjay Patel authored
      llvm-svn: 298164
      77e6ebe7
    • Evgeniy Stepanov's avatar
      Fix docs-llvm-html build. · 4d490de2
      Evgeniy Stepanov authored
      llvm-svn: 298163
      4d490de2
    • Jessica Paquette's avatar
      [Outliner] Add outliner for AArch64 · ea8cc09b
      Jessica Paquette authored
      This commit adds the necessary target hooks for outlining in AArch64. It also
      refactors the switch statement used in `getMemOpBaseRegImmOfsWidth` into a
      more general function, `getMemOpInfo`. This allows the outliner to share that
      code without copying and pasting it.
      
      The AArch64 outliner can be run using -mllvm -enable-machine-outliner, as with
      the X86-64 outliner.
      
      The test for this pass verifies that the outliner does, in fact outline
      functions, fixes up the stack accesses properly, and can correctly generate a
      tail call. In the future, this test should be replaced with a MIR test, so that
      we can properly test immediate offset overflows in fixed-up instructions.
      
      llvm-svn: 298162
      ea8cc09b
    • Eli Friedman's avatar
      [SCEV] Use const Loop *L instead of Loop *L. NFC · f7b060bd
      Eli Friedman authored
      Use const pointer in the trip count and trip multiple calculations.
      
      Patch by Huihui Zhang <huihuiz@codeaurora.org>
      
      llvm-svn: 298161
      f7b060bd
    • Davide Italiano's avatar
      [Sema] Unbreak GCC -Werror build (enum compare). · 3c6e5ead
      Davide Italiano authored
      llvm-svn: 298160
      3c6e5ead
    • Evgeniy Stepanov's avatar
      [asan] Fix dead stripping of globals on Linux (compiler-rt) · 79ee0c18
      Evgeniy Stepanov authored
      Runtime support for the new instrumentation of globals based on !associated, and a bunch of tests.
      
      Differential Revision: https://reviews.llvm.org/D30120
      
      llvm-svn: 298159
      79ee0c18
    • Evgeniy Stepanov's avatar
      [asan] Fix dead stripping of globals on Linux. · c5aa6b94
      Evgeniy Stepanov authored
      Use a combination of !associated, comdat, @llvm.compiler.used and
      custom sections to allow dead stripping of globals and their asan
      metadata. Sometimes.
      
      Currently this works on LLD, which supports SHF_LINK_ORDER with
      sh_link pointing to the associated section.
      
      This also works on BFD, which seems to treat comdats as
      all-or-nothing with respect to linker GC. There is a weird quirk
      where the "first" global in each link is never GC-ed because of the
      section symbols.
      
      At this moment it does not work on Gold (as in the globals are never
      stripped).
      
      Differential Revision: https://reviews.llvm.org/D30121
      
      llvm-svn: 298158
      c5aa6b94
    • Evgeniy Stepanov's avatar
      Add !associated metadata. · 51c962f7
      Evgeniy Stepanov authored
      This is an ELF-specific thing that adds SHF_LINK_ORDER to the global's section
      pointing to the metadata argument's section. The effect of that is a reverse dependency
      between sections for the linker GC.
      
      !associated does not change the behavior of global-dce. The global
      may also need to be added to llvm.compiler.used.
      
      Since SHF_LINK_ORDER is per-section, !associated effectively enables
      fdata-sections for the affected globals, the same as comdats do.
      
      Differential Revision: https://reviews.llvm.org/D29104
      
      llvm-svn: 298157
      51c962f7
    • Eli Friedman's avatar
      [SelectionDAG] Remove redundant stores more aggressively. · 46ddab38
      Eli Friedman authored
      Handle TokenFactors more aggressively in
      SDValue::reachesChainWithoutSideEffects.  This isn't really a
      very effective change anymore because of other changes to
      chain handling, but it's a cheap check, and the expanded
      comments are still useful.
      
      It might be possible to loosen the hasOneUse() requirement with a
      deeper analysis, but a naive implementation of that check would be
      expensive.
      
      Differential Revision: https://reviews.llvm.org/D29845
      
      llvm-svn: 298156
      46ddab38
    • Peter Collingbourne's avatar
      ELF: Change check(Expected<T>, const Twine &) to call toString instead of... · 5758b2e4
      Peter Collingbourne authored
      ELF: Change check(Expected<T>, const Twine &) to call toString instead of converting to an error code.
      
      llvm-svn: 298155
      5758b2e4
    • Evgeniy Stepanov's avatar
      [ELF] Restore GC handling of LINK_ORDER, C-named sections. · 4b78036b
      Evgeniy Stepanov authored
      __start_xxx symbol keeps section xxx alive only if it is not
      SHF_LINK_ORDER. Such sections can be used for user metadata, when
      __start_xxx is used to iterate over section contents at runtime, and
      the liveness is determined solely by the linked (associated) section.
      
      This was earlier implemented in r294592, and broken in r296723.
      
      Differential Revision: https://reviews.llvm.org/D30964
      
      llvm-svn: 298154
      4b78036b
    • Peter Collingbourne's avatar
    • Matthias Gehre's avatar
      Implement DR 373 "Lookup on namespace qualified name in using-directive" · dc01bb44
      Matthias Gehre authored
      Summary:
      3.4.6 [basic.lookup.udir] paragraph 1:
      In a using-directive or namespace-alias-definition, during the lookup for a namespace-name or for a name in a nested-name-specifier, only namespace names are considered.
      
      Reviewers: rsmith, aaron.ballman
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D30848
      
      llvm-svn: 298126
      dc01bb44
    • Matt Arsenault's avatar
      AMDGPU: Fix broken condition in hazard recognizer · 59ece95f
      Matt Arsenault authored
      Fixes bug 32248.
      
      llvm-svn: 298125
      59ece95f
    • Bob Haarman's avatar
      · f790f788
      Bob Haarman authored
      recommend using llvm-ar when finding undefined references and empty archives
      
      Summary:
      When we perform LTO builds with a version of ar that does not
      understand LLVM bitcode objects, we end up with undefined references,
      because our archive files do not list the bitcode symbols in their
      indices. The error messages do not make it clear what the real problem
      is. This change adds a note that points out the likely problem and
      solution. It is similar in spirit to r282633, but aims to avoid false
      positives by only triggering when we see both undefined references and
      archives without symbols in their indices.
      
      Fixes PR32281.
      
      Reviewers: davide, ruiu, tejohnson
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D31011
      
      llvm-svn: 298124
      f790f788
    • Tim Hammerquist's avatar
      allow for specification of compiler/lldb executables basename · f73c6c7e
      Tim Hammerquist authored
      llvm-svn: 298123
      f73c6c7e
    • Vassil Vassilev's avatar
      [coverity] Fix uninit variable. · c70a8f2d
      Vassil Vassilev authored
       
      Patch by John Harvey!
      
      llvm-svn: 298122
      c70a8f2d
    • Matt Arsenault's avatar
      AMDGPU: Fix handling of constant phi input loop conditions · e70d5dcf
      Matt Arsenault authored
      If the loop condition was an i1 phi with a constantexpr input, this
      would add a loop intrinsic fed by a phi dependent on a call to
      if.break in the same block. Insert the call in the loop header.
      
      llvm-svn: 298121
      e70d5dcf
    • Rong Xu's avatar
      [PGO] Change the internal options description. nfc. · 8e06e80b
      Rong Xu authored
      llvm-svn: 298120
      8e06e80b
    • Matt Arsenault's avatar
      AMDGPU: Cleanup control flow intrinsics · c5b641ac
      Matt Arsenault authored
      Move backend internal intrinsics along with the rest of the
      normal intrinsics, and use the Intrinsic::getDeclaration
      API instead of manually constructing the type list.
      
      It's surprising this was working before. fdiv.fast had
      the wrong number of parameters. The control flow intrinsic
      declaration attributes were not being applied, and
      their types were inconsistent. The actual IR use types
      did not match the declaration, and were closer to the
      types used for the patterns. The brcond lowering
      was changing the types, so introduce new nodes for those.
      
      llvm-svn: 298119
      c5b641ac
    • Sanjay Patel's avatar
      455703a0
    • Vedant Kumar's avatar
      [ubsan] Add e2e test for -fsanitize=nullability · eb44542f
      Vedant Kumar authored
      llvm-svn: 298117
      eb44542f
    • Reid Kleckner's avatar
      [X86] Emit fewer instructions to allocate >16GB stack frames · edf1cbb5
      Reid Kleckner authored
      Summary:
      Use this code pattern when RAX is live, instead of emitting up to 2
      billion adjustments:
        pushq %rax
        movabsq +-$Offset+-8, %rax
        addq %rsp, %rax
        xchg %rax, (%rsp)
        movq (%rsp), %rsp
      
      Try to clean this code up a bit while I'm here. In particular, hoist the
      logic that handles the entire adjustment with `movabsq $imm, %rax` out
      of the loop.
      
      This negates the offset in the prologue and uses ADD because X86 only
      has a two operand subtract which always subtracts from the destination
      register, which can no longer be RSP.
      
      Fixes PR31962
      
      Reviewers: majnemer, sdardis
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D30052
      
      llvm-svn: 298116
      edf1cbb5
    • Rong Xu's avatar
      [PGO] Add omitted test cases. · 661ffe10
      Rong Xu authored
      llvm-svn: 298115
      661ffe10
    • Jun Bum Lim's avatar
      [CodeGenPrep]Restructure promoting Ext to form ExtLoad · 4230101d
      Jun Bum Lim authored
      Summary:
      Instead of just looking for a load which is mergable with Ext to form ExtLoad, trying to promote Exts as long as the cost is acceptable. This change is not a NFC as it continue promoting Exts even after finding a load during promotions; the change in arm64-codegen-prepare-extload.ll described in 2.b might show the case.
      This change was motivated from D26524.  Based on this change, I will move the transformation performed in aarch64-type-promotion into CGP.
      
      Reviewers: jmolloy, qcolombet, mcrosier, javed.absar
      
      Reviewed By: qcolombet
      
      Subscribers: rengolin, llvm-commits, aemerson
      
      Differential Revision: https://reviews.llvm.org/D27853
      
      llvm-svn: 298114
      4230101d
    • Rong Xu's avatar
      Resubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write · cf1f6fb1
      Rong Xu authored
      And also r295364 [PGO] remove unintended debug trace. NFC
      I removed the test case: it's hard to write synchronized test b/w processes
      in this framework. I will revisit the test-case later.
      
      llvm-svn: 298113
      cf1f6fb1
    • Tim Hammerquist's avatar
      executables should be validated before spawning subprocesses · 84858218
      Tim Hammerquist authored
      dotest.py script doesn't validate executables passed on the command line
      before spawning dozens of subprocesses, all of which fail silently,
      leaving an empty results file.
      
      We should validate the lldb and compiler executables on
      configuration, aborting when given invalid paths, to prevent numerous,
      cryptic, and spurious failures.
      
      <rdar://problem/31117272>
      
      llvm-svn: 298111
      84858218
    • Rong Xu's avatar
      [PGO] Value profile for size of memory intrinsic calls · e60343d6
      Rong Xu authored
      This patch annotates the valuesites profile to memory intrinsics.
      
      Differential Revision: http://reviews.llvm.org/D31002
      
      llvm-svn: 298110
      e60343d6
    • Vedant Kumar's avatar
      [Bitcode] Add compatibility test for the 4.0 release · c2a250c3
      Vedant Kumar authored
      Fork off compatibility.ll for the 4.0 release. The *.bc file in this
      commit was produced using a Release build of the release_40 branch.
      
      llvm-svn: 298109
      c2a250c3
    • Simon Pilgrim's avatar
      5a68d401
    • Sanjay Patel's avatar
      [x86] avoid adc/sbb assert when both sides of add are zexted (PR32316) · 25bd713d
      Sanjay Patel authored
      As noted in the comment, we might want to account for this case,
      but I didn't look at what that would mean for the asm. 
      
      I'm also not sure why this only reproduces with avx512, but I'm 
      putting a conservative fix in for now to avoid the crash. 
      
      Also, if both sides of an add are zexted, shouldn't we shrink that add?
      
      https://bugs.llvm.org/show_bug.cgi?id=32316
      
      llvm-svn: 298107
      25bd713d
    • Reid Kleckner's avatar
      Fix wasm build after arg_begin iterator type change · 98e56430
      Reid Kleckner authored
      llvm-svn: 298106
      98e56430
    • Reid Kleckner's avatar
      Store Arguments in a flat array instead of an iplist · 56d028d9
      Reid Kleckner authored
      This saves two pointers from Argument and eliminates some extra
      allocations.
      
      Arguments cannot be inserted or removed from a Function because that
      would require changing its Type, which LLVM does not allow. Instead,
      passes that change prototypes, like DeadArgElim, create a new Function
      and copy over argument names and attributes. The primary benefit of
      iplist is O(1) random insertion and removal. We just don't need that for
      arguments, so don't use it.
      
      Reviewed By: chandlerc
      
      Subscribers: dlj, inglorion, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D31058
      
      llvm-svn: 298105
      56d028d9
    • Stanislav Mekhanoshin's avatar
      Only unswitch loops with uniform conditions · ee2dd785
      Stanislav Mekhanoshin authored
      Loop unswitching can be extremely harmful for a SIMT target. In case
      if hoisted condition is not uniform a SIMT machine will execute both
      clones of a loop sequentially. Therefor LoopUnswitch checks if the
      condition is non-divergent.
      
      Since DivergenceAnalysis adds an expensive PostDominatorTree analysis
      not needed for non-SIMT targets a new option is added to avoid unneded
      analysis initialization. The method getAnalysisUsage is called when
      TargetTransformInfo is not yet available and we cannot use it here.
      For that reason a new field DivergentTarget is added to PassManagerBuilder
      to control the behavior and set this field from a target.
      
      Differential Revision: https://reviews.llvm.org/D30796
      
      llvm-svn: 298104
      ee2dd785
    • Simon Pilgrim's avatar
      [X86] Add SelectionDAG.computeKnownBits test showing inability to handle ISD::ABS · d06b025c
      Simon Pilgrim authored
      We have to be careful as abs(INT_MIN) == INT_MIN.
      
      llvm-svn: 298103
      d06b025c
    • George Rimar's avatar
      [ELF] - Move template instantiations to the end of file. NFC. · a918957b
      George Rimar authored
      To be consistent with other code, addresses post 
      commit review comments.
      
      llvm-svn: 298102
      a918957b
    • Alexander Kornienko's avatar
      [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted declarations · b10daaf1
      Alexander Kornienko authored
      Summary:
      There is no need for triggering warning when noexcept specifier in move constructor or move-assignment operator is neither evaluated nor uninstantiated.
      
      This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712
      
      Reviewers: alexfh
      
      Reviewed By: alexfh
      
      Subscribers: JonasToth, JDevlieghere, cfe-commits
      
      Tags: #clang-tools-extra
      
      Patch by Marek Jenda!
      
      Differential Revision: https://reviews.llvm.org/D31049
      
      llvm-svn: 298101
      b10daaf1
Loading