1. Mar 02, 2018
    • Ilya Biryukov's avatar
      [WebAssembly] Update tests after r326541 · 45f8b19a
      Ilya Biryukov authored
      r326541 slightly increased the size of WebAssembly object files
      and it broke test/MC/WebAssembly/global-ctor-dtor.ll.
      
      This commit updates the test to unbreak it, also mentioned this to the
      author of the original commit in case they don't want it.
      
      llvm-svn: 326571
      45f8b19a
    • Florian Hahn's avatar
      [ARM] Fix codegen for VLD3/VLD4/VST3/VST4 with WB · 9deef20b
      Florian Hahn authored
      Code generation of VLD3, VLD4, VST3 and VST4 with register writeback is
      broken due to 2 separate bugs:
      
      1) VLD1d64TPseudoWB_register and VLD1d64QPseudoWB_register are missing
         rules to expand them to non pseudo MIR. These are selected for
         ARMISD::VLD3_UPD/VLD4_UPD with v1i64 vectors in SelectVLD.
      
      2) Selection of the right VLD/VST instruction is broken for load and
         store of 3 and 4 v1i64 vectors. SelectVLD and SelectVST are called
         with MIR opcode for fixed writeback (ie increment is access size)
         and call getVLDSTRegisterUpdateOpcode() to select an opcode with
         register writeback if base register update is of a different size.
         Since getVLDSTRegisterUpdateOpcode() only knows about
         VLD1/VLD2/VST1/VST2 the call is currently conditional on the number
         of element in the vector.
      
         However, VLD1/VST1 is selected by SelectVLD/SelectVST's caller for
         load and stores of 3 or 4 v1i64 vectors. Therefore the opcode is not
         updated which later lead to a fixed writeback instruction being
         constructed with an extra operand for the register writeback.
      
      This patch addresses the two issues as follows:
      - it adds the necessary mapping from VLD1d64TPseudoWB_register and
        VLD1d64QPseudoWB_register to VLD1d64Twb_register and
        VLD1d64Qwb_register respectively. Like for the existing _fixed
        variants, the cost of these is bumped for unaligned access.
      - it changes the logic in SelectVLD and SelectVSD to call isVLDfixed
        and isVSTfixed respectively to decide whether the opcode should be
        updated. It also reworks the logic and comments for pushing the
        writeback offset operand and r0 operand to clarify the logic:
        writeback offset needs to be pushed if it's a register writeback,
        r0 needs to be pushed if not and the instruction is a
        VLD1/VLD2/VST1/VST2.
      
      Reviewers: rengolin, t.p.northover, samparker
      
      Reviewed By: samparker
      
      Patch by Thomas Preud'homme <thomas.preudhomme@arm.com>
      
      Differential Revision: https://reviews.llvm.org/D42970
      
      llvm-svn: 326570
      9deef20b
    • Ilya Biryukov's avatar
      [clang] Fix use-after-free on code completion · ddf6a333
      Ilya Biryukov authored
      Summary:
      Found by asan. Fiddling with code completion AST after
      FrontendAction::Exceute can lead to errors.
      Calling the callback in ProcessCodeCompleteResults to make sure we
      don't access uninitialized state.
      
      This particular issue comes from the fact that Sema::TUScope is
      deleted when destructor of ~Parser runs, but still present in
      Sema::TUScope and accessed when building completion items.
      
      I'm still struggling to come up with a small repro. The relevant
      stackframes reported by asan are:
      ERROR: AddressSanitizer: heap-use-after-free on address
      READ of size 8 at 0x61400020d090 thread T175
          #0 0x5632dff7821b in llvm::SmallPtrSetImplBase::isSmall() const include/llvm/ADT/SmallPtrSet.h:195:33
          #1 0x5632e0335901 in llvm::SmallPtrSetImplBase::insert_imp(void const*) include/llvm/ADT/SmallPtrSet.h:127:9
          #2 0x5632e067347d in llvm::SmallPtrSetImpl<clang::Decl*>::insert(clang::Decl*) include/llvm/ADT/SmallPtrSet.h:372:14
          #3 0x5632e065df80 in clang::Scope::AddDecl(clang::Decl*) tools/clang/include/clang/Sema/Scope.h:287:18
          #4 0x5632e0623eea in clang::ASTReader::pushExternalDeclIntoScope(clang::NamedDecl*, clang::DeclarationName) clang/lib/Serialization/ASTReader.cpp
          #5 0x5632e062ce74 in clang::ASTReader::finishPendingActions() tools/clang/lib/Serialization/ASTReader.cpp:9164:9
          ....
          #30 0x5632e02009c4 in clang::index::generateUSRForDecl(clang::Decl const*, llvm::SmallVectorImpl<char>&) tools/clang/lib/Index/USRGeneration.cpp:1037:6
          #31 0x5632dff73eab in clang::clangd::(anonymous namespace)::getSymbolID(clang::CodeCompletionResult const&) tools/clang/tools/extra/clangd/CodeComplete.cpp:326:20
          #32 0x5632dff6fe91 in clang::clangd::CodeCompleteFlow::mergeResults(std::vector<clang::CodeCompletionResult, std::allocator<clang::CodeCompletionResult> > const&, clang::clangd::SymbolSlab const&)::'lambda'(clang::CodeCompletionResult const&)::operator()(clang::CodeCompletionResult const&) tools/clang/tools/extra/clangd/CodeComplete.cpp:938:24
          #33 0x5632dff6e426 in clang::clangd::CodeCompleteFlow::mergeResults(std::vector<clang::CodeCompletionResult, std::allocator<clang::CodeCompletionResult> > const&, clang::clangd::SymbolSlab const&) third_party/llvm/llvm/tools/clang/tools/extra/clangd/CodeComplete.cpp:949:38
          #34 0x5632dff7a34d in clang::clangd::CodeCompleteFlow::runWithSema() llvm/tools/clang/tools/extra/clangd/CodeComplete.cpp:894:16
          #35 0x5632dff6df6a in clang::clangd::CodeCompleteFlow::run(clang::clangd::(anonymous namespace)::SemaCompleteInput const&) &&::'lambda'()::operator()() const third_party/llvm/llvm/tools/clang/tools/extra/clangd/CodeComplete.cpp:858:35
          #36 0x5632dff6cd42 in clang::clangd::(anonymous namespace)::semaCodeComplete(std::unique_ptr<clang::CodeCompleteConsumer, std::default_delete<clang::CodeCompleteConsumer> >, clang::CodeCompleteOptions const&, clang::clangd::(anonymous namespace)::SemaCompleteInput const&, llvm::function_ref<void ()>) tools/clang/tools/extra/clangd/CodeComplete.cpp:735:5
      
      0x61400020d090 is located 80 bytes inside of 432-byte region [0x61400020d040,0x61400020d1f0)
      freed by thread T175  here:
          #0 0x5632df74e115 in operator delete(void*, unsigned long) projects/compiler-rt/lib/asan/asan_new_delete.cc:161:3
          #1 0x5632e0b06973 in clang::Parser::~Parser() tools/clang/lib/Parse/Parser.cpp:410:3
          #2 0x5632e0b06ddd in clang::Parser::~Parser() clang/lib/Parse/Parser.cpp:408:19
          #3 0x5632e0b03286 in std::unique_ptr<clang::Parser, std::default_delete<clang::Parser> >::~unique_ptr() .../bits/unique_ptr.h:236:4
          #4 0x5632e0b021c4 in clang::ParseAST(clang::Sema&, bool, bool) tools/clang/lib/Parse/ParseAST.cpp:182:1
          #5 0x5632e0726544 in clang::FrontendAction::Execute() tools/clang/lib/Frontend/FrontendAction.cpp:904:8
          #6 0x5632dff6cd05 in clang::clangd::(anonymous namespace)::semaCodeComplete(std::unique_ptr<clang::CodeCompleteConsumer, std::default_delete<clang::CodeCompleteConsumer> >, clang::CodeCompleteOptions const&, clang::clangd::(anonymous namespace)::SemaCompleteInput const&, llvm::function_ref<void ()>) tools/clang/tools/extra/clangd/CodeComplete.cpp:728:15
      
      Reviewers: sammccall
      
      Reviewed By: sammccall
      
      Subscribers: klimek, jkorous-apple, cfe-commits, ioeric
      
      Differential Revision: https://reviews.llvm.org/D44000
      
      llvm-svn: 326569
      ddf6a333
    • Florian Hahn's avatar
      [LV][CFG] Add irreducible CFG detection for outer loops · 515acd64
      Florian Hahn authored
      This patch adds support for detecting outer loops with irreducible control
      flow in LV. Current detection uses SCCs and only works for innermost loops.
      This patch adds a utility function that works on any CFG, given its RPO
      traversal and its LoopInfoBase. This function is a generalization
      of isIrreducibleCFG  from lib/CodeGen/ShrinkWrap.cpp. The code in
      lib/CodeGen/ShrinkWrap.cpp is also updated to use the new generic utility
      function.
      
      Patch by Diego Caballero <diego.caballero@intel.com>
      
      Differential Revision: https://reviews.llvm.org/D40874
      
      llvm-svn: 326568
      515acd64
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for @llvm.maxnum · b46c191c
      Matt Arsenault authored
      Patch by Tom Stellard
      
      llvm-svn: 326567
      b46c191c
    • Alexey Sotkin's avatar
      Add possibility to specify output stream for CompilerInstance · aba98fc9
      Alexey Sotkin authored
      Patch by: krisb
      
      Reviewers: teemperor
      
      Reviewed By: teemperor
      
      Subscribers: klimek, mgorny, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43809
      
      llvm-svn: 326566
      aba98fc9
    • Simon Pilgrim's avatar
      [X86] Remove old UNIMPLEMENTED list · c879aa7e
      Simon Pilgrim authored
      All of these are implemented and have appropriate test coverage
      
      llvm-svn: 326553
      c879aa7e
    • Jonas Devlieghere's avatar
      [testsuite] Remove workaround for categories and inline tests. · 3a9d4313
      Jonas Devlieghere authored
      Adding categories to inline tests does not work because the attribute
      is set at the function level. For methods, this means it applies to all
      instances of that particular class. While this is what we want in most
      cases, it's not for inline tests, where different instances correspond
      to different tests.
      
      With the workaround in place, assigning a category to one test resulted
      in the category applied to *all* inline tests.
      
      This patch removes the workaround and throws an exception with an
      informative error message, to prevent this from happening in the future.
      
      llvm-svn: 326552
      3a9d4313
    • Mikhail Maltsev's avatar
      [Sema] Improve test coverage of narrowing conversion diagnostics · 2373516c
      Mikhail Maltsev authored
      Summary:
      This patch adds tests of narrowing conversion diagnostics for the
      'unscoped enum -> integer' case.
      
      Reviewers: faisalv, rsmith, rogfer01
      
      Reviewed By: rogfer01
      
      Subscribers: cfe-commits, rogfer01
      
      Differential Revision: https://reviews.llvm.org/D43572
      
      llvm-svn: 326551
      2373516c
    • Eric Liu's avatar
      [clangd:vscode] Bump clangd-vscode version to 0.0.4. · fdaeb9bf
      Eric Liu authored
      llvm-svn: 326548
      fdaeb9bf
    • Eric Liu's avatar
      [clangd:vscode] check empty/null string correctly. · 5e4dbb4f
      Eric Liu authored
      llvm-svn: 326547
      5e4dbb4f
    • Sam McCall's avatar
      [clangd] Debounce streams of updates. · d1e0deb2
      Sam McCall authored
      Summary:
      Don't actually start building ASTs for new revisions until either:
      - 500ms have passed since the last revision, or
      - we actually need the revision for something (or to unblock the queue)
      
      In practice, this avoids the "first keystroke results in diagnostics" problem.
      This is kind of awkward to test, and the test is pretty bad.
      It can be observed nicely by capturing a trace, though.
      
      Reviewers: hokein, ilya-biryukov
      
      Subscribers: klimek, jkorous-apple, ioeric, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43648
      
      llvm-svn: 326546
      d1e0deb2
    • George Rimar's avatar
      [ELF] - Report error when memory region is overflowed by data commands. · 97785af4
      George Rimar authored
      LLD can not catch a memory area overflow when using a data command.
      If we have the script below:
      
      .foo : 
      {
        *(.foo)
        BYTE(0x1)
      } > ram
      
      where BYTE overflows the ram region, we do not report it currently.
      Patch fixes that.
      
      Differential revision: https://reviews.llvm.org/D43948
      
      llvm-svn: 326545
      97785af4
    • Kamil Rytarowski's avatar
      OpenBSD Ubsan support / interception · 7e552452
      Kamil Rytarowski authored
      Summary: Interception, enabling OpenBSD platform
      
      Patch by: David CARLIER
      
      Reviewers: krytarowski, vitalybuka, visa
      
      Reviewed By: vitalybuka
      
      Subscribers: srhines, fedor.sergeev, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D43893
      
      llvm-svn: 326544
      7e552452
    • Kamil Rytarowski's avatar
      OpenBSD UBsan support / ubsan part · 4410bbc9
      Kamil Rytarowski authored
      Summary: UBsan, enable OpenBSD platform
      
      Patch by: David CARLIER
      
      Reviewers: krytarowski, kettenis, visa, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D43894
      
      llvm-svn: 326543
      4410bbc9
    • Petr Hosek's avatar
      [Frontend] Avoid including default system header paths on Fuchsia · 1aea1e7c
      Petr Hosek authored
      These paths aren't used and don't make sense on Fuchsia.
      
      Differential Revision: https://reviews.llvm.org/D43992
      
      llvm-svn: 326542
      1aea1e7c
    • Heejin Ahn's avatar
      [WebAssembly] More uses of uint8_t for single byte values · d684cb57
      Heejin Ahn authored
      Summary: It looks like this was missing from D43921.
      
      Reviewers: sbc100
      
      Subscribers: jfb, dschuff, jgravelle-google, sunfish, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43991
      
      llvm-svn: 326541
      d684cb57
    • Ekaterina Romanova's avatar
      [ThinLTO] Added a couple of C LTO API interfaces to control the cache policy. · b8aeec46
      Ekaterina Romanova authored
      - thinlto_codegen_set_cache_size_bytes to control the absolute size of cache directory. 
      - thinlto_codegen_set_cache_size_files the size and amount of files in cache directory. 
      These functions have been supported in C++ LTO API for a long time, but were absent in C LTO API.
      
      Differential Revision: https://reviews.llvm.org/D42446
      
      llvm-svn: 326537
      b8aeec46
    • Ed Maste's avatar
      Update man page for long opts that accept = after r326506 · dfcd846b
      Ed Maste authored
      Also remove the space between --lto-O and value, as the option with a
      space is not accepted at present.
      
      Leave --opt-remarks-filename as it does not currently accept the = form.
      
      llvm.org/pr36563
      
      llvm-svn: 326536
      dfcd846b
    • Jan Vesely's avatar
      AMDGPU/GCN: Promote i16 ctpop · b283ea0f
      Jan Vesely authored
      i16 capable ASICs do not support i16 operands for this instruction.
      Add tablegen pattern to merge chained i16 additions.
      
      Differential Revision: https://reviews.llvm.org/D43985
      
      llvm-svn: 326535
      b283ea0f
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_FPTOSI · 41d2e3d9
      Matt Arsenault authored
      Patch by Tom Stellard
      
      llvm-svn: 326534
      41d2e3d9
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_FPTOUI · b23041ad
      Matt Arsenault authored
      Patch by Tom Stellard
      
      llvm-svn: 326533
      b23041ad
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_FMUL · 327d5fb2
      Matt Arsenault authored
      llvm-svn: 326532
      327d5fb2
    • Akira Hatanaka's avatar
      Remove debugging code I accidentally committed in r326530. · 1cc47ead
      Akira Hatanaka authored
      llvm-svn: 326531
      1cc47ead
    • Akira Hatanaka's avatar
      Add an option to disable tail-call optimization for escaping blocks. · 627586b8
      Akira Hatanaka authored
      This makes it easier to debug crashes and hangs in block functions since
      users can easily find out where the block is called from. The option
      doesn't disable tail-calls from non-escaping blocks since non-escaping
      blocks are not as hard to debug as escaping blocks.
      
      rdar://problem/35758207
      
      Differential Revision: https://reviews.llvm.org/D43841
      
      llvm-svn: 326530
      627586b8
    • George Karpenkov's avatar
    • Craig Topper's avatar
      [InstCombine] Add more test case to fpextend.ll. · 8cb5fc15
      Craig Topper authored
      This includes the test cases from D43970 and additional tests for combining (fptrunc (binop (fpext), (fpext))) where the pre-extended types don't match the trunc and therefore can't be completely removed.
      
      llvm-svn: 326528
      8cb5fc15
    • Rafael Espindola's avatar
      Always set dso_local in CodeGenModule::setDSOLocal. · 796d4a88
      Rafael Espindola authored
      This shouldn't change any results for now, but is more consistent with
      how we set dllimport/dllexport and will make future changes easier.
      
      Since clang produces IR as it parses, it can find out mid file that
      something is dllimport. When that happens we have to drop
      dso_local. This is not a problem right now because
      CodeGenModule::setDSOLocal is called from relatively few places at
      the moment.
      
      llvm-svn: 326527
      796d4a88
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_FADD · 5a9e834e
      Matt Arsenault authored
      Patch by Tom Stellard
      
      llvm-svn: 326526
      5a9e834e
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_SHL · d99317f1
      Matt Arsenault authored
      Patch by Tom Stellard
      
      llvm-svn: 326525
      d99317f1
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_XOR · 3c7a123c
      Matt Arsenault authored
      llvm-svn: 326524
      3c7a123c
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Define instruction mapping for G_AND · c0f34c9e
      Matt Arsenault authored
      Patch by Tom Stellard
      
      llvm-svn: 326523
      c0f34c9e
    • Heejin Ahn's avatar
      [WebAssembly] Gather EH instructions in one place. NFC. · e4a8deea
      Heejin Ahn authored
      Summary:
      - Gather EH instructions in one place for easy tracking (more will be
        added later)
      - Variable name change
      
      Reviewers: dschuff
      
      Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43742
      
      llvm-svn: 326522
      e4a8deea
    • Fedor Indutny's avatar
      [ArgumentPromotion] don't break musttail invariant PR36543 · 1571b127
      Fedor Indutny authored
      Summary:
      Do not break musttail invariant by promoting arguments of musttail
      callee or caller.
      
      Reviewers: sanjoy, dberlin, hfinkel, george.burgess.iv, fhahn, rnk
      
      Reviewed By: rnk
      
      Subscribers: rnk, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43926
      
      llvm-svn: 326521
      1571b127
    • George Karpenkov's avatar
      [analyzer] Prevent crashing in NonNullParamChecker · 0ffcaf74
      George Karpenkov authored
      https://bugs.llvm.org/show_bug.cgi?id=36381
      rdar://37543426
      
      Turns out, the type passed for the lambda capture was incorrect.
      One more argument to abandon the getSVal overload which does not require the
      type information.
      
      Differential Revision: https://reviews.llvm.org/D43925
      
      llvm-svn: 326520
      0ffcaf74
    • Eugene Zelenko's avatar
      [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use... · 534673a5
      Eugene Zelenko authored
      [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
      
      llvm-svn: 326519
      534673a5
    • George Karpenkov's avatar
    • Heejin Ahn's avatar
      [WebAssembly] Add exception handling option · 8b6af22e
      Heejin Ahn authored
      Summary: Add exception handling option to clang.
      
      Reviewers: dschuff
      
      Subscribers: jfb, sbc100, jgravelle-google, sunfish, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D43681
      
      llvm-svn: 326517
      8b6af22e
    • George Karpenkov's avatar
      Utility functions for checked arithmetic · 3f547fe8
      George Karpenkov authored
      Provide checkedAdd and checkedMul functions, providing checked
      arithmetic on signed integers.
      
      Differential Revision: https://reviews.llvm.org/D43704
      
      llvm-svn: 326516
      3f547fe8
    • Craig Topper's avatar
      [InstCombine] Simplify test cases by removing loads/stores that aren't... · 113446ca
      Craig Topper authored
      [InstCombine] Simplify test cases by removing loads/stores that aren't required for what is being tested.
      
      The loads and stores were getting the data and storing the results. There's no reason we can't just use function arguments and return.
      
      llvm-svn: 326515
      113446ca