1. Jun 15, 2021
  2. Jun 11, 2021
    • Yonghong Song's avatar
      BPF: generate proper BTF for globals with WeakODRLinkage · 5b149c43
      Yonghong Song authored
      For a global weak symbol defined as below:
        char g __attribute__((weak)) = 2;
      LLVM generates an allocated global with WeakAnyLinkage,
      for which BPF backend generates proper BTF info.
      
      For the above example, if a modifier "const" is added like
        const char g __attribute__((weak)) = 2;
      LLVM generates an allocated global with WeakODRLinkage,
      for which BPF backend didn't generate any BTF as it
      didn't handle WeakODRLinkage.
      
      This patch addes support for WeakODRLinkage and proper
      BTF info can be generated for weak symbol defined with
      "const" modifier.
      
      Differential Revision: https://reviews.llvm.org/D100362
      
      (cherry picked from commit 968292cb)
      5b149c43
    • Yonghong Song's avatar
      BPF: add extern func to data sections if specified · 7f6ceec9
      Yonghong Song authored
      This permits extern function (BTF_KIND_FUNC) be added
      to BTF_KIND_DATASEC if a section name is specified.
      For example,
      
      -bash-4.4$ cat t.c
      void foo(int) __attribute__((section(".kernel.funcs")));
      int test(void) {
        foo(5);
        return 0;
      }
      
      The extern function foo (BTF_KIND_FUNC) will be put into
      BTF_KIND_DATASEC with name ".kernel.funcs".
      
      This will help to differentiate two kinds of external functions,
      functions in kernel and functions defined in other bpf programs.
      
      Differential Revision: https://reviews.llvm.org/D93563
      
      (cherry picked from commit 886f9ff5)
      7f6ceec9
    • Ilya Leoshkevich's avatar
      [BPF] Add support for floats and doubles · 319a27b4
      Ilya Leoshkevich authored
      Some BPF programs compiled on s390 fail to load, because s390
      arch-specific linux headers contain float and double types. At the
      moment there is no BTF_KIND for floats and doubles, so the release
      version of LLVM ends up emitting type id 0 for them, which the
      in-kernel verifier does not accept.
      
      Introduce support for such types to libbpf by representing them using
      the new BTF_KIND_FLOAT.
      
      Reviewed By: yonghong-song
      
      Differential Revision: https://reviews.llvm.org/D83289
      
      (cherry picked from commit a7137b23)
      319a27b4
  3. Jun 10, 2021
  4. Jun 09, 2021
  5. Jun 05, 2021
    • Qiu Chaofan's avatar
      [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++ · 0826268d
      Qiu Chaofan authored
      Reviewed By: nemanjai
      
      Differential Revision: https://reviews.llvm.org/D103386
      
      (cherry picked from commit c0b30718)
      0826268d
    • Heejin Ahn's avatar
      [WebAssembly] Ignore filters in Emscripten EH landingpads · 6a86669a
      Heejin Ahn authored
      We have been handling filters and landingpads incorrectly all along. We
      pass clauses' (catches') types to `__cxa_find_matching_catch` in JS glue
      code, which returns the thrown pointer and sets the selector using
      `setTempRet0()`.
      
      We apparently have been doing the same for filters' (exception specs')
      types; we pass them to `__cxa_find_matching_catch` just the same way as
      clauses. And `__cxa_find_matching_catch` treats all given types as
      clauses. So it is a little surprising; maybe we intended to do something
      from the JS side and didn't end up doing?
      
      So anyway, I don't think supporting exception specs in Emscripten EH is
      a priority, but this can actually cause incorrect results for normal
      catches when functions are inlined and the inlined spec type has a
      parent-child relationship with the catch's type.
      
      ---
      
      The below is an example of a bug that can happen when inlining and class
      hierarchy is mixed. If you are busy you can skip this part:
      ```
      struct A {};
      struct B : A {};
      
      void bar() throw (B) { throw B(); }
      
      void foo() {
        try {
          bar();
        } catch (A &) {
          fputs ("Expected result\n", stdout);
        }
      }
      ```
      
      In the unoptimized code, `bar`'s landingpad will have a filter for `B`
      and `foo`'s landingpad will have a clause for `A`. But when `bar` is
      inlined into `foo`, `foo`'s landingpad has both a filter for `B` and a
      clause for `A`, and it passes the both types to
      `__cxa_find_matching_catch`:
      ```
      __cxa_find_matching_catch(typeinfo for B, typeinfo for A)
      ```
      `__cxa_find_matching_catch` thinks both are clauses, and looks at the
      first type `B`, which belongs to a filter. And the thrown type is `B`,
      so it thinks the first type `B` is caught. But this makes it return an
      incorrect selector, because it is supposed to catch the exception using
      the second type `A`, which is a parent of `B`. As a result, the `foo` in
      the example program above does not print "Expected result" but just
      throws the exception to the caller. (This wouldn't have happened if `A`
      and `B` are completely disjoint types, such as `float` and `int`)
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=50357.
      
      Reviewed By: dschuff, kripken
      
      Differential Revision: https://reviews.llvm.org/D102795
      
      (cherry picked from commit 412a3381)
      6a86669a
    • Harald van Dijk's avatar
      [libc++] [test] Fix a few tests for 32-bit x86 · f1b1151b
      Harald van Dijk authored
      Fixes bug https://llvm.org/PR48939.
      
      Differential Revision: https://reviews.llvm.org/D102359
      
      (cherry picked from commit 73cdc759)
      f1b1151b
    • Qiu Chaofan's avatar
      [SPE] Disable strict-fp for SPE by default · 6279fd11
      Qiu Chaofan authored
      As discussed in PR50385, strict-fp on PowerPC SPE has not been handled
      well. This patch disables it by default for SPE.
      
      Reviewed By: nemanjai, vit9696, jhibbits
      
      Differential Revision: https://reviews.llvm.org/D103235
      
      (cherry picked from commit 5c18d113)
      6279fd11
  6. Jun 04, 2021
    • mydeveloperday's avatar
      [clang-format] PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the ColumnLimit · e6735937
      mydeveloperday authored
      https://bugs.llvm.org/show_bug.cgi?id=50326
      
      {D93626} caused a regression in terms of formatting a function ptr, incorrectly thinking it was a C-Style cast.
      
      This cased a formatter regression between clang-format-11 and clang-format-12
      
      ```
      void bar()
      {
          size_t foo = function(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong);
      
          size_t foo = function(
              Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong,
              FoooooooooLooooong);
      
          size_t foo = (*(function))(Foooo, Barrrrr, Foooo, FoooooooooLooooong);
      
          size_t foo = (*(
              function))(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong,
              BarrrrrrrrrrrrLong, FoooooooooLooooong);
      }
      ```
      
      became
      
      ```
      void bar()
      {
          size_t foo1 = function(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong);
      
          size_t foo2 = function(
              Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong,
              FoooooooooLooooong);
      
          size_t foo3 = (*(function))(Foooo, Barrrrr, Foooo, FoooooooooLooooong);
      
          size_t foo4 = (*(
              function))(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong, FoooooooooLooooong);
      }
      ```
      
      This fixes this issue by simplify the clause to be specific about what is wanted rather than what is not.
      
      Reviewed By: curdeius, HazardyKnusperkeks
      
      Differential Revision: https://reviews.llvm.org/D102392
      
      (cherry picked from commit eae445f6)
      e6735937
    • Stefan Pintilie's avatar
      [PowerPC] Handle inline assembly clobber of link regsiter · f2ce10d1
      Stefan Pintilie authored
      This patch adds the handling of clobbers of the link register LR for inline
      assembly.
      
      This patch is to fix:
      https://bugs.llvm.org/show_bug.cgi?id=50147
      
      Reviewed By: nemanjai, #powerpc
      
      Differential Revision: https://reviews.llvm.org/D101657
      
      (cherry picked from commit 15051f0b)
      f2ce10d1
    • William S. Moses's avatar
      [MemoryDependence] Fix invariant group store · 77b63ce5
      William S. Moses authored
      Fix bug in MemoryDependence [and thus GVN] for invariant group.
      
      Previously MemDep didn't verify that the store was storing into a
      pointer rather than a store simply using a pointer.
      
      Differential Revision: https://reviews.llvm.org/D98267
      
      (cherry picked from commit 875891a1)
      77b63ce5
  7. May 25, 2021
  8. May 20, 2021
    • Roman Lebedev's avatar
      ~(C + X) --> ~C - X (PR50308) · 4973ce53
      Roman Lebedev authored
      We can not rely on (C+X)-->(X+C) already happening,
      because we might not have visited that `add` yet.
      The added testcase would get stuck in an endless combine loop.
      
      (cherry-picked from 554b1bce)
      4973ce53
  9. May 18, 2021
    • Nick Desaulniers's avatar
      [LowerConstantIntrinsics] reuse isManifestLogic from ConstantFolding · de579bae
      Nick Desaulniers authored
      GlobalVariables are Constants, yet should not unconditionally be
      considered true for __builtin_constant_p.
      
      Via the LangRef
      https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic:
      
          This intrinsic generates no code. If its argument is known to be a
          manifest compile-time constant value, then the intrinsic will be
          converted to a constant true value. Otherwise, it will be converted
          to a constant false value.
      
          In particular, note that if the argument is a constant expression
          which refers to a global (the address of which _is_ a constant, but
          not manifest during the compile), then the intrinsic evaluates to
          false.
      
      Move isManifestConstant from ConstantFolding to be a method of
      Constant so that we can reuse the same logic in
      LowerConstantIntrinsics.
      
      pr/41459
      
      Reviewed By: rsmith, george.burgess.iv
      
      Differential Revision: https://reviews.llvm.org/D102367
      
      (cherry picked from commit 8c72749b)
      de579bae
  10. May 13, 2021
  11. May 12, 2021
  12. May 11, 2021
  13. May 08, 2021