1. Aug 27, 2019
    • Vitaly Buka's avatar
      msan, codegen, instcombine: Keep more lifetime markers used for msan · aeca5696
      Vitaly Buka authored
      Reviewers: eugenis
      
      Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits
      
      Tags: #clang, #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D66695
      
      llvm-svn: 369979
      aeca5696
    • Heejin Ahn's avatar
      [WebAssembly] Fix SSA rebuilding in SjLj transformation · 173a3a54
      Heejin Ahn authored
      Summary:
      Previously we skipped uses within the same BB as a def when rebuilding
      SSA after SjLj transformation. For example, before transformation,
      ```
      for.cond:
        %0 = phi i32 [ %var, %for.inc ] ...
        %var = ...
        br label %for.inc
      
      for.inc:                               ; preds = %for.cond
        call i32 @setjmp(...)
        br %for.cond
      ```
      
      In this BB, %var should be defined in all paths from %for.inc to make %0
      valid. In the input it was true; %for.inc's only predecessor was
      %for.cond. But after SjLj transformation, it is possible that %for.inc
      has other predecessors that are reachable without reaching %for.cond.
      ```
      entry.split:
        ...
        br i1 %a, label %bb.1, label %for.inc
      
      for.cond:
        %0 = phi i32 [ %var, %for.inc ] ...  ; Not valid!
        %var = ...
        br label %for.inc
      
      for.inc:                               ; preds = %for.cond, %entry.split
        call i32 @setjmp(...)
        ...
        br %for.cond
      ```
      
      In this case, we can't use %var in the `phi` instruction in %for.cond,
      because %var is not defined in all paths through %for.inc (If the
      control flow is %entry -> %entry.split -> %for.inc -> %for.cond, %var
      has not been defined until we reach the `phi`). But the previous code
      excluded users within the same BB, skipping instructions within the same
      BB so they are not rewritten properly. User instructions within the same
      BB also should be candidates for rewriting if they are _before_ the
      original definition.
      
      Fixes PR43097.
      
      Reviewers: dschuff
      
      Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66729
      
      llvm-svn: 369978
      173a3a54
    • Evgeniy Stepanov's avatar
      [hwasan] Fix test failure in r369721. · ed4fefb0
      Evgeniy Stepanov authored
      Try harder to emulate "old runtime" in the test.
      To get the old behavior with the new runtime library, we need both
      disable personality function wrapping and enable landing pad
      instrumentation.
      
      llvm-svn: 369977
      ed4fefb0
    • Lang Hames's avatar
      [ORC] Make sure that queries on emitted-but-not-ready symbols fail correctly. · 8853ac7e
      Lang Hames authored
      In r369808 the failure scheme for ORC symbols was changed to make
      MaterializationResponsibility objects responsible for failing the symbols
      they represented. This simplifies error logic in the case where symbols are
      still covered by a MaterializationResponsibility, but left a gap in error
      handling: Symbols that have been emitted but are not yet ready (due to a
      dependence on some unemitted symbol) are not covered by a
      MaterializationResponsibility object. Under the scheme introduced in r369808
      such symbols would be moved to the error state, but queries on those symbols
      were never notified. This led to deadlocks when such symbols were failed.
      
      This commit updates error logic to immediately fail queries on any symbol that
      has already been emitted if one of its dependencies fails.
      
      llvm-svn: 369976
      8853ac7e
    • Lang Hames's avatar
      [ORC] Fix an overly aggressive assert. · 8ec96618
      Lang Hames authored
      Symbols that have not been queried will not have MaterializingInfo entries,
      so remove the assert that all failed symbols should have these entries.
      Also updates the loop to only remove entries that were found earlier.
      
      llvm-svn: 369975
      8ec96618
    • Heejin Ahn's avatar
      [WebAssembly] Combine emscripten SjLj tests · 1266191d
      Heejin Ahn authored
      Summary:
      Combine a test in lower-em-sjlj-longjmp-only.ll into lower-em-sjlj.ll,
      because the test command is the same and I don't see any reason it
      should be a separate file. Also converted tabs into spaces and fixed
      indentations in lower-em-sjlj-sret.ll. (lower-em-sjlj.ll uses a
      different test command (llc), so it couldn't be combined)
      
      Reviewers: dschuff
      
      Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66728
      
      llvm-svn: 369974
      1266191d
    • Jessica Paquette's avatar
      [GlobalISel] Import patterns containing INSERT_SUBREG · 69400f86
      Jessica Paquette authored
      This teaches the importer to handle INSERT_SUBREG instructions.
      
      We were missing patterns involving INSERT_SUBREG in AArch64. It appears in
      AArch64InstrInfo.td 107 times, and 14 times in AArch64InstrFormats.td.
      
      To meaningfully import it, the GlobalISelEmitter needs to know how to infer a
      super register class for a given register class.
      
      This patch introduces the following:
      
      - `getSuperRegForSubReg`, a function which finds the largest register class
      which supports a value type and subregister index
      
      - `inferSuperRegisterClass`, a function which finds the appropriate super
      register class for an INSERT_SUBREG'
      
      - `inferRegClassFromPattern`, a function which allows for some trivial
      lookthrough into instructions
      
      - `getRegClassFromLeaf`, a helper function which returns the register class for
      a leaf `TreePatternNode`
      
      - Support for subregister index operands in `importExplicitUseRenderer`
      
      It also
      
      - Updates tests in each backend which are impacted by the change
      
      - Adds GlobalISelEmitterSubreg.td to test that we import and skip the expected
      patterns
      
      As a result of this patch, INSERT_SUBREG patterns in X86 may use the
      LOW32_ADDR_ACCESS_RBP register class instead of GR32. This is correct, since the
      register class contains the same registers as GR32 (except with the addition of
      RBP). So, this also teaches X86 to handle that register class. This is in line
      with X86ISelLowering, which treats this as a GR class.
      
      Differential Revision: https://reviews.llvm.org/D66498
      
      llvm-svn: 369973
      69400f86
    • Michael Kruse's avatar
      [ScopBuilder] Simplify main statement flag in buildEqivClassBlockStmts. NFC. · 88fd2d01
      Michael Kruse authored
      When reading code in ScopBuilder::buildEqivClassBlockStmts, I think the
      main statement flag computation can be simplified, here is the patch.
      It's based on two simple facts that:
      
        1. Instruction won't be removed once it's inserted into UnionFind.
        2. Main statement must be set if there is non-trivial statement besides the last one.
      
      The patch also saves std::find call.
      
      Patch by bin.narwal <bin.narwal@gmail.com>
      
      Differential Revision: https://reviews.llvm.org/D66477
      
      llvm-svn: 369972
      88fd2d01
    • Vitaly Buka's avatar
      Revert r369843 "[Testing] Unbreak r369830" · ba3d40a1
      Vitaly Buka authored
      That was not the fix.
      
      This reverts commit 8bcf690ae03db85608b2ea22eac7a91c84df4dc.
      
      llvm-svn: 369971
      ba3d40a1
    • Alex Langford's avatar
      [Core] GetAPInt should return an Optional · 5e777e1e
      Alex Langford authored
      The current implementation returns a bool for indicating success and
      whether or not the APInt passed by reference was populated. Instead of
      doing that, I think it makes more sense to return an Optional<APInt>.
      
      llvm-svn: 369970
      5e777e1e
    • Shafik Yaghmour's avatar
      Debug Info: Support for DW_AT_export_symbols for anonymous structs · 90e00bd8
      Shafik Yaghmour authored
      This implements the DWARF 5 feature described in:
      
      http://dwarfstd.org/ShowIssue.php?issue=141212.1
      
      To support recognizing anonymous structs:
      
        struct A {
          struct { // Anonymous struct
              int y;
          };
        } a
      
      This patch adds support for the new flag in constructTypeDIE(...) and test to verify this change.
      
      Differential Revision: https://reviews.llvm.org/D66605
      
      llvm-svn: 369969
      90e00bd8
    • Aaron Ballman's avatar
      Updating a test case that was missed in r369957. · 72797ba0
      Aaron Ballman authored
      llvm-svn: 369968
      72797ba0
    • Vedant Kumar's avatar
      [DWARF] Rename getDwarf5OrGNUCallSite{Attr,Tag}, NFC · 58a07148
      Vedant Kumar authored
      llvm-svn: 369967
      58a07148
    • Vedant Kumar's avatar
      [DWARF] Pick the DWARF5 OP_entry_value opcode on Darwin · 533dd021
      Vedant Kumar authored
      Use the GNU extension for OP_entry_value consistently (i.e. whenever GNU
      extensions are used for TAG_call_site).
      
      llvm-svn: 369966
      533dd021
    • Benjamin Kramer's avatar
      Remove unused variables. · 1e4241ca
      Benjamin Kramer authored
      llvm-svn: 369965
      1e4241ca
    • Vedant Kumar's avatar
      [DebugInfo] Add debug-entry-values test coverage, NFC · 91968d40
      Vedant Kumar authored
      Check that call site descriptions are emitted in dwarf4 + lldb +
      debug-entry-values mode.
      
      llvm-svn: 369964
      91968d40
    • Vedant Kumar's avatar
      [test] Remove extra spaces from a test, NFC · b37dfed5
      Vedant Kumar authored
      llvm-svn: 369963
      b37dfed5
    • Philip Reames's avatar
      Add a clarify comment for meaning of SafePointes [NFC] · cf3b5559
      Philip Reames authored
      Extracted from D66688 as requested.
      
      llvm-svn: 369962
      cf3b5559
    • Benjamin Kramer's avatar
      [ADT] Make StringRef(const char*) constexpr · 57effbda
      Benjamin Kramer authored
      This should let us get rid of StringLiteral in the long term and avoid
      chasing accidental StringRef globals once and for all.
      
      This requires C++14, I godbolted it on every compiler I know we support
      so I hope there won't be much fallout.
      
      llvm-svn: 369961
      57effbda
    • Aaron Ballman's avatar
      Fixing a weird copy-pasta to get bots back to green. · 3c5bd651
      Aaron Ballman authored
      llvm-svn: 369960
      3c5bd651
    • Philip Reames's avatar
      Preland test cases for D66688 to make diffs clear. · 2de97888
      Philip Reames authored
      llvm-svn: 369959
      2de97888
    • Duncan P. N. Exon Smith's avatar
      ContentCache: Drop getBuffer's dependency on SourceManager · f5848190
      Duncan P. N. Exon Smith authored
      Refactor ContentCache::IsSystemFile to IsFileVolatile, checking
      SourceManager::userFilesAreVolatile at construction time.  This is a
      step toward lowering ContentCache down from SourceManager to
      FileManager.
      
      No functionality change intended.
      
      https://reviews.llvm.org/D66713
      
      llvm-svn: 369958
      f5848190
    • Aaron Ballman's avatar
      Reword the C11 extension diagnostic. · 33d563e5
      Aaron Ballman authored
      This makes it more consistent with other language extension diagnostics.
      
      llvm-svn: 369957
      33d563e5
    • Alex Lorenz's avatar
      Fix gen-cdb-fragment test for Windows · 29f10822
      Alex Lorenz authored
      Windows bots didn't seem to like the empty argument, so I rewrote the test.
      
      llvm-svn: 369956
      29f10822
    • Sergey Dmitriev's avatar
      [Clang][Bundler] Use llvm-objcopy for creating fat object files · ed153ef0
      Sergey Dmitriev authored
      clang-offload-bundler currently uses partial linking for creating fat object files, but such technique cannot be used on Windows due to the absence of partial linking support in the linker. This patch changes implementation to use llvm-objcopy for merging device and host objects instead of doing partial linking. This is one step forward towards enabling OpenMP offload on Windows.
      
      Differential Revision: https://reviews.llvm.org/D66485
      
      llvm-svn: 369955
      ed153ef0
    • Aaron Ballman's avatar
      Diagnose use of _Thread_local as an extension when not in C11 mode. · 774bd6ef
      Aaron Ballman authored
      llvm-svn: 369954
      774bd6ef
    • Nico Weber's avatar
      gn build: Merge r369918 · 09df43ca
      Nico Weber authored
      llvm-svn: 369953
      09df43ca
    • Roland Froese's avatar
      Recommit [PowerPC] Update P9 vector costs for insert/extract · 18db4e9a
      Roland Froese authored
      Now that the v1i128 smin regression has been fixed, recommit the P9 cost
      updates from D60160.
      
      llvm-svn: 369952
      18db4e9a
    • Nico Weber's avatar
      gn build: color linker errors when using lld · b7046859
      Nico Weber authored
      llvm-svn: 369951
      b7046859
    • Nico Weber's avatar
      gn build: (manually) merge r369741 · d9117e4e
      Nico Weber authored
      llvm-svn: 369950
      d9117e4e
    • Philip Reames's avatar
      [InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null for vectors · b92c9710
      Philip Reames authored
      Extend the transform introduced in https://reviews.llvm.org/D66608 to work for vector geps as well.
      
      Differential Revision: https://reviews.llvm.org/D66671
      
      llvm-svn: 369949
      b92c9710
    • Nico Weber's avatar
      gn build: (manually) merge r369940 · 7e3d0434
      Nico Weber authored
      llvm-svn: 369948
      7e3d0434
    • Krzysztof Parzyszek's avatar
      [Hexagon] Improve generated code for test-if-bit-clear · 9e0feaf5
      Krzysztof Parzyszek authored
      llvm-svn: 369947
      9e0feaf5
    • Alexey Bataev's avatar
      [OPENMP][NVPTX]Fix critical region codegen. · 2cd7fafc
      Alexey Bataev authored
      Summary:
      Previously critical regions were emitted with the barrier making it a
      worksharing construct though it is not. Also, it leads to incorrect
      behavior in Cuda9+. Patch fixes this problem.
      
      Reviewers: ABataev, jdoerfert
      
      Subscribers: jholewinski, guansong, cfe-commits, grokos
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D66673
      
      llvm-svn: 369946
      2cd7fafc
    • Johannes Doerfert's avatar
      [Attributor] Adjust and test the iteration bound of tests · b504eb8b
      Johannes Doerfert authored
      Summary:
      Try to verify how many iterations we need for a fixpoint in our tests.
      This patch adjust the way we count to make it easier to follow. It also
      adjusts the bounds to actually account for a fixpoint and not only the
      minimum number to pass all checks.
      
      Reviewers: uenoku, sstefan1
      
      Subscribers: hiraditya, bollu, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66757
      
      llvm-svn: 369945
      b504eb8b
    • Richard Smith's avatar
      [msvc] Add necessary #include to make compiler intrinsics available. · 4d3a3366
      Richard Smith authored
      llvm-svn: 369944
      4d3a3366
    • Duncan P. N. Exon Smith's avatar
      FileManager: Use llvm::Expected in new getFileRef API · 9ef6c49b
      Duncan P. N. Exon Smith authored
      `FileManager::getFileRef` is a modern API which we expect to convert to
      over time.  We should modernize the error handling as well, using
      `llvm::Expected` instead of `llvm::ErrorOr`, to help clients that care
      about errors to ensure nothing is missed.
      
      However, not all clients care.  I've also added another path for those
      that don't:
      
      - `FileEntryRef` is now copy- and move-assignable (using a pointer
        instead of a reference).
      - `FileManager::getOptionalFileRef` returns an `llvm::Optional` instead
        of `llvm::Expected`.
      - Added an `llvm::expectedToOptional` utility in case this is useful
        elsewhere.
      
      https://reviews.llvm.org/D66705
      
      llvm-svn: 369943
      9ef6c49b
    • Craig Topper's avatar
      [X86] Add a hack to combinePMULDQ to manually turn... · 36d1588f
      Craig Topper authored
      [X86] Add a hack to combinePMULDQ to manually turn SIGN_EXTEND_VECTOR_INREG/ZERO_EXTEND_VECTOR_INREG inputs into an ANY_EXTEND_VECTOR_INREG style shuffle
      
      ANY_EXTEND_VECTOR_INREG isn't currently marked Legal which prevents SimplifyDemandedBits from turning SIGN/ZERO_EXTEND_VECTOR_INREG into it after op legalization. And even if we did make it Legal, combineExtInVec doesn't do shuffle combining on the VECTOR_INREG nodes until AVX1.
      
      This patch adds a quick hack to combinePMULDQ to directly emit a vector shuffle corresponding to an ANY_EXTEND_VECTOR_INREG operation. This avoids both of those issues without creating any other regressions on our tests. The xop-ifma.ll change here also showed up when I tried to resurrect D56306 and seemed to be the only improvement that patch creates now. This is a more direct way to get the benefit.
      
      Differential Revision: https://reviews.llvm.org/D66436
      
      llvm-svn: 369942
      36d1588f
    • Richard Smith's avatar
      Fix file header. · ac1d5986
      Richard Smith authored
      llvm-svn: 369941
      ac1d5986
    • Richard Smith's avatar
      Improve behavior in the case of stack exhaustion. · 26a92d58
      Richard Smith authored
      Summary:
      Clang performs various recursive operations (such as template instantiation),
      and may use non-trivial amounts of stack space in each recursive step (for
      instance, due to recursive AST walks). While we try to keep the stack space
      used by such steps to a minimum and we have explicit limits on the number of
      such steps we perform, it's impractical to guarantee that we won't blow out the
      stack on deeply recursive template instantiations on complex ASTs, even with
      only a moderately high instantiation depth limit.
      
      The user experience in these cases is generally terrible: we crash with
      no hint of what went wrong. Under this patch, we attempt to do better:
      
       * Detect when the stack is nearly exhausted, and produce a warning with a
         nice template instantiation backtrace, telling the user that we might
         run slowly or crash.
      
       * For cases where we're forced to trigger recursive template
         instantiation in arbitrarily-deeply-nested contexts, check whether
         we're nearly out of stack space and allocate a new stack (by spawning
         a new thread) after producing the warning.
      
      Reviewers: rnk, aaron.ballman
      
      Subscribers: mgorny, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D66361
      
      llvm-svn: 369940
      26a92d58