1. Dec 17, 2022
    • Paul Robinson's avatar
      Undo one llvm::Optional => std::optional · 08c8280d
      Paul Robinson authored
      Using std::optional in Support/TypeTraitsTest.cpp causes gcc 7.5 to
      complain. No public bots run a gcc that old, but we have internal bots
      that do.
      
      /home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp: In instantiation of ‘void {anonymous}::triviality::TrivialityTester() [with T = std::optional<int>; bool IsTriviallyCopyConstructible = true; bool IsTriviallyMoveConstructible = true]’:
      /home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp:121:52:   required from here
      /home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp:29:3: error: static assertion failed: Mismatch in expected trivial copy construction!
         static_assert(llvm::is_trivially_copy_constructible<T>::value ==
         ^~~~~~~~~~~~~
      /home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp:32:3: error: static assertion failed: Mismatch in expected trivial move construction!
         static_assert(llvm::is_trivially_move_constructible<T>::value ==
         ^~~~~~~~~~~~~
      08c8280d
    • Matt Arsenault's avatar
      AArch64: Stop storing MachineFunction in MachineFunctionInfo · 588ecc11
      Matt Arsenault authored
      The constructor should not depend on the MachineFunction
      588ecc11
    • Roman Lebedev's avatar
    • Roman Lebedev's avatar
      [NFC][InstCombine] Add miscompile reproducer from https://reviews.llvm.org/D139275#4001580 · bece10c0
      Roman Lebedev authored
      SimplifyCFG change is correct and not at fault here.
      The actual miscompile appears to be happening in InstCombine.
      
      ```
      $ /builddirs/llvm-project/build-Clang15/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -passes='tv,instcombine,tv' -o /dev/null /repositories/llvm-project/llvm/test/Transforms/InstCombine/D139275_c4001580.ll
      
      ----------------------------------------
      define float @D139275_c4001580(float %arg) {
      %0:
        %i = fcmp ugt float %arg, 0.000000
        %i1 = fcmp ult float %arg, 1.000000
        %i2 = and i1 %i, %i1
        %i3 = fcmp uge float %arg, 0.100000
        %i4 = xor i1 %i, %i2
        %i5 = select i1 %i4, float 0.100000, float 0.000000
        %i6 = and i1 %i3, %i2
        %i7 = fadd float %arg, -0.100000
        %i8 = select i1 %i6, float %i7, float %i5
        ret float %i8
      }
      =>
      define float @D139275_c4001580(float %arg) {
      %0:
        %i = fcmp ugt float %arg, 0.000000
        %i1 = fcmp ult float %arg, 1.000000
        %i2 = and i1 %i, %i1
        %i3 = fcmp uge float %arg, 0.100000
        %i7 = fadd float %arg, -0.100000
        %i5 = select i1 %i3, float %i7, float 0.100000
        %i8 = select i1 %i2, float %i5, float 0.000000
        ret float %i8
      }
      Transformation doesn't verify! (unsound)
      ERROR: Value mismatch
      
      Example:
      float %arg = #x3dcbb820 (0.099472284317?)
      
      Source:
      i1 %i = #x1 (1)
      i1 %i1 = #x1 (1)
      i1 %i2 = #x1 (1)
      i1 %i3 = #x0 (0)
      i1 %i4 = #x0 (0)
      float %i5 = #x00000000 (+0.0)
      i1 %i6 = #x0 (0)
      float %i7 = #xba0a5680 (-0.000527717173?)
      float %i8 = #x00000000 (+0.0)
      
      Target:
      i1 %i = #x1 (1)
      i1 %i1 = #x1 (1)
      i1 %i2 = #x1 (1)
      i1 %i3 = #x0 (0)
      float %i7 = #xba0a5680 (-0.000527717173?)
      float %i5 = #x3dcccccd (0.100000001490?)
      float %i8 = #x3dcccccd (0.100000001490?)
      Source value: #x00000000 (+0.0)
      Target value: #x3dcccccd (0.100000001490?)
      
      Pass: (anonymous namespace)::TVPass
      Command line: '/builddirs/llvm-project/build-Clang15/bin/opt' '-load' '/repositories/alive2/build-Clang-release/tv/tv.so' '-load-pass-plugin' '/repositories/alive2/build-Clang-release/tv/tv.so' '-passes=tv,instcombine,tv' '-o' '/dev/null' '/repositories/llvm-project/llvm/test/Transforms/InstCombine/D139275_c4001580.ll'
      
      Alive2: Transform doesn't verify!
      
      ```
      bece10c0
    • Florian Hahn's avatar
      [llvm-profgen] Fix build failure after 5d7950a4. · e2b9cd79
      Florian Hahn authored
      This fixes a build failure with libc++
      (`error: no matching function for call to 'max')`
      e2b9cd79
    • Paul Robinson's avatar
      [asan] Convert tests to check 'target=...' · abd09754
      Paul Robinson authored
      Part of the project to eliminate special handling for triples in lit
      expressions.
      abd09754
    • Peter Klausler's avatar
      [flang] Catch bad usage of POINTER attribute · 6f6af76b
      Peter Klausler authored
      Most attributes apply to only object or only procedure entities,
      and attempts to apply them to other kinds of symbol table entries
      are caught in name resolution when ConvertToObjectEntity() or
      ConvertToProcEntity() fails.  However, the POINTER attribute can
      be applied to both, and name resolution can't perform that conversion
      yet, and as a result we don't catch many kinds of silly errors.
      Fix by ensuring that the symbol is of a type that could eventually
      become an object or procedure entity if it is not one already.
      
      Differential Revision: https://reviews.llvm.org/D140137
      6f6af76b
    • LLVM GN Syncbot's avatar
      [gn build] Port 5d7950a4 · c0c909ee
      LLVM GN Syncbot authored
      c0c909ee
    • Hongtao Yu's avatar
      [CSSPGO][llvm-profgen] Missing frame inference. · 5d7950a4
      Hongtao Yu authored
      This change introduces a missing frame inferrer aiming at fixing missing frames. It current only handles missing frames due to the compiler tail call elimination (TCE) but could also be extended to supporting other scenarios like frame pointer omission. When a tail called function is sampled, the caller frame will be missing from the call chain because the caller frame is reused for the callee frame. While TCE is beneficial to both perf and reducing stack overflow, a workaround being made in this change aims to find back the missing frames as much as possible.
      
      The idea behind this work is to build a dynamic call graph that consists of only tail call edges constructed from LBR samples and DFS-search for a unique path for a given source frame and target frame on the graph. The unique path will be used to fill in the missing frames between the source and target. Note that only a unique path counts. Multiple paths are treated unreachable since we don't want to overcount for any particular possible path.
      
      A switch --infer-missing-frame is introduced and defaults to be on.
      
      Some testing results:
      - 0.4% perf win according to three internal benchmarks.
      - About 2/3 of the missing tail call frames can be recovered, according to an internal benchmark.
      - 10% more profile generation time.
      
      Reviewed By: wenlei
      
      Differential Revision: https://reviews.llvm.org/D139367
      5d7950a4
    • Kai Nacke's avatar
      [PowerPC][NFC] Fix typos in PPCISelDAGToDAG · 44fe4e25
      Kai Nacke authored
      Change:
      negtive -> negative
      is -> are
      
      Thanks to tschuett for finding these.
      44fe4e25
    • Roman Lebedev's avatar
      [SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes (take 3) · cfd594f8
      Roman Lebedev authored
      * This is a recommit of 3c4d2a03,
      * which was reverted in 25f01d59,
        because it exposed a miscompile in PPC backend,  which was resolved
        in https://reviews.llvm.org/D140089 / cb3f415c.
      * which was a recommit of cf624b23,
      * which was reverted in 5cfc22ca,
        because the cut-off on the number of vector elements was not low enough,
        and it triggered both SDAG SDNode operand number assertions,
        5and caused compile time explosions in some cases.
      
      Let's try with something really *REALLY* conservative first,
      just to get somewhere, and try to bump it later.
      
      FIXME: should this respect TTI reg width * num vec regs?
      
      Original commit message:
      
      Now, there's a big caveat here - these bytes
      are abstract bytes, not the i8 we have in LLVM,
      so strictly speaking this is not exactly legal,
      see e.g. https://github.com/AliveToolkit/alive2/issues/860
      ^ the "bytes" "could" have been a pointer,
      and loading it as an integer inserts an implicit ptrtoint.
      
      But at the same time,
      InstCombine's `InstCombinerImpl::SimplifyAnyMemTransfer()`
      would expand a memtransfer of 1/2/4/8 bytes
      into integer-typed load+store,
      so this isn't exactly a new problem.
      
      Note that in memory, poison is byte-wise,
      so we really can't widen elements,
      but SROA seems to be inconsistent here.
      
      Fixes #59116.
      cfd594f8
    • Alexander Kornienko's avatar
      Revert "[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in... · 37b8f09a
      Alexander Kornienko authored
      Revert "[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in common successor block"
      
      This reverts commit 1bd0b82e, since it leads to
      miscompiles. See https://reviews.llvm.org/D139275#3993229 and
      https://reviews.llvm.org/D139275#4001580.
      37b8f09a
    • Roy Sundahl's avatar
      Revert "[Driver] Remove Joined -X" · 7f8bd8ac
      Roy Sundahl authored
      This change is breaking internal builds. We use the -Xfoo pattern but can
      now no longer manage whether we allow an unused -Xfoo option to pass as a
      warning or promote it to an error.
      
      This reverts commit 98615fd3.
      
      Reviewed By: davide
      
      Differential Revision: https://reviews.llvm.org/D139717
      7f8bd8ac
  2. Dec 16, 2022