1. May 16, 2024
  2. May 15, 2024
    • Piotr Zegar's avatar
      [clang-tidy] Add AllowImplicitlyDeletedCopyOrMove option to... · 54c6ee92
      Piotr Zegar authored
      [clang-tidy] Add AllowImplicitlyDeletedCopyOrMove option to cppcoreguidelines-special-member-functions (#71683)
      
      Improved cppcoreguidelines-special-member-functions check with a new
      option AllowImplicitlyDeletedCopyOrMove, which removes the requirement
      for explicit copy or move special member functions when they are already
      implicitly deleted.
      
      Closes #62392
      54c6ee92
    • Piotr Zegar's avatar
      [clang-tidy] Fix crash in modernize-use-constraints (#92019) · ba344760
      Piotr Zegar authored
      Improved modernize-use-constraints check by fixing a crash that occurred
      in some scenarios and excluded system headers from analysis.
      
      Problem were with DependentNameTypeLoc having null type location as
      getQualifierLoc().getTypeLoc().
      
      Fixes #91872
      ba344760
    • Jay Foad's avatar
      [utils][filecheck-lint] Add shebang (#92243) · 3a8d176a
      Jay Foad authored
      3a8d176a
    • Timm Bäder's avatar
      74218a9c
    • Luke Lau's avatar
      [RISCV] Remove hasSideEffects=1 for vsetvli pseudos (#91319) · ff313ee7
      Luke Lau authored
      In a similar vein to #90049, we currently model all of the effects of a
      vsetvli pseudo:
      
      * VL and VTYPE are marked as defs
      * VL preserving x0,x0 vsetvlis doesn't get emitted until
      RISCVInsertVSETVLI, and when they are they have implicit uses on VL
      * Regular vector pseudos are fully modelled too: Before
      RISCVInsertVSETVLI they can be moved between vsetvli pseudos because we
      will eventually insert vsetvlis to correct VL and VTYPE. Afterwards,
      they will have implicit uses on VL and VTYPE.
      
      Since we model everything we can remove hasSideEffects=1. This gives us
      some improvements like sinking in vsetvli-insert-crossbb.ll.
      
      We need to update RISCVDeadRegisterDefinitions to keep handling vsetvli
      pseudos since it only operates on instructions with unmodelled side
      effects.
      ff313ee7
    • jyu2-git's avatar
      [Clang][OpenMP] Fix runtime problem when explicit map both pointer and pointee (#92210) · 8e00703b
      jyu2-git authored
      ponter int *p for following map, test currently crash.
      
        map(p, p[:100]) or map(p, p[1])
      
      Currly IR looks like
      // &p, &p, sizeof(int), TARGET_PARAM | TO | FROM
      // &p, p[0], 100sizeof(float) TO | FROM
      
      Worrking IR is
      // map(p, p[0:100]) to map(p[0:100])
      // &p, &p[0], 100*sizeof(float), TARGET_PARAM | TO | FROM | PTR_AND_OBJ
      
      The change is add new argument AreBothBasePtrAndPteeMapped in
      generateInfoForComponentList
      
      Use that to skip map for map(p), when processing map(p[:100]) generate
      map with right flag.
      8e00703b
    • Elvina Yakubova's avatar
      [BOLT][NFC] Add documentation on BOLT options (#92117) · dcf3102b
      Elvina Yakubova authored
      Add .md file documentation with all BOLT options to display it more
      conveniently.
      dcf3102b
    • Rajveer Singh Bharadwaj's avatar
    • Phoebe Wang's avatar
      [X86][AMX] Fix a bug after #83628 (#91207) · b576a6b0
      Phoebe Wang authored
      We need to check if `GR64Cand` a valid register before using it.
      
      Test is not needed since it's covered in llvm-test-suite.
      
      Fixes #90954
      b576a6b0
    • Daniel Kuts's avatar
      Fix null pointer dereference in logging in mlir TransformOps (#92237) · 4527adc5
      Daniel Kuts authored
      A variable `typeConverterOp` may be nullptr after dynamic cast. There is
      a security guard for this, but during logging error message the variable
      getting dereferenced.
      Found with static analysis.
      4527adc5
    • Timm Bäder's avatar
      [clang][Interp][NFC] Use a smaller default size for IntegralAP · 28d5f790
      Timm Bäder authored
      Since we later possibly initialize the value by using operator-new,
      we need the default value to _not_ allocate memory.
      28d5f790
    • Timm Bäder's avatar
      413aaf11
    • Krzysztof Parzyszek's avatar
      [flang][OpenMP] Add `REQUIRES: asserts` to test that relies on it · 8ab753c1
      Krzysztof Parzyszek authored
      This should fix failures in release builds.
      8ab753c1
    • Aaron Ballman's avatar
      [Support] Use malloc instead of non-throwing new (#92157) · dceaa0f4
      Aaron Ballman authored
      When allocating a memory buffer, we use a non-throwing new so that we
      can explicitly handle memory buffers that are too large to fit into
      memory. However, when exceptions are disabled, LLVM installs a custom
      new handler
      
      (https://github.com/llvm/llvm-project/blob/90109d444839683b09f0aafdc50b749cb4b3203b/llvm/lib/Support/InitLLVM.cpp#L61)
      that explicitly crashes when we run out of memory
      
      (https://github.com/llvm/llvm-project/blob/de14b749fee41d4ded711e771e43043ae3100cb3/llvm/lib/Support/ErrorHandling.cpp#L188)
      and that means this particular out-of-memory situation cannot be
      gracefully handled.
      
      This was discovered while working on #embed
      (https://github.com/llvm/llvm-project/pull/68620) on Windows and
      resulted in a crash rather than the preprocessor issuing a diagnostic as
      expected.
      
      This patch switches away from the non-throwing new to a call to malloc
      (and free), which will return a null pointer without calling a custom
      new handler. It is the only instance in Clang or LLVM that I could find
      which used a non-throwing new, so I did not think we would need anything
      more involved than this change.
      
      Testing this would be highly platform dependent and so it does not come
      with test coverage. And because it doesn't change behavior that users
      are likely to be able to observe, it does not come with a release note.
      dceaa0f4
    • Florian Hahn's avatar
      8a4cbead
    • AdityaK's avatar
      [GVNHoist] Replace combineKnownMetadata with combineMetadataForCSE (#92197) · b42d245b
      AdityaK authored
      There is no reason to call combineMetadata directly with a list of MD_
      nodes. The combineMetadataForCSE function handles all the metadata
      correctly
      
      Partially fixes: #30866
      b42d245b
    • Florian Hahn's avatar
      [Clang] Use ULL for std::max constant argument to fix build failure. · da116bd8
      Florian Hahn authored
      getKnownMinValue returns uint64_t, use ULL to make sure the second arg
      is also 64 bit.
      da116bd8
    • Endre Fülöp's avatar
      [clang][analyzer] Fix a crash in alpha.unix.BlockInCriticalSection (#90030) · eda098aa
      Endre Fülöp authored
      When analyzing C code with function pointers the checker crashes because
      of how the implementation extracts `IdentifierInfo`. Without the fix, this
      test crashes.
      eda098aa
    • Abid Qadeer's avatar
      [flang] Initial debug info support for local variables. (#90905) · 61da6366
      Abid Qadeer authored
      We need the information in the `DeclareOp` to generate debug information
      for variables.  Currently, cg-rewrite removes the `DeclareOp`. As
      `AddDebugInfo` runs after that, it cannot process the `DeclareOp`. My
      initial plan was to make the `AddDebugInfo` pass run before the cg-rewrite
      but that has few issues.
          
      1. Initially I was thinking to use the memref op to carry the variable
      attr. But as @tblah suggested in the #86939, it makes more sense to
      carry that information on `DeclareOp`. It also makes it easy to handle
      it in codegen and there is no special handling needed for arguments. For
      this reason, we need to preserve the `DeclareOp` till the codegen.
          
      2. Running earlier, we will miss the changes in passes that run between
      cg-rewrite and codegen.
          
      But not removing the DeclareOp in cg-rewrite has the issue that ShapeOp
      remains and it causes errors during codegen. To solve this problem, I
      convert DeclareOp to XDeclareOp in cg-rewrite instead of removing
      it. This was mentioned as possible solution by @jeanPerier in
      https://reviews.llvm.org/D136254
          
      The conversion follows similar logic as used for other operators in that
      file. The FortranAttr and CudaAttr are currently not converted but left
      as TODO when the need arise.
      
      Now `AddDebugInfo` pass can extracts information about local variables
      from `XDeclareOp` and creates `DILocalVariableAttr`. These are attached
      to `XDeclareOp` using `FusedLoc` approach. Codegen can use them to
      create `DbgDeclareOp`.  I have added tests that checks the debug
      information in mlir from and also in llvm ir.
      
      Currently we only handle very limited types. Rest are given a place
      holder type. The previous placeholder type was basic type with
      `DW_ATE_address` encoding. When variables are added, it started
      causing assertions in the llvm debug info generation logic for some
      types. It has been changed to an interger type to prevent these issues
      until we handle those types properly.
      61da6366
    • Jay Foad's avatar
      466d2669
    • Jie Fu's avatar
      [Coroutines] Remove unused function (NFC) · 7c8176eb
      Jie Fu authored
      llvm-project/llvm/lib/Transforms/Coroutines/CoroSplit.cpp:1223:1:
      error: unused function 'scanPHIsAndUpdateValueMap' [-Werror,-Wunused-function]
      scanPHIsAndUpdateValueMap(Instruction *Prev, BasicBlock *NewBlock,
      ^
      1 error generated.
      7c8176eb
    • Krzysztof Parzyszek's avatar
      [Frontend][OpenMP] Reduction modifier must be applied somewhere (#92160) · 8d386c63
      Krzysztof Parzyszek authored
      Detect the case when a reduction modifier ends up not being applied
      after construct decomposition, treat it as an error.
      
      This fixes a regression in the gfortran test suite after PR90098.
      8d386c63
    • Krzysztof Parzyszek's avatar
      [Frontend][OpenMP] Privatizing clauses in construct decomposition (#92176) · 4ec4a8e7
      Krzysztof Parzyszek authored
      
      
      Add remaining clauses with the "privatizing" property to construct
      decomposition, specifically to the part handling the `allocate` clause.
      
      ---------
      
      Co-authored-by: default avatarTom Eccles <t@freedommail.info>
      4ec4a8e7
    • Krzysztof Parzyszek's avatar
      [flang][OpenMP] Add `private` to `allocate` in parallel-sections.f90 (#92185) · 97a30448
      Krzysztof Parzyszek authored
      Add a privatizing clause to the construct that uses `allocate` clause.
      Amend the CHECK lines to reflect the expected output.
      97a30448
    • Koakuma's avatar
      [clang][SPARC] Treat empty structs as if it's a one-bit type in the CC (#90338) · c2fba6df
      Koakuma authored
      Make sure that empty structs are treated as if it has a size of one bit
      in function parameters and return types so that it occupies a full
      argument and/or return register slot.
      
      This fixes crashes and miscompilations when passing and/or returning
      empty structs.
      
      Reviewed by: @s-barannikov
      c2fba6df
    • Krzysztof Parzyszek's avatar
      Fix bolt build with -DBUILD_SHARED_LIBS=ON after 71fbbb69 · 95e307ca
      Krzysztof Parzyszek authored
      Commit 71fbbb69 moved getGUID out of
      line in llvm/IR/GlobalValue, now users have to link LLVMCore to have
      the definition of it.
      
      /usr/bin/ld: CMakeFiles/LLVMBOLTRewrite.dir/PseudoProbeRewriter.cpp.o: in function `(anonymous namespace)::PseudoProbeRewriter::parsePseudoProbe()':
      PseudoProbeRewriter.cpp:(.text._ZN12_GLOBAL__N_119PseudoProbeRewriter16parsePseudoProbeEv+0x3d0): undefined reference to `llvm::GlobalValue::getGUID(llvm::StringRef)'
      /usr/bin/ld: CMakeFiles/LLVMBOLTRewrite.dir/PseudoProbeRewriter.cpp.o: in function `(anonymous namespace)::PseudoProbeRewriter::encodePseudoProbes()':
      PseudoProbeRewriter.cpp:(.text._ZN12_GLOBAL__N_119PseudoProbeRewriter18encodePseudoProbesEv+0x11a1): undefined reference to `llvm::GlobalValue::getGUID(llvm::StringRef)'
      collect2: error: ld returned 1 exit status
      make[2]: *** [tools/bolt/lib/Rewrite/CMakeFiles/LLVMBOLTRewrite.dir/build.make:275: lib/libLLVMBOLTRewrite.so.19.0git] Error 1
      95e307ca
    • Hans's avatar
      [coro] Lower `llvm.coro.await.suspend.handle` to resume with tail call (#89751) · 3bb39690
      Hans authored
      The C++ standard requires that symmetric transfer from one coroutine to
      another is performed via a tail call. Failure to do so is a miscompile
      and often breaks programs by quickly overflowing the stack.
      
      Until now, the coro split pass tried to ensure this in the
      `addMustTailToCoroResumes()` function by searching for
      `llvm.coro.resume` calls to lower as tail calls if the conditions were
      right: the right function arguments, attributes, calling convention
      etc., and if a `ret void` was sure to be reached after traversal with
      some ad-hoc constant folding following the call.
      
      This was brittle, as the kind of implicit variants required for a tail
      call to happen could easily be broken by other passes (e.g. if some
      instruction got in between the `resume` and `ret`), see for example
      9d1cb18d and
      284da049.
      
      Also the logic seemed backwards: instead of searching for possible tail
      call candidates and doing them if the circumstances are right, it seems
      better to start with the intention of making the tail calls we need, and
      forcing the circumstances to be right.
      
      Now that we have the `llvm.coro.await.suspend.handle` intrinsic (since
      f7868813) which corresponds exactly to
      symmetric transfer, change the lowering of that to also include the
      `resume` part, always lowered as a tail call.
      3bb39690
    • Kamlesh Kumar's avatar
      Revert "[ExceptionDemo] Correct and update example ExceptionDemo" (#92257) · b59760d8
      Kamlesh Kumar authored
      Reverts llvm/llvm-project#69485
      b59760d8