1. Aug 17, 2021
  2. Aug 16, 2021
    • Craig Topper's avatar
      [TypePromotion] Don't mutate the result type of SwitchInst. · 92abb1cf
      Craig Topper authored
      SwitchInst should have a void result type.
      
      Add a check to the verifier to catch this error.
      
      Reviewed By: samparker
      
      Differential Revision: https://reviews.llvm.org/D108084
      92abb1cf
    • Louis Dionne's avatar
      [libc++][NFC] Replace uses of 'constexpr friend' by 'friend constexpr' · 5ed162c8
      Louis Dionne authored
      This is done for consistency, since that's what we do everywhere else
      in the library.
      5ed162c8
    • Dimitry Andric's avatar
      [lldb] Avoid unhandled Error in TypeSystemMap::GetTypeSystemForLanguage · 5033f079
      Dimitry Andric authored
      When assertions are turned off, the `llvm::Error` value created at the
      start of this function is overwritten using the move-assignment
      operator, but the success value is never checked. Whenever a TypeSystem
      cannot be found or created, this can lead to lldb core dumping with:
      
          Program aborted due to an unhandled Error:
          Error value was Success. (Note: Success values must still be checked prior to being destroyed).
      
      Fix this by not creating a `llvm::Error` value in advance, and directly
      returning the result of `llvm::make_error` instead, whenever an error is
      encountered.
      
      See also: <https://bugs.freebsd.org/253881> and
      <https://bugs.freebsd.org/257829>.
      
      Reviewed By: teemperor
      
      Differential Revision: https://reviews.llvm.org/D108088
      5033f079
    • Simon Pilgrim's avatar
      [DAG] Fold concat_vectors(concat_vectors(x,y),concat_vectors(a,b)) -> concat_vectors(x,y,a,b) · d6fe8d37
      Simon Pilgrim authored
      Follow-up to D107068, attempt to fold nested concat_vectors/undefs, as long as both the vector and inner subvector types are legal.
      
      This exposed the same issue in ARM's MVE LowerCONCAT_VECTORS_i1 (raised as PR51365) and AArch64's performConcatVectorsCombine which both assumed concat_vectors only took 2 subvector operands.
      
      Differential Revision: https://reviews.llvm.org/D107597
      d6fe8d37
    • Peyton, Jonathan L's avatar
      [OpenMP] Add a few small fixes · b4a1f441
      Peyton, Jonathan L authored
      * Add comment to help ensure new construct data are added in two places
      * Check for division by zero in the loop worksharing code
      * Check for syntax errors in parrange parsing
      
      Differential Revision: https://reviews.llvm.org/D105929
      b4a1f441
    • Peyton, Jonathan L's avatar
      [OpenMP] Fix incorrect parameters to sscanf_s call · 6eeb4c1f
      Peyton, Jonathan L authored
      On Windows, the documentation states that when using sscanf_s,
      each %c and %s specifier must also have additional size parameter.
      This patch adds the size parameter in the one place where %c is
      used.
      
      Differential Revision: https://reviews.llvm.org/D105931
      6eeb4c1f
    • Jeremy Morse's avatar
      Revert 54a61c94 and its follow up in 547b7125 · 95fe61e6
      Jeremy Morse authored
      These were part of D107823, however asan  has found something excitingly
      wrong happening:
      
      https://lab.llvm.org/buildbot/#/builders/5/builds/10543/steps/13/logs/stdio
      95fe61e6
    • Sanjay Patel's avatar
      [InstCombine] allow for constant-folding in GEP transform · de285eac
      Sanjay Patel authored
      This would crash the reduced test or as described in
      https://llvm.org/PR51485
      ...because we can't mark a constant (-expression) with 'inbounds'.
      de285eac
    • Renato Golin's avatar
      a19747ea
    • Jeremy Morse's avatar
      Suppress signedness-comparison warning · 547b7125
      Jeremy Morse authored
      This is a follow-up to 54a61c94.
      547b7125
    • Kristóf Umann's avatar
      [analyzer] MallocChecker: Add a visitor to leave a note on functions that... · 2d3668c9
      Kristóf Umann authored
      [analyzer] MallocChecker: Add a visitor to leave a note on functions that could have, but did not change ownership on leaked memory
      
      This is a rather common feedback we get from out leak checkers: bug reports are
      really short, and are contain barely any usable information on what the analyzer
      did to conclude that a leak actually happened.
      
      This happens because of our bug report minimizing effort. We construct bug
      reports by inspecting the ExplodedNodes that lead to the error from the bottom
      up (from the error node all the way to the root of the exploded graph), and mark
      entities that were the cause of a bug, or have interacted with it as
      interesting. In order to make the bug report a bit less verbose, whenever we
      find an entire function call (from CallEnter to CallExitEnd) that didn't talk
      about any interesting entity, we prune it (click here for more info on bug
      report generation). Even if the event to highlight is exactly this lack of
      interaction with interesting entities.
      
      D105553 generalized the visitor that creates notes for these cases. This patch
      adds a new kind of NoStateChangeVisitor that leaves notes in functions that
      took a piece of dynamically allocated memory that later leaked as parameter,
      and didn't change its ownership status.
      
      Differential Revision: https://reviews.llvm.org/D105553
      2d3668c9
    • Jeremy Morse's avatar
      [DebugInfo][InstrRef] Honour too-much-debug-info cutouts · 54a61c94
      Jeremy Morse authored
      VarLoc based LiveDebugValues will abandon variable location propagation if
      there are too many blocks and variable assignments in the function. If it
      didn't, and we had (say) 1000 blocks and 1000 variables in scope, we'd end
      up with 1 million DBG_VALUEs just at the start of blocks.
      
      Instruction-referencing LiveDebugValues should honour this limitation too
      (because the same limitation applies to it). Hoist the relevant command
      line options into LiveDebugValues.cpp and pass it down into the
      implementation classes as an argument to ExtendRanges. I've duplicated all
      the run-lines in live-debug-values-cutoffs.mir to have an
      instruction-referencing flavour.
      
      Differential Revision: https://reviews.llvm.org/D107823
      54a61c94
    • Riccardo Mori's avatar
      [Polly][Isl] Move to the new-polly-generator branch version of isl-noexceptions.h. NFCI · d3fdbda6
      Riccardo Mori authored
      This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.
      
      With this commit we are moving from the `polly-generator` branch to the `new-polly-generator` branch that is more mantainable and is based on the official C++ interface `cpp-checked.h`.
      
      Changes made:
       - There are now many sublcasses for `isl::ast_node` representing different isl types. Use `isl::ast_node_for`, `isl::ast_node_user`, `isl::ast_node_block` and `isl::ast_node_mark` where needed.
       - There are now many sublcasses for `isl::schedule_node` representing different isl types. Use `isl::schedule_node_mark`, `isl::schedule_node_extension`, `isl::schedule_node_band` and `isl::schedule_node_filter` where needed.
       - Replace the `isl::*::dump` with `dumpIslObj` since the isl dump method is not exposed in the C++ interface.
       - `isl::schedule_node::get_child` has been renamed to `isl::schedule_node::child`
       - `isl::pw_multi_aff::get_pw_aff` has been renamed to `isl::pw_multi_aff::at`
       - The constructor `isl::union_map(isl::union_pw_multi_aff)` has been replaced with the static method `isl::union_map::from()`
       - Replace usages of `isl::val::add_ui` with `isl::val::add`
       - `isl::union_set_list::alloc` is now a constructor
       - All the `isl_size` values are now wrapped inside the class `isl::size` use `isl::size::release` to get the internal `isl_size` value where needed.
       - `isl-noexceptions.h` has been generated by https://github.com/patacca/isl/commit/73f5ed1f4d1f72582f731590ef9e43d9ab1956ad
      
      No functional change intended.
      
      Reviewed By: Meinersbur
      
      Differential Revision: https://reviews.llvm.org/D107225
      d3fdbda6
    • Kristóf Umann's avatar
      [analyzer][NFC] Split the main logic of NoStoreFuncVisitor to an abstract... · c019142a
      Kristóf Umann authored
      [analyzer][NFC] Split the main logic of NoStoreFuncVisitor to an abstract NoStateChangeVisitor class
      
      Preceding discussion on cfe-dev: https://lists.llvm.org/pipermail/cfe-dev/2021-June/068450.html
      
      NoStoreFuncVisitor is a rather unique visitor. As VisitNode is invoked on most
      other visitors, they are looking for the point where something changed -- change
      on a value, some checker-specific GDM trait, a new constraint.
      NoStoreFuncVisitor, however, looks specifically for functions that *didn't*
      write to a MemRegion of interesting. Quoting from its comments:
      
      /// Put a diagnostic on return statement of all inlined functions
      /// for which  the region of interest \p RegionOfInterest was passed into,
      /// but not written inside, and it has caused an undefined read or a null
      /// pointer dereference outside.
      
      It so happens that there are a number of other similar properties that are
      worth checking. For instance, if some memory leaks, it might be interesting why
      a function didn't take ownership of said memory:
      
      void sink(int *P) {} // no notes
      
      void f() {
        sink(new int(5)); // note: Memory is allocated
                          // Well hold on, sink() was supposed to deal with
                          // that, this must be a false positive...
      } // warning: Potential memory leak [cplusplus.NewDeleteLeaks]
      
      In here, the entity of interest isn't a MemRegion, but a symbol. The property
      that changed here isn't a change of value, but rather liveness and GDM traits
      managed by MalloChecker.
      
      This patch moves some of the logic of NoStoreFuncVisitor to a new abstract
      class, NoStateChangeFuncVisitor. This is mostly calculating and caching the
      stack frames in which the entity of interest wasn't changed.
      
      Descendants of this interface have to define 3 things:
      
      * What constitutes as a change to an entity (this is done by overriding
      wasModifiedBeforeCallExit)
      * What the diagnostic message should be (this is done by overriding
      maybeEmitNoteFor.*)
      * What constitutes as the entity of interest being passed into the function (this
      is also done by overriding maybeEmitNoteFor.*)
      
      Differential Revision: https://reviews.llvm.org/D105553
      c019142a
    • Simon Pilgrim's avatar
      [X86] Add PR46315 test case · 2c5c06c5
      Simon Pilgrim authored
      2c5c06c5
    • tashuang.zk's avatar
      [MLIR][DISC] Revise ParallelLoopTilingPass with inbound_check mode · 2d45e332
      tashuang.zk authored
      Expand ParallelLoopTilingPass with an inbound_check mode.
      
      In default mode, the upper bound of the inner loop is from the min op; in
      inbound_check mode, the upper bound of the inner loop is the step of the outer
      loop and an additional inbound check will be emitted inside of the inner loop.
      
      This was 'FIXME' in the original codes and a typical usage is for GPU backends,
      thus the outer loop and inner loop can be mapped to blocks/threads in seperate.
      
      Differential Revision: https://reviews.llvm.org/D105455
      2d45e332
    • Simon Pilgrim's avatar
      [InstCombine] Add PR38021 nuw test case. · a7dc7113
      Simon Pilgrim authored
      a7dc7113
    • Simon Pilgrim's avatar
      70ab32d3
    • Roman Lebedev's avatar
      Revert "[NFCI][IndVars] rewriteLoopExitValues(): nowadays SCEV should not... · febcedf1
      Roman Lebedev authored
      Revert "[NFCI][IndVars] rewriteLoopExitValues(): nowadays SCEV should not change `GEP` base pointer"
      
      https://bugs.llvm.org/show_bug.cgi?id=51490 was filed.
      
      This reverts commit 35a8bdc7.
      febcedf1
    • Dmitry Vyukov's avatar
      tsan: fix unused var warnings in a test · 79aed89e
      Dmitry Vyukov authored
      Reviewed By: melver
      
      Differential Revision: https://reviews.llvm.org/D108118
      79aed89e
    • Florian Hahn's avatar
      [LoopPeel] Add test with multiple exit blocks branching to unreachable. · 38c3cebd
      Florian Hahn authored
      Add test as suggested by @ebedev.ri in D108108.
      38c3cebd
    • AndreyChurbanov's avatar
      [OpenMP] libomp: cleanup: minor fixes to silence static analyzer. · 52cac541
      AndreyChurbanov authored
      Added couple more checks to silence KlocWork static code analyzer.
      
      Differential Revision: https://reviews.llvm.org/D107348
      52cac541
    • Kazushi (Jam) Marukawa's avatar
      [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend... · 7313a6d8
      Kazushi (Jam) Marukawa authored
      [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly
      
      Need to update a clang regression test for VE after
      https://reviews.llvm.org/D93769.
      
      Reviewed By: simoll
      
      Differential Revision: https://reviews.llvm.org/D108069
      7313a6d8
    • David Sherwood's avatar
    • Florian Hahn's avatar
      [PhaseOrdering] Add test for missed vectorization with vector::at calls. · 39cc0b8c
      Florian Hahn authored
      This test illustrates missed vectorization of loops with multiple
      std::vector::at calls, like
      
          int sum(std::vector<int> *A, std::vector<int> *B, int N) {
            int cost = 0;
            for (int i = 0; i < N; ++i)
              cost += A->at(i) + B->at(i);
            return cost;
          }
      
      https://clang.godbolt.org/z/KbYoaPhvq
      39cc0b8c
    • Florian Hahn's avatar
      96d5a501
    • Dmitry Vyukov's avatar
      tsan: add new trace · c9731899
      Dmitry Vyukov authored
      Add structures for the new trace format,
      functions that serialize and add events to the trace
      and trace replaying logic.
      
      Differential Revision: https://reviews.llvm.org/D107911
      c9731899
    • Florian Hahn's avatar
      Revert "[sanitizer] Define 32bit uptr as uint" · f7347dfa
      Florian Hahn authored
      This reverts commit 45138f78.
      
      It looks like this breaks building sanitizers on Darwin platforms on
      Green Dragon
      
      https://green.lab.llvm.org/green/job/clang-stage1-RA/23332/console
      
          FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o
          /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/clang-build/./bin/clang++  -DHAVE_RPC_XDR_H=0 -I/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/.. -Wall -std=c++14 -Wno-unused-parameter -O2 -g -DNDEBUG -arch armv7 -arch armv7s -arch arm64 -arch armv7k -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk    -stdlib=libc++ -miphoneos-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -g -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-format-pedantic -nostdinc++ -Wno-format -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -DSANITIZER_SUPPORTS_WEAK_HOOKS=0 -MD -MT lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o -c '/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp'
          In file included from /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp:13:
          In file included from /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h:15:
          /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common.h:1068:14: error: 'operator new' takes type size_t ('unsigned long') as first parameter
          inline void *operator new(__sanitizer::operator_new_size_type size,
                       ^
          1 error generated.
      f7347dfa
    • Roman Lebedev's avatar
      Revert "Reland [SimplifyCFG] performBranchToCommonDestFolding(): form... · 2eb554a9
      Roman Lebedev authored
      Revert "Reland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)"
      
      This is still wrong, as failing bots suggest.
      
      This reverts commit 3d9beefc.
      2eb554a9
    • Dmitry Vyukov's avatar
      sanitizers: compile with -O1 under debug · 7142eb17
      Dmitry Vyukov authored
      Tsan's check_memcpy.c test was disabled under debug because it failed.
      But it points to real issues and does not help to just disable it.
      I tried to enable it and see what fail and the first hit was default ctor for:
      
        struct ChainedOriginDepotDesc {
          u32 here_id;
          u32 prev_id;
        };
      
      initializing these fields to 0's help partially,
      but compiler still emits memset before calling ctor.
      I did not try to see what's the next failure, because if it fails
      on such small structs, it won't be realistic to fix everything
      and keep working.
      
      Compile runtimes with -O1 under debug instead.
      It seems to fix all current failures. At least I run check-tsan
      under clang/gcc x debug/non-debug and all combinations passed.
      -O1 does not usually use too aggressive optimizations
      and sometimes even makes debugging easier because machine code
      is not exceedingly verbose.
      
      Reviewed By: vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D107962
      7142eb17
    • Cullen Rhodes's avatar
      [AArch64][SME] Disable NEON in streaming mode · 09507b53
      Cullen Rhodes authored
      In streaming mode most of the NEON instruction set is illegal, disable
      NEON when compiling with `+streaming-sve`, unless NEON is explictly
      requested.
      
      Subsequent patches will add support for the small subset of NEON
      instructions that are legal in streaming mode.
      
      Reviewed By: paulwalker-arm, david-arm
      
      Differential Revision: https://reviews.llvm.org/D107902
      09507b53
    • Christian Sigg's avatar
      Reset all options in cl::ResetCommandLineParser() · 93c55d5e
      Christian Sigg authored
      Reset cl::Positional, cl::Sink and cl::ConsumeAfter options as well in cl::ResetCommandLineParser().
      
      Reviewed By: rriddle, sammccall
      
      Differential Revision: https://reviews.llvm.org/D103356
      93c55d5e
    • Dmitry Vyukov's avatar
      sanitizer_common: fix format string in LibIgnore · 71850077
      Dmitry Vyukov authored
      uptr should be printed with %zu.
      
      Differential Revision: https://reviews.llvm.org/D108106
      71850077
    • Tres Popp's avatar
      [mlir] Set top-down traversal for LinalgElementwiseOpFusion · 2848f696
      Tres Popp authored
      The primary pattern for this pass clones many operations from producers
      to consumers. Doing this top down prevents duplicated work when a
      producer has multiple consumers, if it also is consuming another
      linalg.generic.
      
      As an example, a chain of ~2600 generics that are fused into ~70
      generics was resulting in 16255 pattern invocations. This took 14
      seconds on one machine but takes only 0.3 seconds with top-down
      traversal.
      
      Differential Revision: https://reviews.llvm.org/D107818
      2848f696