1. May 17, 2018
    • Vedant Kumar's avatar
      [Debugify] Tighten up the test for -debugify-each, NFC · 5c6b3fb8
      Vedant Kumar authored
      In post-commit review for r332416, Paul Robinson pointed out that the
      test for -debugify-each is not checking what it needs to.
      
      This commit tightens up the test.
      
      llvm-svn: 332497
      5c6b3fb8
    • JF Bastien's avatar
      Signal handling should be signal-safe · aa1333a9
      JF Bastien authored
      Summary:
      Before this patch, signal handling wasn't signal safe. This leads to real-world
      crashes. It used ManagedStatic inside of signals, this can allocate and can lead
      to unexpected state when a signal occurs during llvm_shutdown (because
      llvm_shutdown destroys the ManagedStatic). It also used cl::opt without custom
      backing storage. Some de-allocation was performed as well. Acquiring a lock in a
      signal handler is also a great way to deadlock.
      
      We can't just disable signals on llvm_shutdown because the signals might do
      useful work during that shutdown. We also can't just disable llvm_shutdown for
      programs (instead of library uses of clang) because we'd have to then mark the
      pointers as not leaked and make sure all the ManagedStatic uses are OK to leak
      and remain so.
      
      Move all of the code to lock-free datastructures instead, and avoid having any
      of them in an inconsistent state. I'm not trying to be fancy, I'm not using any
      explicit memory order because this code isn't hot. The only purpose of the
      atomics is to guarantee that a signal firing on the same or a different thread
      doesn't see an inconsistent state and crash. In some cases we might miss some
      state (for example, we might fail to delete a temporary file), but that's fine.
      
      Note that I haven't touched any of the backtrace support despite it not
      technically being totally signal-safe. When that code is called we know
      something bad is up and we don't expect to continue execution, so calling
      something that e.g. sets errno is the least of our problems.
      
      A similar patch should be applied to lib/Support/Windows/Signals.inc, but that
      can be done separately.
      
      Fix r332428 which I reverted in r332429. I originally used double-wide CAS
      because I was lazy, but some platforms use a runtime function for that which
      thankfully failed to link (it would have been bad for signal handlers
      otherwise). I use a separate flag to guard the data instead.
      
      <rdar://problem/28010281>
      
      Reviewers: dexonsmith
      
      Subscribers: steven_wu, llvm-commits
      llvm-svn: 332496
      aa1333a9
    • Jonas Hahnfeld's avatar
      [libomptarget-nvptx-bc] Pass found CUDA installations · 9228f971
      Jonas Hahnfeld authored
      We already know where the CUDA SDK is, so there is no point in
      letting Clang search for it again and possibly finding no or
      a different installation.
      
      --cuda-path is supported since the beginning of CUDA support in
      Clang, so making this required doesn't impose additional restrictions.
      
      Differential Revision: https://reviews.llvm.org/D46930
      
      llvm-svn: 332495
      9228f971
    • Jonas Hahnfeld's avatar
      [libomptarget-nvptx] Test bitcode compiler flags and enable by default · 37bbe1a6
      Jonas Hahnfeld authored
      Move all logic related to selecting the bitcode compiler and linker
      into a new file and dynamically test required compiler flags. This
      also adds -fcuda-rdc for Clang trunk as previously attempted in D44992
      which fixes the build.
      
      As a result this change also enables building the library by default
      if all prerequisites are met.
      
      Differential Revision: https://reviews.llvm.org/D46901
      
      llvm-svn: 332494
      37bbe1a6
    • Matt Davis's avatar
      [llvm-mca] Move the RegisterFile class into its own translation unit. NFC · b7972f88
      Matt Davis authored
      Summary: This change will help us turn the DispatchUnit into its own stage.
      
      Reviewers: andreadb, RKSimon, courbet
      
      Reviewed By: andreadb, courbet
      
      Subscribers: mgorny, tschuett, gbedwell, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46916
      
      llvm-svn: 332493
      b7972f88
    • Erich Keane's avatar
      Add lit tests forgotten for R332470 · a3c0c9a2
      Erich Keane authored
      I forgot to svn-add the lit tests for R332470.  
      Added here!
      
      llvm-svn: 332492
      a3c0c9a2
    • Bruno Cardoso Lopes's avatar
      [Modules] Do not diagnose missing import in recovery mode if there isn't a decl to lookup · c39e85d1
      Bruno Cardoso Lopes authored
      Clang often tries to create implicit module import for error recovery,
      which does a great job helping out with diagnostics. However, sometimes
      clang does not have enough information given that it's using an invalid
      context to move on. Be more strict in those cases to avoid crashes.
      
      We hit crash on invalids because of this but unfortunately there are no
      testcases and I couldn't manage to create one. The crashtrace however
      indicates pretty clear why it's happening.
      
      rdar://problem/39313933
      
      llvm-svn: 332491
      c39e85d1
    • Nirav Dave's avatar
      [DAG] Prune cycle check in store merge. · 11fd14c1
      Nirav Dave authored
      As part of merging stores we check that fusing the nodes does not
      cause a cycle due to one candidate store being indirectly dependent on
      another store (this may happen via chained memory copies). This is
      done by searching if a store is a predecessor to another store's
      value.
      
      Prune the search at the candidate search's root node which is a
      predecessor to all candidate stores. This reduces the
      size of the subgraph searched in large basic blocks.
      
      Reviewers: jyknight
      
      Subscribers: llvm-commits, hiraditya
      
      Differential Revision: https://reviews.llvm.org/D46955
      
      llvm-svn: 332490
      11fd14c1
    • Nirav Dave's avatar
      [DAG] Defer merge store cycle checking to just before merge. NFCI. · d9d86cb7
      Nirav Dave authored
      llvm-svn: 332489
      d9d86cb7
    • Michael Kruse's avatar
      [DeLICM] Avoid assertion on out-of-quota. · d6c2ca8d
      Michael Kruse authored
      An assertion was not prepared to be passed a nullptr because the
      out-of-quota limit was exceeded.  Bail-out before the assertion
      since the assertion does not apply on out-of-quote.
      
      This fixes llvm.org/PR37477.
      
      llvm-svn: 332488
      d6c2ca8d
    • Nico Weber's avatar
      Give shared modules in unittests the platform-native extension, make PipSqueak a MODULE · 12389819
      Nico Weber authored
      As far as I can tell from revision history, there's no good reason to call
      these files .so instead of .dll in Windows, so use the normal extension.
      
      Also change PipSquak from SHARED to MODULE -- it's never passed to
      target_link_libraries() and only loaded via dlopen(), so MODULE is more
      appropriate. This makes it possible to delete a workaround for SHARED ldflags
      being not quite right as well.
      
      No intended behavior change.
      https://reviews.llvm.org/D46898
      
      llvm-svn: 332487
      12389819
    • Sanjay Patel's avatar
      [x86] add run with unsafe global param; NFC · 84caa965
      Sanjay Patel authored
      llvm-svn: 332486
      84caa965
    • Tony Tye's avatar
      [AMDGPU] Change llvm.debugtrap to be a debug breakpoint that can resume execution. · 43259df4
      Tony Tye authored
      No longer require the queue pointer to be passed in in fixed SGPRs.
      
      Differential Revision: https://reviews.llvm.org/D46769
      
      llvm-svn: 332485
      43259df4
    • Sanjay Patel's avatar
      [x86] add tests for DAG FP undef operands; NFC · b3ac148c
      Sanjay Patel authored
      llvm-svn: 332484
      b3ac148c
  2. May 16, 2018
    • Sander de Smalen's avatar
      [AArch64][SVE] Improve diagnostics for vectors with incorrect element-size. · 22176a22
      Sander de Smalen authored
      For regular SVE vector operands, this patch introduces a more
      sensible diagnostic when the vector has a wrong suffix (e.g. z0.s vs z0.b).
      
      For example:
        add z0.s, z1.s, z2.b      -> invalid element width
                     ^_____^
                     mismatch
      
      For the vector-with-shift/extend (e.g. z0.s, uxtw #2) this patch takes
      a slightly different approach and instead returns a 'invalid operand'
      if the element size is not as expected. This is because the diagnostics
      are more specificied to suggest using the right shift/extend suffix. This
      is a trade-off not to introduce more operand classes and still provide
      useful diagnostics for LD1 and PRF instructions.
      
      For example:
        ld1w z1.s, p0/z, [x0, z0.s] -> invalid shift/extend specified, expected 'z[0..31].s, (uxtw|sxtw)'
        ld1w z1.d, p0/z, [x0, z0.s] -> invalid operand
                ^________________^
                     mismatch
      
      For gather prefetches, both 'z0.s' and 'z0.d' would be allowed:
        prfw #0, p0, [x0, z0.s]   -> invalid shift/extend specified, expected 'z[0..31].s, (uxtw|sxtw) #2'
        prfw #0, p0, [x0, z0.d]   -> invalid shift/extend specified, expected 'z[0..31].d, (lsl|uxtw|sxtw) #2'
      
      Without this change, the diagnostic would unnecessarily suggest a
      different element size:
        prfw #0, p0, [x0, z0.s]   -> invalid shift/extend specified, expected 'z[0..31].d, (lsl|uxtw|sxtw) #2'
      
      Reviewers: SjoerdMeijer, aemerson, fhahn, samparker, javed.absar
      
      Reviewed By: SjoerdMeijer
      
      Differential Revision: https://reviews.llvm.org/D46688
      
      llvm-svn: 332483
      22176a22
    • Sirish Pande's avatar
      [AArch64] Gangup loads and stores for pairing. · cabe50a3
      Sirish Pande authored
      Keep loads and stores together (target defines how many loads
      and stores to gang up), such that it will help in pairing
      and vectorization.
      
      Differential Revision https://reviews.llvm.org/D46477
      
      llvm-svn: 332482
      cabe50a3
    • Joel E. Denny's avatar
      [Attr] Don't print fake MSInheritance argument · efdb9be2
      Joel E. Denny authored
      This was discovered at:
      
      http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html
      
      Reviewed by: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D46905
      
      llvm-svn: 332481
      efdb9be2
    • Joel E. Denny's avatar
      Revert r332474: [Attr] Don't print fake MSInheritance argument · 35a1ba87
      Joel E. Denny authored
      I botched the commit log attributes.
      
      llvm-svn: 332480
      35a1ba87
    • Sanjay Patel's avatar
      [InstCombine] allow more binop (shuffle X), C transforms · 2eb35120
      Sanjay Patel authored
      The canonicalization was restricted to shuffle masks with
      a 1-to-1 mapping to the constant vector, but that disqualifies
      the common splat pattern. This is part of solving PR37463:
      https://bugs.llvm.org/show_bug.cgi?id=37463
      
      llvm-svn: 332479
      2eb35120
    • Kostya Kortchinsky's avatar
      [sanitizer] Minor 32-bit primary improvements · 561228b2
      Kostya Kortchinsky authored
      Summary:
      For the 32-bit TransferBatch:
      - `SetFromArray` callers have bounds `count`, so relax the `CHECK` to `DCHECK`;
      - same for `Add`;
      - mark `CopyToArray` as `const`;
      For the 32-bit Primary:
      - `{Dea,A}llocateBatch` are only called from places that check `class_id`,
        relax the `CHECK` to `DCHECK`;
      - same for `AllocateRegion`;
      - remove `GetRegionBeginBySizeClass` that is not used;
      - use a local variable for the random shuffle state, so that the compiler can
        use a register instead of reading and writing to the `SizeClassInfo` at every
        iteration;
      For the 32-bit local cache:
      - pass the count to drain instead of doing a `Min` everytime which is at times
        superfluous.
      
      Reviewers: alekseyshl
      
      Reviewed By: alekseyshl
      
      Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46657
      
      llvm-svn: 332478
      561228b2
    • Alexey Bataev's avatar
      [OPENMP] DO not crash on combined constructs in declare target · 4ac68a21
      Alexey Bataev authored
      functions.
      
      If the combined construct is specified in the declare target function
      and the device code is emitted, the compiler crashes because of the
      incorrectly chosen captured stmt. We should choose the innermost
      captured statement, not the outermost.
      
      llvm-svn: 332477
      4ac68a21
    • Teresa Johnson's avatar
      [ThinLTO] Make llvm-lto module ID numbering consistent with linkers · 43e71ec4
      Teresa Johnson authored
      The module ID numbering typically starts at 0 (in both the new and old
      LTO APIs, used by linkers). Make llvm-lto consistent with that.
      
      Split out of D46699.
      
      llvm-svn: 332476
      43e71ec4
    • Teresa Johnson's avatar
      [ThinLTO] Add const qualifier to a couple of flag getter methods · 09673323
      Teresa Johnson authored
      Split these minor fixes out of D46699.
      
      llvm-svn: 332475
      09673323
    • Joel E. Denny's avatar
      dcbf2e8e
    • Sanjay Patel's avatar
      [OpenCL] make test independent of optimizer · cda77b30
      Sanjay Patel authored
      There shouldn't be any tests that run the entire optimizer here,
      but the last test in this file is definitely going to break with 
      a change in LLVM IR canonicalization. Change that part to check
      the unoptimized IR because that's the real intent of this file.
      
      llvm-svn: 332473
      cda77b30
    • Sander de Smalen's avatar
      [AArch64][SVE] Asm: Support for gather PRF prefetch instructions · bbc4e9a4
      Sander de Smalen authored
      Reviewers: rengolin, fhahn, samparker, SjoerdMeijer, javed.absar
      
      Reviewed By: SjoerdMeijer
      
      Differential Revision: https://reviews.llvm.org/D46686
      
      llvm-svn: 332472
      bbc4e9a4
    • Philip Pfaffe's avatar
      [ScopInfo] Remove usage of isl_set_n_basic_set() · 9375d572
      Philip Pfaffe authored
      Summary: This patch aims to remove the usage of old C-styled isl functions (in this case `isl_set_n_basic_set()`) in favor of new C++ isl interface based methods in `ScopInfo.cpp`.
      
      Patch by Sahil Yerawar
      
      Differential Revision: https://reviews.llvm.org/D46935
      
      llvm-svn: 332471
      9375d572
    • Erich Keane's avatar
      Add support for __declspec(code_seg("segname")) · 64144eb1
      Erich Keane authored
      Add support for __declspec(code_seg("segname"))
      
      This patch is built on the existing support for #pragma code_seg. The code_seg
      declspec is allowed on functions and classes. The attribute enables the
      placement of code into separate named segments, including compiler-generated
      members and template instantiations.
      
      For more information, please see the following:
      https://msdn.microsoft.com/en-us/library/dn636922.aspx
      
      A new CodeSeg attribute is used instead of adding a new spelling to the existing
      Section attribute since they don’t apply to the same Subjects. Section
      attributes are also added for the code_seg declspec since they are used for
      #pragma code_seg. No CodeSeg attributes are added to the AST.
      
      The patch is written to match with the Microsoft compiler’s behavior even where
      that behavior is a little complicated (see https://reviews.llvm.org/D22931, the
      Microsoft feedback page is no longer available since MS has removed the page).
      That code is in getImplicitSectionAttrFromClass routine.
      
      Diagnostics messages are added to match with the Microsoft compiler for code-seg
      attribute mismatches on base and derived classes and virtual overrides.
      
      
      Differential Revision: https://reviews.llvm.org/D43352
      
      llvm-svn: 332470
      64144eb1
    • Ivan Donchevskii's avatar
      [Frontend] Avoid running plugins during code completion parse · 091069c9
      Ivan Donchevskii authored
      The parsing that is done for code completion is a special case that will
      discard any generated diagnostics, so avoid running plugins for this
      case in the first place to avoid performance penalties due to the
      plugins.
      
      A scenario for this is for example libclang with extra plugins like tidy.
      
      Patch by Nikolai Kosjar
      
      Differential Revision: https://reviews.llvm.org/D46050
      
      llvm-svn: 332469
      091069c9
    • Andrea Di Biagio's avatar
      [llvm-mca] Move definitions in FetchStage.cpp inside namespace mca. NFC · 076eba20
      Andrea Di Biagio authored
      Also, get rid of a redundant include in FetchStage.h and FetchStage.cpp.
      
      llvm-svn: 332468
      076eba20
    • Alexey Bataev's avatar
      [OPENMP, NVPTX] Add check for SPMD mode in orphaned parallel directives. · 673110d5
      Alexey Bataev authored
      If the orphaned directive is executed in SPMD mode, we need to emit the
      check for the SPMD mode and run the orphaned parallel directive in
      sequential mode.
      
      llvm-svn: 332467
      673110d5
    • Krzysztof Pszeniczny's avatar
      [BasicAA] Fix handling of invariant group launders · 2ba8fd49
      Krzysztof Pszeniczny authored
      Summary:
      A recent patch ([[ https://reviews.llvm.org/rL331587 | rL331587 ]]) to Capture Tracking taught it that the `launder_invariant_group` intrinsic captures its argument only by returning it. Unfortunately, BasicAA still considered every call instruction as a possible escape source and hence concluded that the result of a `launder_invariant_group` call cannot alias any local non-escaping value. This led to [[ https://bugs.llvm.org/show_bug.cgi?id=37458 | bug 37458 ]].
      
      This patch updates the relevant check for escape sources in BasicAA.
      
      Reviewers: Prazek, kuhar, rsmith, hfinkel, sanjoy, xbolva00
      
      Reviewed By: hfinkel, xbolva00
      
      Subscribers: JDevlieghere, hiraditya, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46900
      
      llvm-svn: 332466
      2ba8fd49
    • Eric Liu's avatar
      Fix an Index test caused by a clang-format change (r332436). · 0c8f451a
      Eric Liu authored
      llvm-svn: 332465
      0c8f451a
    • Simon Dardis's avatar
    • Henry Wong's avatar
      [analyzer] Improve the modeling of memset(). · afe62cdc
      Henry Wong authored
      Since there is no perfect way bind the non-zero value with the default binding, this patch only considers the case where buffer's offset is zero and the char value is 0. And according to the value for overwriting, decide how to update the string length.
      
      Reviewers: dcoughlin, NoQ, xazax.hun, a.sidorin, george.karpenkov
      
      Reviewed By: NoQ
      
      Differential Revision: https://reviews.llvm.org/D44934
      
      llvm-svn: 332463
      afe62cdc
    • Simon Dardis's avatar
      [mips] Join existing scopes for DecoderNamespace (NFCI) · 6c35f8f4
      Simon Dardis authored
      llvm-svn: 332462
      6c35f8f4
    • Andrea Di Biagio's avatar
      [llvm-mca] Fix perf regression after r332390. · 88997ba2
      Andrea Di Biagio authored
      Revision 332390 introduced a FetchStage class in llvm-mca.
      By design, FetchStage owns all the instructions in-flight in the OoO Backend.
      
      Before this change, new instructions were added to a DenseMap indexed by
      instruction id. The problem with using a DenseMap is that elements are not
      ordered by key. This was causing a massive slow down in method
      FetchStage::postExecute(), which searches for instructions retired that can be
      deleted.
      
      This patch replaces the DenseMap with a std::map ordered by instruction index.
      At the end of every cycle, we search for the first instruction which is not
      marked as "retired", and we remove all the previous instructions before it.
      This works well because instructions are retired in-order.
      
      Before this patch, a debug build of llvm-mca (on my Ryzen linux machine) took
      ~8.0 seconds to simulate 3000 iterations of a x86 dot-product (a `vmulps,
      vpermilps, vaddps, vpermilps, vaddps` sequence). With this patch, it now takes
      ~0.8s to run all the 3000 iterations.
      
      llvm-svn: 332461
      88997ba2
    • Ilya Biryukov's avatar
      [clangd] Parse all comments in Sema and completion. · c22d3447
      Ilya Biryukov authored
      Summary:
      And add tests for the comment extraction code.
      
      clangd will now show non-doxygen comments in completion for results
      coming from Sema and Dynamic index.
      Static index does not include the comments yet, I will enable it in
      a separate commit after investigating which implications it has for
      the size of the index.
      
      Reviewers: sammccall, hokein, ioeric
      
      Reviewed By: sammccall
      
      Subscribers: klimek, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46002
      
      llvm-svn: 332460
      c22d3447
    • Ilya Biryukov's avatar
      [clangd] Retrieve minimally formatted comment text in completion. · 43714504
      Ilya Biryukov authored
      Summary:
      Previous implementation used to extract brief text from doxygen comments.
      Brief text parsing slows down completion and is not suited for
      non-doxygen comments.
      
      This commit switches to providing comments that mimic the ones
      originally written in the source code, doing minimal reindenting and
      removing the comments markers to make the output more user-friendly.
      
      It means we lose support for doxygen-specific features, e.g. extracting
      brief text, but provide useful results for non-doxygen comments.
      Switching the doxygen support back is an option, but I suggest to see
      whether the current approach gives more useful results.
      
      Reviewers: sammccall, hokein, ioeric
      
      Reviewed By: sammccall
      
      Subscribers: klimek, MaskRay, jkorous, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D45999
      
      llvm-svn: 332459
      43714504
    • Ilya Biryukov's avatar
      [AST] Added a helper to extract a user-friendly text of a comment. · 1ff7c32f
      Ilya Biryukov authored
      Summary:
      The helper is used in clangd for documentation shown in code completion
      and storing the docs in the symbols. See D45999.
      
      This patch reuses the code of the Doxygen comment lexer, disabling the
      bits that do command and html tag parsing.
      The new helper works on all comments, including non-doxygen comments.
      However, it does not understand or transform any doxygen directives,
      i.e. cannot extract brief text, etc.
      
      Reviewers: sammccall, hokein, ioeric
      
      Reviewed By: ioeric
      
      Subscribers: mgorny, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D46000
      
      llvm-svn: 332458
      1ff7c32f