1. Apr 05, 2020
  2. Apr 04, 2020
    • Tamás Zolnai's avatar
      [clang-tidy]: fix false positive of cert-oop54-cpp check. · 0f9e1e3a
      Tamás Zolnai authored
      Summary:
      It seems we need a different matcher for binary operator
      in a template context.
      
      Fixes this issue:
      https://bugs.llvm.org/show_bug.cgi?id=44499
      
      Reviewers: aaron.ballman, alexfh, hokein, njames93
      
      Reviewed By: aaron.ballman
      
      Subscribers: xazax.hun, cfe-commits
      
      Tags: #clang, #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D76990
      0f9e1e3a
    • Heejin Ahn's avatar
      [WebAssembly] Fix wasm.lsda() optimization in WasmEHPrepare · 2e983972
      Heejin Ahn authored
      Summary:
      When we insert a call to the personality function wrapper
      (`_Unwind_CallPersonality`) for a catch pad, we store some necessary
      info in `__wasm_lpad_context` struct and pass it. One of the info is the
      LSDA address for the function. For this, we insert a call to
      `wasm.lsda()`, which will be lowered down to the address of LSDA, and
      store it in a field in `__wasm_lpad_context`.
      
      There are exceptions to this personality call insertion: catchpads for
      `catch (...)` and cleanuppads (for destructors) don't need personality
      function calls, because we don't need to figure out whether the current
      exception should be caught or not. (They always should.)
      
      There was a little optimization to `wasm.lsda()` call insertion. Because
      the LSDA address is the same throughout a function, we don't need to
      insert a store of `wasm.lsda()` return value in every catchpad. For
      example:
      ```
      try {
        foo();
      } catch (int) {
        // wasm.lsda() call and a store are inserted here, like, in
        // pseudocode,
        // %lsda = wasm.lsda();
        // store %lsda to a field in __wasm_lpad_context
        try {
          foo();
        } catch (int) {
          // We don't need to insert the wasm.lsda() and store again, because
          // to arrive here, we have already stored the LSDA address to
          // __wasm_lpad_context in the outer catch.
        }
      }
      ```
      So the previous algorithm checked if the current catch has a parent EH
      pad, we didn't insert a call to `wasm.lsda()` and its store.
      
      But this was incorrect, because what if the outer catch is `catch (...)`
      or a cleanuppad?
      ```
      try {
        foo();
      } catch (...) {
        // wasm.lsda() call and a store are NOT inserted here
        try {
          foo();
        } catch (int) {
          // We need wasm.lsda() here!
        }
      }
      ```
      In this case we need to insert `wasm.lsda()` in the inner catchpad,
      because the outer catchpad does not have one.
      
      To minimize the number of inserted `wasm.lsda()` calls and stores, we
      need a way to figure out whether we have encountered `wasm.lsda()` call
      in any of EH pads that dominates the current EH pad. To figure that
      out, we now visit EH pads in BFS order in the dominator tree so that we
      visit parent BBs first before visiting its child BBs in the domtree.
      
      We keep a set named `ExecutedLSDA`, which basically means "Do we have
      `wasm.lsda()` either in the current EH pad or any of its parent EH
      pads in the dominator tree?". This is to prevent scanning the domtree up
      to the root in the worst case every time we examine an EH pad: each EH
      pad only needs to examine its immediate parent EH pad.
      
      - If any of its parent EH pads in the domtree has `wasm.lsda()`, this
        means we don't need `wasm.lsda()` in the current EH pad. We also insert
        the current EH pad in `ExecutedLSDA` set.
      - If none of its parent EH pad has `wasm.lsda()`
        - If the current EH pad is a `catch (...)` or a cleanuppad, done.
        - If the current EH pad is neither a `catch (...)` nor a cleanuppad,
          add `wasm.lsda()` and the store in the current EH pad, and add the
          current EH pad to `ExecutedLSDA` set.
      
      Reviewers: dschuff
      
      Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77423
      2e983972
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
      [X86][SSE] lowerV8I16Shuffle - lower compaction shuffles using PACKUSDW(PBLENDW,PBLENDW) on SSE41+ · e5e719d8
      Simon Pilgrim authored
      Similar to the lowerV16I8Shuffle implementation, for binary compaction v8i16 shuffles we can avoid the PUNPCKLDQ(PSHUFB,PSHUFB) pattern on SSE41+ targets by using PACKUSDW and PBLENDW. Before SSE41 we would need to use PACKSSDW but that requires sign extension that seems to destroy any gains, even on targets without PSHUFB.
      
      This is a bigger gain on AMD than Intel targets but should never be a regression, and avoiding the shuffle mask load(s) is always useful.
      
      Noticed in codegen while dealing with PR31443.
      e5e719d8
    • Nikita Popov's avatar
      [IRBuilder] Move some code into the cpp file; NFC · b90ea4f3
      Nikita Popov authored
      Since D73835 we no longer need to define the whole IRBuilder
      implementation in the header. This patch moves some of the larger
      methods out of line, into the C++ file.
      
      Differential Revision: https://reviews.llvm.org/D77332
      b90ea4f3
    • Nikita Popov's avatar
      [VNCoercion] Use IRBuilderBase; NFC · 6896d559
      Nikita Popov authored
      And remove include from header.
      6896d559
    • vgxbj's avatar
      [Object] object::ELFObjectFile::dynamic_symbol_begin(): skip symbol index 0 · 541bead8
      vgxbj authored
      Summary:
      Note: This revision is very similar to D62296.
      
      In D75756, we need `getDynamicSymbolIterators()` to skip first NULL symbol in `.dynsym`. And I believe it might be worth pointing this out in a separate patch to gather you experts' opinions.
      
      I have checked that current code base will not be affected by this change.
      
      ```
      dynamic_symbol_begin()
      |- dynamic_symbol_end(): Ok
      `- getDynamicSymbolIterators()
         |- addDynamicElfSymbols(): llvm/tools/llvm-objdump/llvm-objdump.cpp, Line 934
         |                          Ok, NULL symbol will be omitted by Line 945-947
         |                          StringRef Name = unwrapOrError(Symbol.getName(), Obj->getName());
         |                          if (Name.empty()) continue;
         |- dumpSymbolNameFromObject(): llvm/tools/llvm-nm/llvm-nm.cpp, Line 1192
         |                          There's no test for dumping dynamic debugging symbol. This patch helps improve llvm-nm behavior. (we should add test for this later)
         `- computeSymbolSizes(): llvm/lib/Object/SymbolSize.cpp, Line 52
            |- OProfileJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp, Line 92
            |                                                  Ok, NULL symbol will be omitted by Line 94-95
            |                                                  if (!Sym.getType() || *Sym.getType() != SF_Function) continue;
            |- IntelJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp, Line 98
            |                                               Ok, NULL symbol will be omitted by Line 124-126 (same as previous one)
            |- PerfJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp, Line 244
            |                                              Ok, NULL symbol will be omitted by Line 254-256, (same as previous one)
            |- SymbolizableObjectFile::create(): llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp, Line 73
            |                                    Ok, NULL symbol will be omitted by Line 75
            |                                    res->addSymbol()
            |                                    In addSymbol(), Line 167-168
            |                                    if (!Sec || (Obj && Obj->section_end() == *Sec)) return std::error_code();
            |- dumpCXXData(): llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp, Line 189
            |                 Ok, NULL symbol will be omitted by Line 199-202
            |                 object::section_iterator SecI = *SecIOrErr;
            |                 // Skip external symbols.
            |                 if (SecI == Obj->section_end())
            |                   continue;
            `- printLineInfoForInput(): llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp, Line 418
                                        Ok, NULL symbol will be omitted by Line 430-477
                                        if (Type == object::SymbolRef::ST_Function) {
                                          ...
                                        }
      ```
      
      Reviewers: grimar, jhenderson, MaskRay
      
      Reviewed By: jhenderson, MaskRay
      
      Subscribers: rupprecht, arphaman, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D76081
      541bead8
    • Nikita Popov's avatar
      [Reassociate] Use IRBuilderBase; NFC · ebd5a1b0
      Nikita Popov authored
      And remove now unnecessary IRBuilder.h include in header.
      ebd5a1b0
    • Nikita Popov's avatar
      [IVDescriptors] Remove IRBuilder.h include; NFC · 1055e9e3
      Nikita Popov authored
      IVDescriptors.h itself does not reference IRBuilder at all.
      Move the include into transformation passes that do.
      1055e9e3
    • Nikita Popov's avatar
      [IVDescriptors] Remove unnecessary DemandedBits.h include; NFC · a5eb1236
      Nikita Popov authored
      Forward declare DemandedBits in IVDescriptors, and move include
      into the cpp file. Also drop the include from LoopUtils, which
      does not need it at all.
      a5eb1236
    • Eric Fiselier's avatar
      62f3a965
    • Sam McCall's avatar
      [clangd] Tweak parseDocumentation loop to use raw lines. NFC · ebd522aa
      Sam McCall authored
      This clears the way for the raw lines themselves to be parsed easily.
      
      (Okay, one functional change: fix punctuation linebreaks with trailing WS)
      ebd522aa
    • Sam McCall's avatar
      [clang] Annotate trivial getters and setters on hover. · a975fde2
      Sam McCall authored
      Summary: (Only if their definitions are visible and they have no other docs)
      
      Reviewers: kadircet
      
      Subscribers: jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D77408
      a975fde2
    • Frederik Gossen's avatar
      [MLIR] Fix shape inference in toy tutorial · 1a2370bf
      Frederik Gossen authored
      The implementation of shape inference in the toy tutorial did not conform to the correct algorithmic description.
      The result was only correct because all operations appear to be processed in sequence.
      
      Differential Revision: https://reviews.llvm.org/D77382
      1a2370bf
    • Matt Arsenault's avatar
    • Mehdi Amini's avatar
      1ce0bc39
    • Richard Smith's avatar
      Don't treat a CXXScopeSpec with a nested name specifier but no location · 179f4bab
      Richard Smith authored
      as invalid.
      
      We create those when forming trivial type source information with no
      associated location, which, unfortunately, we do create in some cases
      (when a TreeTransform with no base location is used to transform a
      QualType).
      
      This would previously lead to rejects-valid bugs when we misinterpreted
      these constructs as having no nested-name-specifier.
      179f4bab
    • Frederik Gossen's avatar
      Fix typos in toy tutorial · 0f37454c
      Frederik Gossen authored
       Fix two typos throughout the chapters.
      
      Differential Revision: https://reviews.llvm.org/D77397
      0f37454c
    • Kazuaki Ishizaki's avatar
      [OpenMP] NFC: Fix trivial typo · 42016791
      Kazuaki Ishizaki authored
      Differential Revision: https://reviews.llvm.org/D77430
      42016791
    • Jim Ingham's avatar
      The thread plan list test is failing at least on Ubuntu Linux. · 32707481
      Jim Ingham authored
      Mark it expected fail for now.
      
      The test output shows that the "internal" thread listing isn't showing the
      step out plan that we use to step back out of a function we're stepping into.
      The internal plan listing code has nothing platform specific in it, so that
      isn't the problem.
      
      I am pretty sure the difference is that on MacOS we step into the function and then need to
      step back out again so we push the internal plan the test is checking for.  But on Linux we
      are able to step past the function without stepping into it.
      
      So nothing is actually going wrong here, I just need to find a better test case where I
      can ensure we are going to have to push a private plan.  It's probably better to test this
      using a custom thread plan, then I can control the state of the plan stack better.
      
      That's for Monday...
      32707481
    • Walter Erquinigo's avatar
      Fix LLDB debug builds · 96612252
      Walter Erquinigo authored
      Summary:
      A recent change in ThreadPlans introduced this little compilation error.
      Seems to be related to the work around https://reviews.llvm.org/D76814.
      
      Reviewers: clayborg, labath, jingham
      
      Reviewed By: jingham
      
      Subscribers: lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D77450
      96612252
    • River Riddle's avatar
      [mlir][DeclarativeParser] Emit an error if a `:` follows an attribute with a non-constant type. · e3bb3637
      River Riddle authored
      Summary: The attribute grammar includes an optional trailing colon type, so for attributes without a constant buildable type this will generally lead to unexpected and undesired behavior. Given that, it's better to just error out on these cases.
      
      Differential Revision: https://reviews.llvm.org/D77293
      e3bb3637
    • Walter Erquinigo's avatar
      [source maps] Fix remove, insert-after and replace · ca47ac3d
      Walter Erquinigo authored
      Summary:
      In this diff of mine D77186 I introduce a bug in the replace operation, where I was failing fast by mistake.
      Besides, a similar problem existed in the insert-after operation, where it was failing fast.
      
      Finally, the remove operation was wrong, as it was not using the indices provided by the users.
      
      I fixed those issues and added some tests account for cases with multiple elements in these requests.
      
      Reviewers: labath, clayborg
      
      Reviewed By: labath
      
      Subscribers: mgrang, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D77324
      ca47ac3d
    • River Riddle's avatar
      [mlir] Change the default of `mlir-print-op-on-diagnostic` to true · 79afdfab
      River Riddle authored
      Summary: It is a very common user trap to think that the location printed along with the diagnostic is the same as the current operation that caused the error. This revision changes the behavior to always print the current operation, except for when diagnostics are being verified. This is achieved by moving the command line flags in IR/ to be options on the MLIRContext.
      
      Differential Revision: https://reviews.llvm.org/D77095
      79afdfab
    • Nemanja Ivanovic's avatar
      [NFC][PowerPC] Pre-commit a test case for D77448 · 56246b24
      Nemanja Ivanovic authored
      Pre-committing the new test case so the review shows only the diffs.
      56246b24
    • Richard Smith's avatar
      PR45402: Make the restrictions on constant evaluation of memcmp and · 4ede8879
      Richard Smith authored
      memchr consistent and comprehensible, and document them.
      
      We previously allowed evaluation of memcmp on arrays of integers of any
      size, so long as the call evaluated to 0, and allowed evaluation of
      memchr on any array of integral type of size 1 (including enums). The
      purpose of constant-evaluating these builtins is only to support
      constexpr std::char_traits, so we now consistently allow them on arrays
      of (possibly signed or unsigned) char only.
      4ede8879