1. Jan 27, 2023
    • Florian Hahn's avatar
      [SCCP] Use range info to prove AddInst has NSW flag. · 72121a20
      Florian Hahn authored
      This patch updates SCCP to use the value ranges of AddInst operands to
      try to prove the AddInst does not overflow in the signed sense and
      adds the NSW flag. The reasoning is done with
      makeGuaranteedNoWrapRegion (thanks @nikic for point it out!).
      
      Follow-ups will include extending this to more
      OverflowingBinaryOperators.
      
      Depends on D142387.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D142390
      72121a20
    • Matthias Springer's avatar
      [mlir] GreedyPatternRewriteDriver: All entry points take a config · 977cddb9
      Matthias Springer authored
      The multi-op entry point now also takes a GreedyPatternRewriteConfig and respects config.maxNumRewrites. The scope is also a part of the config now.
      
      Differential Revision: https://reviews.llvm.org/D142614
      977cddb9
    • Michael Buch's avatar
      [lldb][Target] GetScratchTypeSystems: sort TypeSystems with strict weak ordering · 78fee46d
      Michael Buch authored
      `std::sort` requires a comparison operator that obides by strict weak
      ordering. `operator<=` on pointer does not and leads to undefined
      behaviour. Specifically, when we grow the `scratch_type_systems` vector
      slightly larger (and thus take `std::sort` down a slightly different
      codepath), we segfault. This happened while working on a patch that
      would in fact grow this vector. In such a case ASAN reports:
      
      ```
      $ ./bin/lldb ./lldb-test-build.noindex/lang/cpp/complete-type-check/TestCppIsTypeComplete.test_builtin_types/a.out -o "script -- lldb.target.FindFirstType(\"void\")"
      (lldb) script -- lldb.target.FindFirstType("void")
      =================================================================
      ==59975==ERROR: AddressSanitizer: container-overflow on address 0x000108f6b510 at pc 0x000280177b4c bp 0x00016b7d7430 sp 0x00016b7d7428
      READ of size 8 at 0x000108f6b510 thread T0
          #0 0x280177b48 in std::__1::shared_ptr<lldb_private::TypeSystem>::shared_ptr[abi:v15006](std::__1::shared_ptr<lldb_private::TypeSystem> const&)+0xb4 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x177b48)
      (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #1 0x280dcc008 in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, lldb_private::Target::GetScratchTypeSystems(bool)::$_3&, std::__1::shared_ptr<lldb_private::TypeSystem>*>(std::__1::shared_ptr<lldb_private::TypeSystem>*, std::__1::shared_
      ptr<lldb_private::TypeSystem>*, lldb_private::Target::GetScratchTypeSystems(bool)::$_3&, std::__1::iterator_traits<std::__1::shared_ptr<lldb_private::TypeSystem>*>::difference_type)+0x1050 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblld
      b.17.0.0git.dylib:arm64+0xdcc008) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #2 0x280d88788 in lldb_private::Target::GetScratchTypeSystems(bool)+0x5a4 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd88788) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #3 0x28021f0b4 in lldb::SBTarget::FindFirstType(char const*)+0x624 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x21f0b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #4 0x2804e9590 in _wrap_SBTarget_FindFirstType(_object*, _object*)+0x26c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x4e9590) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #5 0x1062d3ad4 in cfunction_call+0x5c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0xcfad4) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
      
      <--- snipped --->
      
      0x000108f6b510 is located 400 bytes inside of 512-byte region [0x000108f6b380,0x000108f6b580)
      allocated by thread T0 here:
          #0 0x105209414 in wrap__Znwm+0x74 (/Applications/Xcode2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x51414) (BuildId: 0a44828ceb64337bbfff60b22cd838f0320000
      00200000000100000000000b00)
          #1 0x280dca3b4 in std::__1::__split_buffer<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::shared_pt
      r<lldb_private::TypeSystem>>&)+0x11c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xdca3b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #2 0x280dc978c in void std::__1::vector<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>>::__push_back_slow_path<std::__1::shared_ptr<lldb_private::TypeSystem> const&>(std::__1::s
      hared_ptr<lldb_private::TypeSystem> const&)+0x13c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xdc978c) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #3 0x280d88dec in std::__1::vector<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>>::push_back[abi:v15006](std::__1::shared_ptr<lldb_private::TypeSystem> const&)+0x80 (/Users/mic
      haelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd88dec) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #4 0x280d8857c in lldb_private::Target::GetScratchTypeSystems(bool)+0x398 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd8857c) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #5 0x28021f0b4 in lldb::SBTarget::FindFirstType(char const*)+0x624 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x21f0b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #6 0x2804e9590 in _wrap_SBTarget_FindFirstType(_object*, _object*)+0x26c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x4e9590) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
          #7 0x1062d3ad4 in cfunction_call+0x5c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0xcfad4) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
          #8 0x10627fff0 in _PyObject_MakeTpCall+0x7c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0x7bff0) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
          #9 0x106378a98 in _PyEval_EvalFrameDefault+0xbcf8 (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0x174a98) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
      ```
      
      Differential Revision: https://reviews.llvm.org/D142709
      78fee46d
    • Lucas Prates's avatar
      [NFC][AArch64] Get default features directly from ArchInfo and CpuInfo objects · 0753cf2c
      Lucas Prates authored
      This updates the AArch64's Target Parser and its uses to capture
      information about default features directly from ArchInfo and CpuInfo
      objects, instead of relying on an API function to access them
      indirectly.
      
      Reviewed By: tmatheson
      
      Differential Revision: https://reviews.llvm.org/D142540
      0753cf2c
    • Lucas Prates's avatar
      [NFC][AArch64] Use optional returns in target parser instead of 'invalid' objects · 9ea00fc7
      Lucas Prates authored
      This updates the parsing methods in AArch64's Target Parser to make use
      of optional returns instead of "invalid" enum values, making the API's
      behaviour clearer.
      
      Reviewed By: lenary, tmatheson
      
      Differential Revision: https://reviews.llvm.org/D142539
      9ea00fc7
    • Luca Di Sera's avatar
      Add clang_CXXMethod_isExplicit to libclang · 0a51bc73
      Luca Di Sera authored
      The new method is a wrapper of `CXXConstructorDecl::isExplicit` and
      `CXXConversionDecl::isExplicit`, allowing the user to recognize whether
      the declaration pointed to by a cursor was marked with the explicit
      specifier.
      
      An export for the function, together with its documentation, was added
      to "clang/include/clang-c/Index.h" with an implementation provided in
      "clang/tools/libclang/CIndex.cpp".
      
      The implementation is based on similar `clang_CXXMethod`
      implementations, returning a falsy unsigned value when the cursor is not
      a declaration, is not a declaration for a constructor or conversion
      function or is not a relevant declaration that was marked with the
      `explicit` specifier.
      
      The new symbol was added to "clang/tools/libclang/libclang.map" to be
      exported, under the LLVM16 tag.
      
      "clang/tools/c-index-test/c-index-test.c" was modified to print a
      specific tag, "(explicit)", for cursors that are recognized by
      `clang_CXXMethod_isExplicit`.
      
      Two new regression files, "ex...
      0a51bc73
    • Shivam Gupta's avatar
      [Docs] Fix a statement wrt instruction alignment of 0 · 9922c78a
      Shivam Gupta authored
      This fix https://github.com/llvm/llvm-project/issues/53371
      Zero is not a legal alignment.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D142633
      9922c78a
    • Jean Perier's avatar
    • Jean Perier's avatar
      [flang][hlfir] Handle scalar to array in hlfir.assign codegen. · 86e6a8c3
      Jean Perier authored
      The scalar must be placed in memory before creating descriptors and
      calling the runtime assignment API.
      
      Differential Revision: https://reviews.llvm.org/D142698
      86e6a8c3
    • David Spickett's avatar
      Revert "[lldb] Add support for DW_AT_default_value in template params" · 1efde67d
      David Spickett authored
      This reverts commit 1cf52e540242f968e0cf789587bcf76c01332aeb.
      
      Due to test failures on Arm and AArch64 bots:
      https://lab.llvm.org/buildbot/#/builders/96/builds/34718
      
      (which were obscured by an earlier build failure)
      1efde67d
    • Matthias Springer's avatar
      [mlir][transforms] CSE ops with multiple regions · aa4e54f2
      Matthias Springer authored
      There were issues with the CSE equivalence analysis that have been fixed with D142558. This makes it possible to CSE ops with multiple regions.
      
      Differential Revision: https://reviews.llvm.org/D142562
      aa4e54f2
    • Simon Pilgrim's avatar
      [PowerPC] ppc64-P9-vabsd.ll - add some basic ISD::ABDS test coverage · 846ec909
      Simon Pilgrim authored
      Test coverage to ensure D142313 lowers ISD::ABDU -> VABSD but not ISD::ABDS (although I think v4i32 would be compatible with the XVNEGSP trick)
      846ec909
    • Matthias Springer's avatar
      [mlir][transforms] Simplify OperationEquivalence and CSE · c864288d
      Matthias Springer authored
      Replace `mapOperands` and `mapResults` with two new callbacks. It was not clear what "mapping" meant and why the equivalence relationship was a property of the Operand/OpResult as opposed to just SSA values.
      
      This revision changes the contract of the two callbacks: `checkEquivalent` compares two values for equivalence. `markEquivalent` informs the caller that the analysis determined that two values are equivalent. This simplifies the API because callers do not have to reason about operands/results, but just SSA values.
      
      `OperationEquivalence::isEquivalentTo` can be used directly in CSE and there is no need for a custom op equivalence analysis.
      
      Differential Revision: https://reviews.llvm.org/D142558
      c864288d
    • Matthias Springer's avatar
      [mlir] GreedyPatternRewriteDriver: Entry point takes single region · a2b837ab
      Matthias Springer authored
      The rewrite driver is typically applied to a single region or all regions of the same op. There is no longer an overload to apply the rewrite driver to a list of regions.
      
      This simplifies the rewrite driver implementation because the scope is now a single region as opposed to a list of regions.
      
      Note: This change is not NFC because `config.maxIterations` and `config.maxNumRewrites` is now counted for each region separately. Furthermore, worklist filtering (`scope`) is now applied to each region separately.
      
      Differential Revision: https://reviews.llvm.org/D142611
      a2b837ab
    • Quentin Colombet's avatar
      [memref][Transform][NFC] Improve the doc for masked_vectorize · bf5f63e5
      Quentin Colombet authored
      The `transform.structured.masked_vectorize` operator assumes that the
      iteration space of the given linalg op is smaller than the given vector
      sizes.
      Explicitly states this requirement in the description of the operation.
      
      Also fix the related comment and assert message in the vectorization code.
      The wording was flipped.
      
      NFC
      
      Differential Revision: https://reviews.llvm.org/D142628
      bf5f63e5
    • Thomas Preud'homme's avatar
      [MLIR] Fix tensor shapes in Toy chapter 1 · bfedf169
      Thomas Preud'homme authored
      In Toy tutorial chapter 1, multiply_transpose() is called with b<2, 3>
      and c<3, 2> when both parameters should have the same shape. This commit
      fixes this by instead using c and d as parameters and fix a comment typo
      where c and d are mentioned to have shape <2, 2> when they actually have
      shape <3, 2>.
      
      Reviewed By: mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D142622
      bfedf169
    • Matthias Springer's avatar
      [mlir] GreedyPatternRewriteDriver: Make classes single-use · 67760d7e
      Matthias Springer authored
      Less mutable state, more `const`. This is to address a concern about complexity of state in D140304.
      
      Differential Revision: https://reviews.llvm.org/D141949
      67760d7e
    • Matthias Springer's avatar
      [mlir][NFC] GreedyPatternRewriteDriver: Remove OpPatternRewriteDriver · cadd5666
      Matthias Springer authored
      The `MultiOpPatternRewriteDriver` can be reused. This gives us better debug messages and more code reuse. Debug messages such as `** Replace: (op name)` were previously not printed when using the `applyOpPatternsAndFold(Operation *, ...)` overload.
      
      Differential Revision: https://reviews.llvm.org/D142613
      cadd5666
    • Matthias Springer's avatar
      [mlir] GreedyPatternRewriteDriver: Enqueue ancestors in MultiOpPatternRewriteDriver · e195e6ba
      Matthias Springer authored
      The `GreedyPatternRewriteDriver` was extended to enqueue ancestors in D140304. With this change, `MultiOpPatternRewriteDriver` behaves the same way.
      
      Note: `MultiOpPatternRewriteDriver` now also has a scope that limits how far we go when checking ancestors. By default, this is the first common region of all given ops.
      
      Differential Revision: https://reviews.llvm.org/D141945
      e195e6ba
    • Quentin Colombet's avatar
      [mlir][Conversion] Rename the MemRefToLLVM pass · cb4ccd38
      Quentin Colombet authored
      Since the recent MemRef refactoring that centralizes the lowering of
      complex MemRef operations outside of the conversion framework, the
      MemRefToLLVM pass doesn't directly convert these complex operations.
      
      Instead, to fully convert the whole MemRef dialect space, MemRefToLLVM
      needs to run after `expand-strided-metadata`.
      
      Make this more obvious by changing the name of the pass and the option
      associated with it from `convert-memref-to-llvm` to
      `finalize-memref-to-llvm`.
      The word "finalize" conveys that this pass needs to run after something
      else and that something else is documented in its tablegen description.
      
      This is a follow-up patch related to the conversation at:
      https://discourse.llvm.org/t/psa-you-need-to-run-expand-strided-metadata-before-memref-to-llvm-now/66956/14
      
      Differential Revision: https://reviews.llvm.org/D142463
      cb4ccd38
    • Alex Zinenko's avatar
      [mlir] fail gracefull in CallOpSignatureConversion · 88a3dc0e
      Alex Zinenko authored
      Previously, the CallOpSignatureConversion pattern would assert if
      function signature change affected the number of results. Fail the
      pattern instead and let the caller propagate failure.
      
      Fixes #60186.
      
      Reviewed By: mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D142624
      88a3dc0e
    • Evgeniy Brevnov's avatar
      Revert "[JT][CT] Preserve exisiting BPI/BFI during JumpThreading" · f7c19823
      Evgeniy Brevnov authored
      This reverts commit 26e7cb24.
      f7c19823
    • Andrzej Warzynski's avatar
      [mlir][linalg] Make Linalg vectorizer lower affine.apply · c7b1176e
      Andrzej Warzynski authored
      It is possible that the input to the Linalg vectorizer contains
      `affine.apply` ops (see the example in [1]). Such operations are not
      vectarizable at the moment, but this can be fixed by simply converting
      them to arithmetic operations. This is basically what this patch
      introduces.
      
      The IR change enabled in this patch could be part of a larger set of
      "linalgOp pre-processing" transformations that happens right before
      vectorization starts but after we know we can vectorize the op. I am
      leaving this as a TODO.
      
      [1] https://github.com/iree-org/iree/issues/10876.
      
      Differential Revision: https://reviews.llvm.org/D142371
      c7b1176e
    • Timm Bäder's avatar
      [clang][Interp][NFC] Print parent class name of methods · f2f8c255
      Timm Bäder authored
      in Function::dump().
      f2f8c255
    • Timm Bäder's avatar
      [clang][Interp][NFC] Remove an unnecessary isArray() check · 435225c6
      Timm Bäder authored
      We already do an isPrimitiveArray() check, so no need for the isArray()
      check.
      435225c6
    • Evgeniy Brevnov's avatar
      [JT][CT] Preserve exisiting BPI/BFI during JumpThreading · 26e7cb24
      Evgeniy Brevnov authored
      Currently, JT creates and updates local instances of BPI\BFI. As a result global ones have to be invalidated if JT made any changes.
      In fact, JT doesn't use any information from BPI/BFI for the sake of the transformation itself. It only creates BPI/BFI to keep them up to date. But since it updates local copies (besides cases when it updates profile metadata) it just waste of time.
      
      Current patch is a rework of D124439. D124439 makes one step and replaces local copies with global ones retrieved through AnalysisPassManager. Here we do one more step and don't create BPI/BFI if the only reason of creation is to keep BPI/BFI up to date. Overall logic is the following. If there is cached BPI/BFI then update it along the transformations. If there is no existing BPI/BFI, then create it only if it is required to update profile metadata.
      
      Please note if BPI/BFI exists on exit from JT (either cached or created) it is always up to date and no reason to invalidate it.
      
      Reviewed By: mkazantsev
      
      Differential Revision: https://reviews.llvm.org/D136827
      26e7cb24
    • Timm Bäder's avatar
      [clang][Interp][NFC] Add GetPtrBasePop opcode · 7b966e21
      Timm Bäder authored
      Change GetPtrBase to *not* pop the base pointer and add a *Pop variant.
      This will be used in later patches.
      7b966e21
    • Timm Bäder's avatar
      [clang][Interp] Implement __builtin_assume · 760136ff
      Timm Bäder authored
      Just ignore it.
      
      As part of this, move the Ret and RetVoid implementation to Interp.h, so
      they can be shared with InterpBuiltin.cpp.
      
      Differential Revision: https://reviews.llvm.org/D141193
      760136ff
    • Shilei Tian's avatar
      [OpenMP] Fix stack overflow for test bug54082.c · 544f8c7f
      Shilei Tian authored
      When `N` is 1024, `int result[N][N]` is obviously large stack that Windows cannot support...
      
      Fix #60326.
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D142684
      544f8c7f
    • Michael Buch's avatar
    • Michael Buch's avatar
      [lldb][NFC] Build fix: use TemplateParameterInfos public APIs instead of accessing private members · 41a2d7a3
      Michael Buch authored
      Fixes build failures caused by a faulty rebase
      in `a29e06bb`
      
      Differential Revision: https://reviews.llvm.org/D140030
      41a2d7a3
    • Michael Buch's avatar
    • Michael Buch's avatar
      [lldb] Add support for DW_AT_default_value in template params · 1aee040c
      Michael Buch authored
      **Summary**
      
      This patch makes LLDB understand the `DW_AT_default_value` on
      template argument DIEs. As a result, type summaries will no
      longer contain the defaulted template arguments, reducing
      noise substantially. E.g.,
      
      Before:
      ```
      (lldb) v nested
      (std::vector<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator <char> > > > > >) nested = size=0 {}
      ```
      
      After:
      ```
      (lldb) v nested
      (std::vector<std::vector<std::basic_string<char> > >) nested = size=0 {}
      ```
      
      See discussion in https://reviews.llvm.org/D140423
      
      **Testing**
      
      * Adjust API tests
      * Added unit-test
      
      Differential Revision: https://reviews.llvm.org/D141828
      1aee040c
    • Michael Buch's avatar
      [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private · a29e06bb
      Michael Buch authored
      This patch makes the members of `TemplateParameterInfos` only accessible
      via public APIs. The motivation for this is that
      `TemplateParameterInfos` attempts to maintain two vectors in tandem
      (`args` for the template arguments and `names` for the corresponding
      name). Working with this structure as it's currently designed makes
      it easy to run into out-of-bounds accesses later down the line.
      
      This patch proposes to introduce a new
      `TemplateParameterInfos::InsertArg` which is the only way to
      set the `TemplateArgument` and name of an entry and since we
      require both to be specified we maintain the vectors in sync
      out-of-the-box.
      
      To avoid adding non-const getters just for unit-tests a new
      `TemplateParameterInfosManipulatorForTests` is introduced
      that can be used to control internal state from tests.
      a29e06bb
    • Michael Buch's avatar
      [clang][DebugInfo] Check TemplateArgument::IsDefaulted · 29ecf0e6
      Michael Buch authored
      Since `ClassTemplateSpecializationDecl`s now set the
      `TemplateArgument::IsDefaulted` bit, there's no need
      to derive it here.
      
      Differential Revision: https://reviews.llvm.org/D142333
      29ecf0e6
    • Michael Buch's avatar
      [clang][TypePrinter] Test TemplateArgument::IsDefaulted when omitting default arguments · 3d7dcec5
      Michael Buch authored
      **Summary**
      
      This patch allows clients who can't properly construct
      a `ClassTemplateDecl` to still benefit from the `clang::TypePrinter`s
      ability to skip printing defaulted template arguments. The
      clients simply have to call `TemplateArgument::setIsDefaulted`
      in advance.
      
      See discussion in https://reviews.llvm.org/D140423
      
      Differential Revision: https://reviews.llvm.org/D141827
      3d7dcec5
    • Michael Buch's avatar
      [clang][TemplateBase] Add IsDefaulted bit to TemplateArgument · 8b4279b6
      Michael Buch authored
      **Summary**
      
      This patch adds a `IsDefaulted` field to `clang::TemplateArgument`.
      
      To prevent memory footprint increase we still 1 bit from `ArgKind`.
      
      **Changes**
      
      1. `getIsDefaulted`/`setIsDefaulted` to allow clients to communicate
         an argument's defaulted-ness to the TypePrinter
      2. The `TemplateArgument` properties description had to be changed
         to make sure we correctly mark the defaulted-ness of arguments
         that came from a deserialized AST (caught by the HLSL test-suite)
      3. The `TemplateArgument` constructors now accept a `IsDefaulted`
         parameter to simplify construction from the tablegen description.
         Though if people don't want to clutter the constructors we can
         instead call `setIsDefaulted` from tablegen
      4. When `clang::Sema` checks the template arguments against template
         parameters we now call `setIsDefaulted`. This makes sure that
         whenever a specialization decl gets constructed, the defaulted-ness
         of the associated `TemplateArgument`s has already been deduced.
         This preserves the immutability of `TemplateArgumentList`s
      
      **Background**
      
      In LLDB we construct ASTs from debug-info and hand it to clang
      to perform actions such as printing/formatting a typenames.
      Some debug formats, specifically DWARF, may only encode information
      about class template instantiations, losing the structure of the generic
      class definition. However, the `clang::TypePrinter` needs a properly
      constructed `ClassTemplateDecl` with generic default argument decls
      to be able to deduce whether a `ClassTemplateSpecializationDecl` was
      instantiatiated with `TemplateArgument`s that correspond to the
      defaults. LLDB does know whether a particular template argument was
      defaulted, but can't currently tell clang about it.
      
      This patch allows LLDB to set the defaulted-ness of a `TemplateArgument`
      and thus benefit more from `clang::TypePrinter`.
      
      See discussion in https://reviews.llvm.org/D140423
      
      **Testing**
      
      * Added unit-test
      * LLDB/clang/llvm test-suite passes
      
      Differential Revision: https://reviews.llvm.org/D141826
      8b4279b6
    • Michael Buch's avatar
      [clang][TypePrinter] Support expression template arguments when checking defaultedness · 798494ed
      Michael Buch authored
      This patch adds support for `TemplateArgument`s of kind
      `TemplateArgument::Expression` to `clang::isSubstitutedDefaultArgument`.
      We do so by evaluating both the `Pattern` and `Arg` expression to an
      `APInt`, if we can, and comparing the results.
      
      This will be useful in an upcoming change where
      `clang::isSubstitutedDefaultArgument` gets called from `clang::Sema`
      where the `TemplateArgument`s are instantiated as expressions (without
      being evaluted to `APInt` beforehand).
      
      **Testing**
      
      - Added unit-tests
      
      Differential Revision: https://reviews.llvm.org/D142632
      798494ed
    • Jordan Rupprecht's avatar
    • Phoebe Wang's avatar
      [X86][ConstraintFP] Model `MXCSR` for function call · 2bb96030
      Phoebe Wang authored
      This patch is inspired by D111433. It would affect the performance under
      strict FP mode. But it preserves the correct rounding behavior accross
      function calls.
      
      Fixes #59305
      
      Reviewed By: sepavloff
      
      Differential Revision: https://reviews.llvm.org/D139549
      2bb96030