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