1. Mar 04, 2021
    • Johannes Doerfert's avatar
      [Attributor] Use known alignment as lower bound to avoid work · f3f88287
      Johannes Doerfert authored
      If we know already more than available from a use, we don't need to
      invest time on it.
      f3f88287
    • Johannes Doerfert's avatar
      c14213e0
    • Johannes Doerfert's avatar
    • Kito Cheng's avatar
      [doc] Fix description of _Float16 · b46a1b12
      Kito Cheng authored
      According to ISO/IEC TS 18661-3:2015 _FloatN is interchange floating
      point type, extended floating-point type is _FloatNx.
      
      http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2342.pdf
      
      Reviewed By: SjoerdMeijer
      
      Differential revision: https://reviews.llvm.org/D97759
      b46a1b12
    • Siva Chandra Reddy's avatar
    • Evgeniy Brevnov's avatar
      [DSE] Add support for not aligned begin/end · e94125f0
      Evgeniy Brevnov authored
      This is an attempt to improve handling of partial overlaps in case of unaligned begin\end.
      
      Existing implementation just bails out if it encounters such cases. Even when it doesn't I believe existing code checking alignment constraints is not quite correct. It tries to ensure alignment of the "later" start/end offset while should be preserving relative alignment between earlier and later start/end.
      
      The idea behind the change is simple. When start/end is not aligned as we wish instead of bailing out let's adjust it as necessary to get desired alignment.
      
      I'll update with performance results as measured by the test-suite...it's still running...
      
      Reviewed By: fhahn
      
      Differential Revision: https://reviews.llvm.org/D93530
      e94125f0
    • Alan Baker's avatar
      libclc: Add clspv target to libclc · 21427b8e
      Alan Baker authored
      Add clspv as a new target for libclc. clspv is an open-source compiler that compiles OpenCL C to Vulkan SPIR-V. Compiles for the spir target.
      
      The clspv target differs from the the spirv target in the following ways:
      * fma is modified to use uint2 instead of ulong for mantissas. This results in lower performance fma, but provides a implementation that can be used on more Vulkan devices where 64-bit integer support is less common.
      * Use of a software implementation of nextafter because the generic implementation depends on nextafter being a defined builtin function for which clspv has no definition.
      * Full optimization of the library (-O3) and no conversion to SPIR-V
      
      This library is close to what would be produced by running opt -O3 < builtins.opt.spirv-mesa3d-.bc > builtins.opt.clspv--.bc and continuing the build from that point.
      
      Reviewer: jvesely
      
      Differential Revision: https://reviews.llvm.org/D94013
      21427b8e
    • Siva Chandra Reddy's avatar
      [compiler-rt | interceptors] Provide an intercept override knob. · 0106370b
      Siva Chandra Reddy authored
      This knob is useful for downstream users who want that some of their
      libc functions to not be intercepted.
      
      Reviewed By: eugenis
      
      Differential Revision: https://reviews.llvm.org/D97740
      0106370b
    • Christopher Di Bella's avatar
      [libcxx] adds concept `std::common_with` · f893312c
      Christopher Di Bella authored
      Implements parts of:
          - P0898R3 Standard Library Concepts
          - P1754 Rename concepts to standard_case for C++20, while we still can
      
      Depends on D96660
      
      Reviewed By: ldionne, #libc
      
      Differential Revision: https://reviews.llvm.org/D96683
      f893312c
    • Serguei Katkov's avatar
      [InstCombine] Move statepoint intrinsic handling from visitCall to visitCallBase · a0ff0f30
      Serguei Katkov authored
      statepoint intrinsic can be used in invoke context,
      so it should be handled in visitCallBase to cover both call and invoke.
      
      Reviewers: reames, dantrushin
      Reviewed By: reames
      Subscribers: llvm-commits
      Differential Revision: https://reviews.llvm.org/D97833
      a0ff0f30
    • Wang, Pengfei's avatar
      Add Windows ehcont section support (/guard:ehcont). · e7e67c93
      Wang, Pengfei authored
      Add option /guard:ehcont
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D96709
      e7e67c93
    • Jason Molenda's avatar
      LanguageRuntime for 0th frame unwind, simplify getting pc-for-symbolication · 266bb78f
      Jason Molenda authored
      Add calls into LanguageRuntime when finding the unwind method to
      use out of the 0th (currently executing) stack frame.
      
      Allow for the LanguageRuntimes to indicate if this stack frames
      should be treated like a zeroth-frame -- symbolication should be
      done based on the saved pc address, not decremented like normal ABI
      function calls.
      
      Add methods to RegisterContext and StackFrame to get a pc value
      suitable for symbolication, to reduce the number of places in lldb
      where we decrement the saved pc values before symbolication.
      
      <rdar://problem/70398009>
      Differential Revision: https://reviews.llvm.org/D97644
      266bb78f
    • Arthur O'Dwyer's avatar
      [libc++] Introduce __identity_t<T>. NFCI. · 09fa1d0e
      Arthur O'Dwyer authored
      This is just a shorter synonym for `__identity<T>::type`.
      Use it consistently throughout, where possible.
      
      There is still some metaprogramming in <memory> and <variant>
      where `__identity` is being used _without_ immediately calling
      `::type` on it; but this is the unusual case, and it will become
      even less usual as we start deliberately protecting certain types
      against deduction (e.g. D97742).
      
      Differential Revision: https://reviews.llvm.org/D97862
      09fa1d0e
    • Christopher Di Bella's avatar
      [libcxx] adds concept `std::common_reference_with` · 3f5438c4
      Christopher Di Bella authored
      Implements parts of:
          - P0898R3 Standard Library Concepts
          - P1754 Rename concepts to standard_case for C++20, while we still can
      
      Depends on D96657
      
      Reviewed By: ldionne, Mordante, #libc
      
      Differential Revision: https://reviews.llvm.org/D96660
      3f5438c4
    • Aart Bik's avatar
      [mlir][sparse] fix bug in reduction chain · 553cb6d4
      Aart Bik authored
      Found with exhaustive testing, it is possible that a while loop
      appears in between chainable for loops. As long as we don't
      scalarize reductions in while loops, this means we need to
      terminate the chain at the while. This also refactors the
      reduction code into more readable helper methods.
      
      Reviewed By: bixia
      
      Differential Revision: https://reviews.llvm.org/D97886
      553cb6d4
    • Juneyoung Lee's avatar
      [LangRef] fix undefined label · dbf41dda
      Juneyoung Lee authored
      dbf41dda
    • Juneyoung Lee's avatar
      [LangRef] Make lifetime intrinsic's semantics consistent with StackColoring's comment · c821ef45
      Juneyoung Lee authored
      This patch is an update to LangRef by describing lifetime intrinsics' behavior
      by following the description of MIR's LIFETIME_START/LIFETIME_END markers
      at StackColoring.cpp (https://github.com/llvm/llvm-project/blob/eb44682d671d66e422b02595a636050582a4d84a/llvm/lib/CodeGen/StackColoring.cpp#L163) and the discussion in llvm-dev.
      
      In order to explicitly define the meaning of an object lifetime, I added 'Object Lifetime' subsection.
      
      Reviewed By: nlopes
      
      Differential Revision: https://reviews.llvm.org/D94002
      c821ef45
    • River Riddle's avatar
      [mlir] Add support for generating Attribute classes for ODS · 83ef862f
      River Riddle authored
      The support for attributes closely maps that of Types (basically 1-1) given that Attributes are defined in exactly the same way as Types. All of the current ODS TypeDef classes get an Attr equivalent. The generation of the attribute classes themselves share the same generator as types.
      
      Differential Revision: https://reviews.llvm.org/D97589
      83ef862f
    • Craig Topper's avatar
      [RISCV] Make use of the required features in BuiltinInfo to store that V... · 201ebf21
      Craig Topper authored
      [RISCV] Make use of the required features in BuiltinInfo to store that V extension builtins require 'experimental-v'.
      
      Use that to print the diagnostic in SemaChecking instead of
      listing all of the builtins in a switch.
      
      With the required features, IR generation will also be able
      to error on this. Checking this here allows us to have a RISCV
      focused error message.
      
      Reviewed By: HsiangKai
      
      Differential Revision: https://reviews.llvm.org/D97826
      201ebf21
    • Fangrui Song's avatar
      [IRSymTab] Set FB_used on llvm.compiler.used symbols · 584cb67d
      Fangrui Song authored
      IR symbol table does not parse inline asm. A symbol only referenced by inline
      asm is not in the IR symbol table, so LTO does not know that the definition (in
      another translation unit) is referenced and may internalize it, even if that
      definition has `__attribute__((used))` (which lowers to `llvm.compiler.used` on
      ELF targets since D97446).
      
      ```
      // cabac.c
      __attribute__((used)) const uint8_t ff_h264_cabac_tables[...] = {...};
      
      // h264_cabac.c
        asm("lea ff_h264_cabac_tables(%rip), %0" : ...);
      ```
      
      `__attribute__((used))` is the recommended way to tell the compiler there may
      be inline asm references, so the usage is perfectly fine. This patch
      conservatively sets the `FB_used` bit on `llvm.compiler.used` symbols to work
      around the IR symbol table limitation. Note: before D97446, Clang never emitted
      symbols in the `llvm.compiler.used` list, so this change does not punish any
      Clang emitted global object.
      
      Without the patch, `ff_h264_cabac_tables` may be assi...
      584cb67d
    • Steven Wan's avatar
      [AIX] Update default arch on AIX · 0b274ed4
      Steven Wan authored
      On AIX, the default arch level should match the minimum supported arch level of the OS version.
      
      Differential Revision: https://reviews.llvm.org/D97823
      0b274ed4
    • River Riddle's avatar
      [mlir][pdl][NFC] Rename InputOp to OperandOp · e07c968a
      River Riddle authored
      This better matches the actual IR concept that is being modeled, and is consistent with how the rest of PDL is structured.
      
      Differential Revision: https://reviews.llvm.org/D95718
      e07c968a
    • River Riddle's avatar
      [mlir][pdl] Add a new !pdl.range<> type · 55f878ba
      River Riddle authored
      This type represents a range of positional values. It will be used in followup revisions to add support for variadic constructs to PDL, such as operand and result ranges.
      
      Differential Revision: https://reviews.llvm.org/D95717
      55f878ba
    • Xun Li's avatar
      [LICM][Coroutine] Don't sink stores from loops with coro.suspend instructions · 03f66861
      Xun Li authored
      See pr46990(https://bugs.llvm.org/show_bug.cgi?id=46990). LICM should not sink store instructions to loop exit blocks which cross coro.suspend intrinsics. This breaks semantic of coro.suspend intrinsic which return to caller directly. Also this leads to use-after-free if the coroutine is freed before control returns to the caller in multithread environment.
      
      This patch disable promotion by check whether loop contains coro.suspend intrinsics.
      This is a resubmit of D86190.
      Disabling LICM for loops with coroutine suspension is a better option not only for correctness purpose but also for performance purpose.
      In most cases LICM sinks memory operations. In the case of coroutine, sinking memory operation out of the loop does not improve performance since coroutien needs to get data from the frame anyway. In fact LICM would hurt coroutine performance since it adds more entries to the frame.
      
      Differential Revision: https://reviews.llvm.org/D96928
      03f66861
    • Fangrui Song's avatar
      [test] Fix profiling.ll · 30ad7b5d
      Fangrui Song authored
      `__llvm_prf_nm` is compressed if zlib is available. In addition, its size may not be that stable.
      30ad7b5d
    • Jin Lin's avatar
      Add the use of register r for outlined function when register r is live in and defined later. · 7c2192b2
      Jin Lin authored
      The compiler needs to mark register $x0 as live in for the following case.
      
          $x1 = ADDXri $sp, 16, 0
          BL @spam, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def dead $x0
      
      Reviewed By: paquette
      
      Differential Revision: https://reviews.llvm.org/D95267
      7c2192b2
    • River Riddle's avatar
      Fix flang build after D97804 · 64be3fcb
      River Riddle authored
      64be3fcb
    • George Balatsouras's avatar
      [dfsan] Remove hard-coded shadow width in more tests · 6b7b53f5
      George Balatsouras authored
      As a preparation step for fast8 support, we need to update the tests
      to pass in both modes. That requires generalizing the shadow width
      and remove any hard coded references that assume it's always 2 bytes.
      
      Reviewed By: stephan.yichao.zhao
      
      Differential Revision: https://reviews.llvm.org/D97884
      6b7b53f5
    • Zequan Wu's avatar
    • River Riddle's avatar
      [mlir][IR] Refactor the internal implementation of Value · 3dfa8614
      River Riddle authored
      The current implementation of Value involves a pointer int pair with several different kinds of owners, i.e. BlockArgumentImpl*, Operation *, TrailingOpResult*. This design arose from the desire to save memory overhead for operations that have a very small number of results (generally 0-2). There are, unfortunately, many problematic aspects of the current implementation that make Values difficult to work with or just inefficient.
      
      Operation result types are stored as a separate array on the Operation. This is very inefficient for many reasons: we use TupleType for multiple results, which can lead to huge amounts of memory usage if multi-result operations change types frequently(they do). It also means that simple methods like Value::getType/Value::setType now require complex logic to get to the desired type.
      
      Value only has one pointer bit free, severely limiting the ability to use it in things like PointerUnion/PointerIntPair. Given that we store the kind of a Value along with the "owner" pointer, we only leave one bit free for users of Value. This creates situations where we end up nesting PointerUnions to be able to use Value in one.
      
      As noted above, most of the methods in Value need to branch on at least 3 different cases which is both inefficient, possibly error prone, and verbose. The current storage of results also creates problems for utilities like ValueRange/TypeRange, which want to efficiently store base pointers to ranges (of which Operation* isn't really useful as one).
      
      This revision greatly simplifies the implementation of Value by the introduction of a new ValueImpl class. This class contains all of the state shared between all of the various derived value classes; i.e. the use list, the type, and the kind. This shared implementation class provides several large benefits:
      
      * Most of the methods on value are now branchless, and often one-liners.
      
      * The "kind" of the value is now stored in ValueImpl instead of Value
      This frees up all of Value's pointer bits, allowing for users to take full advantage of PointerUnion/PointerIntPair/etc. It also allows for storing more operation results as "inline", 6 now instead of 2, freeing up 1 word per new inline result.
      
      * Operation result types are now stored in the result, instead of a side array
      This drops the size of zero-result operations by 1 word. It also removes the memory crushing use of TupleType for operations results (which could lead up to hundreds of megabytes of "dead" TupleTypes in the context). This also allowed restructured ValueRange, making it simpler and one word smaller.
      
      This revision does come with two conceptual downsides:
      * Operation::getResultTypes no longer returns an ArrayRef<Type>
      This conceptually makes some usages slower, as the iterator increment is slightly more complex.
      * OpResult::getOwner is slightly more expensive, as it now requires a little bit of arithmetic
      
      From profiling, neither of the conceptual downsides have resulted in any perceivable hit to performance. Given the advantages of the new design, most compiles are slightly faster.
      
      Differential Revision: https://reviews.llvm.org/D97804
      3dfa8614
    • Jez Ng's avatar
      5d916984
    • Sanjay Patel's avatar
      [Analysis] simplify propagation of FMF in recurrences; NFC · b3f0c265
      Sanjay Patel authored
      This is a mess, but this is hopefully no-functional-change.
      The 'Prev' descriptor is only used for min/max recurrences
      or when starting a match from a phi, so it should not be a
      factor when propagating FMF for fmul/fadd.
      
      The API is confusing (and should be reduced in subsequent steps)
      because the "UnsafeAlgebraInst" appears to actually be a placeholder
      for a recurrence that does NOT have FMF, but we still want to
      treat it as reassociative.
      b3f0c265
    • Stefan Gränitz's avatar
      295ea050
    • David Blaikie's avatar
      Fix use of deprecated API · 4fda0dc1
      David Blaikie authored
      4fda0dc1
    • Louis Dionne's avatar
      [libc++] Temporary hack: disable Apple back-deployment testing · 460953ad
      Louis Dionne authored
      Apple back-deployment testing is currently failing because Green Dragon
      is down. To avoid stalling the whole CI pipeline because of that, I am
      temporarily disabling those jobs until Green Dragon is back, or even
      better we have found a different way to store those small artifacts.
      460953ad
    • MaheshRavishankar's avatar
      [mlir] Remove incorrect folding for SubTensorInsertOp · c118fdcd
      MaheshRavishankar authored
      The SubTensorInsertOp has a requirement that dest type and result
      type match. Just folding the tensor.cast operation violates this and
      creates verification errors during canonicalization. Also fix other
      canonicalization methods that werent inserting casts properly.
      
      Differential Revision: https://reviews.llvm.org/D97800
      c118fdcd
    • Florian Hahn's avatar
      [AArch64] Add implicit uses for operands when expanding BLR_RVMARKER. · 75805dce
      Florian Hahn authored
      Make sure we preserve info about passed arguments as implicit uses, to
      make sure later passes still have access to this information.
      
      This fixes a mis-compile where the machine-combiner would pick an
      incorrect free register.
      75805dce
    • Stefan Gränitz's avatar
      Revert "hack to unbreak check-llvm on win after D97335" in attempt for actual fix · e984c2b0
      Stefan Gränitz authored
      This reverts commit 900f0761 and attempts an actual fix: All failing tests for llvm-jitlink use the `-noexec` flag. The inputs they operate on are not meant for execution on the host system. Looking e.g. at the MachO_test_harness_harnesss.s test, llvm-mc generates input machine code with "x86_64-apple-macosx10.9".
      
      My previous attempt in bbdb4c8c disabled the debug support plugin for Windows targets, but what we would actually want is to disable it on Windows HOSTS.
      
      With the new patch here, I don't do exactly that, but instead follow the approach for the EH frame plugin and include the `-noexec` flag in the condition. It should have the desired effect when it comes to the test suite. It appears a little workaround'ish, but should work reliably for now. I will discuss the issue with Lang and see if we can do better. Thanks @thakis again for the temporary fix.
      e984c2b0
    • Soumi Manna's avatar
      [WebAssembly] Add missing default cases in switch statements · eec7f8f7
      Soumi Manna authored
      unsigned variable 'IntNo' has been declared but not been defined inside function
      EmitWebAssemblyBuiltinExpr().
      
      static code analysis tool complains about uninitialized variable "IntNo" since
      this enters to default branch without setting any intrinsics and calls Function
      *Callee = CGM.getIntrinsic(IntNo).
      
      This patch fixes the problem by adding default cases in switch statements.
      eec7f8f7
    • Jez Ng's avatar
      [lld-macho] Require -arch and -platform_version to always be specified · b63919e1
      Jez Ng authored
      We previously defaulted to x86_64 and an unknown platform, which was fine when
      we only supported one arch and did no platform checks, but that will no longer
      be true going ahead. Therefore, we should require those flags to be specified
      whenever the linker is invoked.
      
      Note that LLD-ELF and ld64 both infer the arch from their input object files,
      but the usefulness of that is questionable since clang will always specify these
      flags, and most of the time `lld` will be invoked via clang.
      
      Reviewed By: #lld-macho, thakis
      
      Differential Revision: https://reviews.llvm.org/D97799
      b63919e1