platform/upstream/llvm.git
13 months ago[ConstraintElimination] Add tests with incrementing pointer IV.
Florian Hahn [Sat, 27 May 2023 19:47:57 +0000 (20:47 +0100)]
[ConstraintElimination] Add tests with incrementing pointer IV.

Add initial set of tests for improved loop phi handling.

13 months ago[gn build] Port ddeab07ca632
LLVM GN Syncbot [Sat, 27 May 2023 19:23:49 +0000 (19:23 +0000)]
[gn build] Port ddeab07ca632

13 months ago[gn] port b22965df1304
Nico Weber [Sat, 27 May 2023 19:23:26 +0000 (15:23 -0400)]
[gn] port b22965df1304

13 months ago[Analysis] Remove unused declaration getCurrentLVarDefinition
Kazu Hirata [Sat, 27 May 2023 17:45:18 +0000 (10:45 -0700)]
[Analysis] Remove unused declaration getCurrentLVarDefinition

The declaration was added without a corresponding function definition
by:

  commit ae497deddfd9c631380bc622fa3e184531c2600a
  Author: DeLesley Hutchins <delesley@google.com>
  Date:   Sat Apr 19 00:35:54 2014 +0000

13 months ago[Serialization] Remove unused declaration SLocCursorForID
Kazu Hirata [Sat, 27 May 2023 17:45:16 +0000 (10:45 -0700)]
[Serialization] Remove unused declaration SLocCursorForID

The corresponding function body was removed by:

  commit 925296b4c2cbb358c34323dfcffbea6d59eb9c1e
  Author: Douglas Gregor <dgregor@apple.com>
  Date:   Tue Jul 19 16:10:42 2011 +0000

13 months ago[AST] Remove unused function removeLocalCVRQualifiers
Kazu Hirata [Sat, 27 May 2023 17:29:23 +0000 (10:29 -0700)]
[AST] Remove unused function removeLocalCVRQualifiers

The last use was removed by:

  commit 0eb06cb3aa2700508c20da28f22ff91e7b82a436
  Author: Roy Jacobson <roi.jacobson1@gmail.com>
  Date:   Tue Mar 14 21:25:54 2023 +0200

Differential Revision: https://reviews.llvm.org/D151607

13 months ago[Bitcode] Modernize PerBlockIDStats (NFC)
Kazu Hirata [Sat, 27 May 2023 17:29:21 +0000 (10:29 -0700)]
[Bitcode] Modernize PerBlockIDStats (NFC)

13 months ago[polly] Fix typos in documentation
Kazu Hirata [Sat, 27 May 2023 17:29:20 +0000 (10:29 -0700)]
[polly] Fix typos in documentation

13 months ago[Hexagon] Use scalar evolution to calculate pointer difference in HVC
Krzysztof Parzyszek [Fri, 26 May 2023 16:20:12 +0000 (09:20 -0700)]
[Hexagon] Use scalar evolution to calculate pointer difference in HVC

13 months ago[CGP] Disable default copy ctor and copy assignment operator for InstructionRemover
Bing1 Yu [Fri, 26 May 2023 08:48:39 +0000 (16:48 +0800)]
[CGP] Disable default copy ctor and copy assignment operator for InstructionRemover

class InstructionRemover manages resources such as dynamically allocated memory, it's generally a good practice to either implement a custom copy constructor or disable the default one.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D151543

13 months ago[NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::GetConstantArrayFromStri...
Manna, Soumi [Sat, 27 May 2023 14:15:24 +0000 (07:15 -0700)]
[NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::GetConstantArrayFromStringLiteral()

This patch adds an assert.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D151480

13 months ago[X86] lowerBuildVectorAsBroadcast - broadcast Constant of original (BuildVector)...
Simon Pilgrim [Wed, 24 May 2023 18:51:21 +0000 (19:51 +0100)]
[X86] lowerBuildVectorAsBroadcast - broadcast Constant of original (BuildVector) element size

Noticed in D150143/D150526 - we currently create scalar Constant values using the broadcast instruction width, which might be wider than the original build vector width, making it tricky to recognise the original constant bits data.

If we have widened the broadcast value, its much more useful for asm comments if we create a ConstantVector with the original element data, add that to the constant-pool and load that with the same (wider) broadcast instruction.

13 months ago[flang][runtime] Support all non-ASCII characters in temporary path on Windows
Markus Mützel [Sat, 27 May 2023 12:54:18 +0000 (14:54 +0200)]
[flang][runtime] Support all non-ASCII characters in temporary path on Windows

If the path to the TEMP folder contains (non-ASCII) characters that cannot be
encoded in the current 8-bit locale of the user, openfile_mkstemp might fail
on Windows.
That is an unlikely scenario. But given that the path to the default TEMP
folder on Windows contains the Windows user name, it is still possible.

Use the wide character Windows API to avoid that (unlikely) issue.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D151571

13 months ago[libc++][format][test] Adds Windows support.
Mark de Wever [Sat, 27 May 2023 11:57:26 +0000 (13:57 +0200)]
[libc++][format][test] Adds Windows support.

These tests pass on Windows without additional changes. This has been
tested in D150593.

13 months agoReland "[CMake] Bumps minimum version to 3.20.0.
Mark de Wever [Wed, 24 May 2023 16:12:32 +0000 (18:12 +0200)]
Reland "[CMake] Bumps minimum version to 3.20.0.

This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6.

Adds the patch by @hans from
https://github.com/llvm/llvm-project/issues/62719
This patch fixes the Windows build.

d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews

D144509 [CMake] Bumps minimum version to 3.20.0.

This partly undoes D137724.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.

D150532 [OpenMP] Compile assembly files as ASM, not C

Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent)
when compiling a file which has been set as having the language
C. This behaviour change only takes place if "cmake_minimum_required"
is set to 3.20 or newer, or if the policy CMP0119 is set to new.

Attempting to compile assembly files with "-x c" fails, however
this is workarounded in many cases, as OpenMP overrides this with
"-x assembler-with-cpp", however this is only added for non-Windows
targets.

Thus, after increasing cmake_minimum_required to 3.20, this breaks
compiling the GNU assembly for Windows targets; the GNU assembly is
used for ARM and AArch64 Windows targets when building with Clang.
This patch unbreaks that.

D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump

The build uses other mechanism to select the runtime.

Fixes #62719

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D151344

13 months ago[bazel] Add missing dependency for ddeab07ca63235f8d952e1171b56fdb0f2d761c9
Benjamin Kramer [Sat, 27 May 2023 10:04:36 +0000 (12:04 +0200)]
[bazel] Add missing dependency for ddeab07ca63235f8d952e1171b56fdb0f2d761c9

13 months ago[Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst
M. Zeeshan Siddiqui [Sat, 27 May 2023 08:43:35 +0000 (16:43 +0800)]
[Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

Fix indentation and spacing.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D151610

13 months ago[clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl
Anubhab Ghosh [Mon, 6 Mar 2023 11:20:02 +0000 (16:50 +0530)]
[clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl

CUDA support can be enabled in clang-repl with --cuda flag.
Device code linking is not yet supported. inline must be used with all
__device__ functions.

Differential Revision: https://reviews.llvm.org/D146389

13 months ago[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e, second
Haojian Wu [Sat, 27 May 2023 06:37:45 +0000 (08:37 +0200)]
[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e, second
attempt.

13 months ago[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e
Haojian Wu [Sat, 27 May 2023 06:03:02 +0000 (08:03 +0200)]
[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e

13 months ago[Clang][BFloat16] Upgrade __bf16 to arithmetic type, change mangling, and extend...
M. Zeeshan Siddiqui [Sat, 27 May 2023 03:45:12 +0000 (11:45 +0800)]
[Clang][BFloat16] Upgrade __bf16 to arithmetic type, change mangling, and extend excess precision support

Pursuant to discussions at
https://discourse.llvm.org/t/rfc-c-23-p1467r9-extended-floating-point-types-and-standard-names/70033/22,
this commit enhances the handling of the __bf16 type in Clang.
- Firstly, it upgrades __bf16 from a storage-only type to an arithmetic
  type.
- Secondly, it changes the mangling of __bf16 to DF16b on all
  architectures except ARM. This change has been made in
  accordance with the finalization of the mangling for the
  std::bfloat16_t type, as discussed at
  https://github.com/itanium-cxx-abi/cxx-abi/pull/147.
- Finally, this commit extends the existing excess precision support to
  the __bf16 type. This applies to hardware architectures that do not
  natively support bfloat16 arithmetic.
Appropriate tests have been added to verify the effects of these
changes and ensure no regressions in other areas of the compiler.

Reviewed By: rjmccall, pengfei, zahiraam

Differential Revision: https://reviews.llvm.org/D150913

13 months ago[CodeGen] Remove unused MachineMemOperand::Profile (NFC)
Sergei Barannikov [Sat, 27 May 2023 04:34:48 +0000 (07:34 +0300)]
[CodeGen] Remove unused MachineMemOperand::Profile (NFC)

The last use was removed by
commit 48b185d6f718f0408a54bc7be8387beb3237cff3
Author: Dan Gohman <gohman@apple.com>
Date:   Fri Sep 25 20:36:54 2009 +0000

13 months ago[Sema] Remove unused declaration startLambdaDefinition
Kazu Hirata [Sat, 27 May 2023 03:19:23 +0000 (20:19 -0700)]
[Sema] Remove unused declaration startLambdaDefinition

The corresponding function definition was removed by:

  commit 93d7002dc4644b0a6f15a998dff0d55c72012e87
  Author: Corentin Jabot <corentinjabot@gmail.com>
  Date:   Sun Feb 6 22:58:43 2022 +0100

13 months ago[clangd] Remove unused declaration onCallHierarchyOutgoingCalls
Kazu Hirata [Sat, 27 May 2023 03:19:22 +0000 (20:19 -0700)]
[clangd] Remove unused declaration onCallHierarchyOutgoingCalls

The corresponding function definition was removed by:

  commit 1a929525e86a20d0b3455a400d0dbed40b325a13
  Author: Kadir Cetinkaya <kadircet@google.com>
  Date:   Tue Dec 21 17:06:40 2021 +0100

13 months ago[CodeGen] Remove unused declarations emitNonSPMDParallelCall and emitSPMDParallelCall
Kazu Hirata [Sat, 27 May 2023 03:07:52 +0000 (20:07 -0700)]
[CodeGen] Remove unused declarations emitNonSPMDParallelCall and emitSPMDParallelCall

The corresponding function definitions were removed by:

  commit a2dbfb6b72db19ed851464160ef7539b50d43894
  Author: Giorgis Georgakoudis <georgakoudis1@llnl.gov>
  Date:   Wed Apr 21 11:41:31 2021 -0700

13 months ago[AST] Remove unused declaration enumerateVFPtrs
Kazu Hirata [Sat, 27 May 2023 03:07:51 +0000 (20:07 -0700)]
[AST] Remove unused declaration enumerateVFPtrs

The corresponding function definition was removed by:

  commit 9c6e9e313d61284f3d7fa46c86b6f999c8a1adea
  Author: Reid Kleckner <reid@kleckner.net>
  Date:   Thu Feb 27 19:40:09 2014 +0000

13 months ago[Sema] Remove unused declaration ConvertIntegerToTypeWarnOnOverflow
Kazu Hirata [Sat, 27 May 2023 03:07:49 +0000 (20:07 -0700)]
[Sema] Remove unused declaration ConvertIntegerToTypeWarnOnOverflow

The corresponding function definition was removed by:

  commit 077d083b4dd12538fc824d5784d455da0d86a1ea
  Author: Richard Smith <richard-llvm@metafoo.co.uk>
  Date:   Mon Aug 4 00:40:48 2014 +0000

13 months ago[Driver] Remove redundant -z special case. NFC
Fangrui Song [Sat, 27 May 2023 02:39:19 +0000 (19:39 -0700)]
[Driver] Remove redundant -z special case. NFC

13 months ago[hwasan] support hwasan-match-all-tag flag for hwasan meminstrinsic calls
Enna1 [Sat, 27 May 2023 02:35:18 +0000 (10:35 +0800)]
[hwasan] support hwasan-match-all-tag flag for hwasan meminstrinsic calls

This patch implements `__hwasan_memset_match_all`, `__hwasan_memcpy_match_all` and `__hwasan_memmove_match_all`, making hwasan-match-all-tag flag working for hwasan versions of memset, memcpy and memmove.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149943

13 months ago[hwasan] support hwasan-match-all-tag flag for callback memory access instrumentation
Enna1 [Sat, 27 May 2023 02:27:28 +0000 (10:27 +0800)]
[hwasan] support hwasan-match-all-tag flag for callback memory access instrumentation

Currently, hwasan-match-all-tag flag is supported in inline memory access instrumentation and outline memory access instrumentation, but not supported in callback memory access instrumentation.

- For inline memory access instrumentation: a hwasan-match-all-tag check is added following the tag-mismtach check, if tag from pointer is mismatched with tag from shadow memory and tag from pointer is not equal with hwasan-match-all-tag, then a tag-mismatch will be report.
- For outline memory acess instrumentation: MatchAllTag is encoded in AccessInfo, when emit HWASAN memaccess symbols, asm-printer emits assembly instructions to check if tag from pointer is equal with hwasan-match-all-tag.
- For callback memory access instrumentation: hwasan-match-all-tag check is not implemented in `__hwasan_load`/`__hwasan_store`.

This patch implements a set of callback functions: `__hwasan_[load|store][1|2|4|8|16|n]_match_all` and `__hwasan_load[load|store][1|2|4|8|16|n]_match_all_noabort`, making hwasan-match-all-tag flag working for callback memory access instrumentation.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149580

13 months ago[Driver][test] Replace legacy -target with --target=
Fangrui Song [Sat, 27 May 2023 02:01:39 +0000 (19:01 -0700)]
[Driver][test] Replace legacy -target with --target=

13 months ago[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t...
Jie Fu [Sat, 27 May 2023 01:53:10 +0000 (09:53 +0800)]
[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t' error (NFC)

/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1007:39: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(propReader.parseVarInt(count)))
                                      ^~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
  LogicalResult parseVarInt(uint64_t &result) {
                                      ^
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1020:44: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
      if (failed(offsetsReader.parseVarInt(dataSize)) ||
                                           ^~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
  LogicalResult parseVarInt(uint64_t &result) {
                                      ^
2 errors generated.

13 months ago[CodeGen][NFC] Declare copy constructor & copy assignment as deleted for ScheduleDAG
Shengchen Kan [Fri, 26 May 2023 06:26:06 +0000 (14:26 +0800)]
[CodeGen][NFC] Declare copy constructor & copy assignment as deleted for ScheduleDAG

ScheduleDAG has derived classes ScheduleDAGVLIW and ScheduleDAGRRList,
which own resources that are freed in their destructors. Static analyzer
warns b/c they do not have user-written copy constructors.

According to the design of ScheduleDAG, it seems that it should always
be passed by reference. So I declare them as deleted in this patch.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D151538

13 months ago[MLIR] Add native Bytecode support for properties
Mehdi Amini [Fri, 26 May 2023 04:04:35 +0000 (21:04 -0700)]
[MLIR] Add native Bytecode support for properties

This is adding a new interface (`BytecodeOpInterface`) to allow operations to
opt-in skipping conversion to attribute and serializing properties to native
bytecode.

The scheme relies on a new section where properties are stored in sequence

  { size, serialize_properties }, ...

The operations are storing the index of a properties, a table of offset is
built when loading the properties section the first time.

This is a re-commit of 837d1ce0dc which conflicted with another patch upgrading
the bytecode and the collision wasn't properly resolved before.

Differential Revision: https://reviews.llvm.org/D151065

13 months ago[MemProf] Clean up MemProf instrumentation pass invocation
Teresa Johnson [Fri, 26 May 2023 22:07:24 +0000 (15:07 -0700)]
[MemProf] Clean up MemProf instrumentation pass invocation

First, removes the invocation of the memprof instrumentation passes from
the end of the module simplification pass builder, where it doesn't
really belong. However, it turns out that this was never being invoked,
as it is guarded by an internal option not used anywhere (even tests).

These passes are actually added via clang under the -fmemory-profile
option. Changed this to add via the EP callback interface, similar to
the sanitizer passes. They are added to the EP for the end of the
optimization pipeline, which is roughly where they were being added
already (end of the pre-LTO link pipelines and non-LTO optimization
pipeline).

Ideally we should plumb the output file through to LLVM and set it up
there, so I have added a TODO.

Differential Revision: https://reviews.llvm.org/D151593

13 months ago[Vectorize] Fix warnings
Kazu Hirata [Sat, 27 May 2023 00:27:25 +0000 (17:27 -0700)]
[Vectorize] Fix warnings

This patch fixes:

  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:140:20: error:
  unused function 'operator<<' [-Werror,-Wunused-function]

  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:176:6: error:
  unused function 'dumpChain' [-Werror,-Wunused-function]

13 months ago[Vectorize] Fix a warning
Kazu Hirata [Sat, 27 May 2023 00:02:34 +0000 (17:02 -0700)]
[Vectorize] Fix a warning

This patch fixes:

  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:1429:23:
  error: comparison of integers of different signs: 'int' and 'const
  size_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]

13 months ago[mlir][spirv][NFC] Clean up SPIR-V canonicalization
Jakub Kuderski [Fri, 26 May 2023 23:54:44 +0000 (19:54 -0400)]
[mlir][spirv][NFC] Clean up SPIR-V canonicalization

Follow best practices. Use llvm helper functions for readability.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D151600

13 months ago[RISCV] Add isel patterns to form tail undisturbed vfwadd.wv from fpextend_vl+vfwadd_...
Craig Topper [Fri, 26 May 2023 23:44:20 +0000 (16:44 -0700)]
[RISCV] Add isel patterns to form tail undisturbed vfwadd.wv from fpextend_vl+vfwadd_vl+vp_merge.

We use a special TIED instructions for vfwadd.wv to avoid an
earlyclobber constraint preventing the first source and the destination
from being the same register.

This prevents our normal post process for forming TU instructions.
Add manual isel pattern instead. This matches what we do for FMA
for example.

13 months agoskip test run on amdgcn-amd-amdhsa
Jennifer Yu [Fri, 26 May 2023 23:14:03 +0000 (16:14 -0700)]
skip test run on amdgcn-amd-amdhsa

13 months ago[mlir][spirv] Enhance folding capability of spirv::CompositeExtractOp::fold
Nishant Patel [Fri, 26 May 2023 23:20:53 +0000 (19:20 -0400)]
[mlir][spirv] Enhance folding capability of spirv::CompositeExtractOp::fold

This PR improves the `spirv::CompositeExtractOp::fold` function by adding a backtracking mechanism.
The updated function can now traverse a chain of `CompositeInsertOp`s to find a match.

Patch By: nbpatel
Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D151536

13 months agoFix -Wsign-compare from D149893.
Justin Lebar [Fri, 26 May 2023 23:22:16 +0000 (16:22 -0700)]
Fix -Wsign-compare from D149893.

13 months agoFix runtime crash inside __kmpc_init_allocator
Jennifer Yu [Fri, 26 May 2023 17:48:51 +0000 (10:48 -0700)]
Fix runtime crash inside __kmpc_init_allocator

It seems load of traits.addr should be passed in runtime call.  Currently
the load of load traits.addr gets passed cause runtime to fail.

To fix this, skip the call to EmitLoadOfScalar for extra load.

Differential Revision: https://reviews.llvm.org/D151576

13 months ago[Dexter] XFAIL Dexter tests for Apple Silicon (arm64)
Jonas Devlieghere [Fri, 26 May 2023 22:42:42 +0000 (15:42 -0700)]
[Dexter] XFAIL Dexter tests for Apple Silicon (arm64)

13 months agoRevert "[lldb] Disable variable watchpoints when going out of scope"
Jason Molenda [Fri, 26 May 2023 22:31:41 +0000 (15:31 -0700)]
Revert "[lldb] Disable variable watchpoints when going out of scope"

Reverting https://reviews.llvm.org/D151366 until Ismail has a chance
to look at the ubuntu CI test failures and can reland.

This reverts commit 7c847ac4bd1bd8a89c7fbb4581328fa8cb0498f1.

13 months agoFix test failure after 2be0abb7fe7 (caused by bad merge, sorry).
Justin Lebar [Fri, 26 May 2023 22:30:10 +0000 (15:30 -0700)]
Fix test failure after 2be0abb7fe7 (caused by bad merge, sorry).

13 months ago[clang][modules] NFCI: Use `DirectoryEntryRef` for umbrella directory
Jan Svoboda [Fri, 26 May 2023 20:14:16 +0000 (13:14 -0700)]
[clang][modules] NFCI: Use `DirectoryEntryRef` for umbrella directory

This removes some deprecated uses of `DirectoryEntry::getName()`.

Depends on D151581.

Differential Revision: https://reviews.llvm.org/D151584

13 months ago[Driver] Reject AIX-specific link options on non-AIX targets
Fangrui Song [Fri, 26 May 2023 22:30:23 +0000 (15:30 -0700)]
[Driver] Reject AIX-specific link options on non-AIX targets

Follow-up to D106688 and D146431.

-b leads to a -Wunused-command-line-argument warning instead of an error
without linking phase.
-mxcoff-build-id= leads to a -Wunused-command-line-argument warning instead of
an error.

13 months agoRewrite load-store-vectorizer.
Justin Lebar [Thu, 4 May 2023 19:34:43 +0000 (12:34 -0700)]
Rewrite load-store-vectorizer.

The motivation for this change is a workload generated by the XLA compiler
targeting nvidia GPUs.

This kernel has a few hundred i8 loads and stores.  Merging is critical for
performance.

The current LSV doesn't merge these well because it only considers instructions
within a block of 64 loads+stores.  This limit is necessary to contain the
O(n^2) behavior of the pass.  I'm hesitant to increase the limit, because this
pass is already one of the slowest parts of compiling an XLA program.

So we rewrite basically the whole thing to use a new algorithm.  Before, we
compared every load/store to every other to see if they're consecutive.  The
insight (from tra@) is that this is redundant.  If we know the offset from PtrA
to PtrB, then we don't need to compare PtrC to both of them in order to tell
whether C may be adjacent to A or B.

So that's what we do.  When scanning a basic block, we maintain a list of
chains, where we know the offset from every element in the chain to the first
element in the chain.  Each instruction gets compared only to the leaders of
all the chains.

In the worst case, this is still O(n^2), because all chains might be of length
1.  To prevent compile time blowup, we only consider the 64 most recently used
chains.  Thus we do no more comparisons than before, but we have the potential
to make much longer chains.

This rewrite affects many tests.  The changes to tests fall into two
categories.

1. The old code had what appears to be a bug when deciding whether a misaligned
   vectorized load is fast.  Suppose TTI reports that load <i32 x 4> align 4
   has relative speed 1, and suppose that load i32 align 4 has relative speed
   32.

   The intent of the code seems to be that we prefer the scalar load, because
   it's faster.  But the old code would choose the vectorized load.
   accessIsMisaligned would set RelativeSpeed to 0 for the scalar load (and not
   even call into TTI to get the relative speed), because the scalar load is
   aligned.

   After this patch, we will prefer the scalar load if it's faster.

2. This patch changes the logic for how we vectorize.  Usually this results in
   vectorizing more.

Explanation of changes to tests:

 - AMDGPU/adjust-alloca-alignment.ll: #1
 - AMDGPU/flat_atomic.ll: #2, we vectorize more.
 - AMDGPU/int_sideeffect.ll: #2, there are two possible locations for the call to @foo, and the pass is brittle to this.  Before, we'd vectorize in case 1 and not case 2.  Now we vectorize in case 2 and not case 1.  So we just move the call.
 - AMDGPU/adjust-alloca-alignment.ll: #2, we vectorize more
 - AMDGPU/insertion-point.ll: #2 we vectorize more
 - AMDGPU/merge-stores-private.ll: #1 (undoes changes from git rev 86f9117d476, which appear to have hit the bug from #1)
 - AMDGPU/multiple_tails.ll: #1
 - AMDGPU/vect-ptr-ptr-size-mismatch.ll: Fix alignment (I think related to #1 above).
 - AMDGPU CodeGen: I have difficulty commenting on these changes, but many of them look like #2, we vectorize more.
 - NVPTX/4x2xhalf.ll: Fix alignment (I think related to #1 above).
 - NVPTX/vectorize_i8.ll: We don't generate <3 x i8> vectors on NVPTX because they're not legal (and eventually get split)
 - X86/correct-order.ll: #2, we vectorize more, probably because of changes to the chain-splitting logic.
 - X86/subchain-interleaved.ll: #2, we vectorize more
 - X86/vector-scalar.ll: #2, we can now vectorize scalar float + <1 x float>
 - X86/vectorize-i8-nested-add-inseltpoison.ll: Deleted the nuw test because it was nonsensical.  It was doing `add nuw %v0, -1`, but this is equivalent to `add nuw %v0, 0xffff'ffff`, which is equivalent to asserting that %v0 == 0.
 - X86/vectorize-i8-nested-add.ll: Same as nested-add-inseltpoison.ll

Differential Revision: https://reviews.llvm.org/D149893

13 months ago[clang][modules] NFCI: Distinguish as-written and effective umbrella directories
Jan Svoboda [Fri, 26 May 2023 19:24:06 +0000 (12:24 -0700)]
[clang][modules] NFCI: Distinguish as-written and effective umbrella directories

For modules with umbrellas, we track how they were written in the module map. Unfortunately, the getter for the umbrella directory conflates the "as written" directory and the "effective" directory (either the written one or the parent of the written umbrella header).

This patch makes the distinction between "as written" and "effective" umbrella directories clearer. No functional change intended.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D151581

13 months ago[Dexter] Don't hardcode x86_64 as the default architecture
Jonas Devlieghere [Fri, 26 May 2023 22:06:11 +0000 (15:06 -0700)]
[Dexter] Don't hardcode x86_64 as the default architecture

Use platform.machine() as the default architecture instead of hardcoding
it to x86_64.

13 months ago[llvm-debuginfod][NFC] Switch to OptTable
Andrés Villegas [Fri, 26 May 2023 21:32:28 +0000 (14:32 -0700)]
[llvm-debuginfod][NFC] Switch to OptTable

Reviewed By: mysterymath

Differential Revision: https://reviews.llvm.org/D151273

13 months ago[HWASan] use hwasan linker for Android 14+
Florian Mayer [Wed, 24 May 2023 23:30:31 +0000 (16:30 -0700)]
[HWASan] use hwasan linker for Android 14+

This will allow to compile binaries that use hwasan to run on a
non-HWASan system image.

Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D151388

13 months ago[clang-tidy] Check for specific return types on all functions
NagaChaitanya Vellanki [Fri, 26 May 2023 20:57:17 +0000 (13:57 -0700)]
[clang-tidy] Check for specific return types on all functions

Extend the check to all functions with return types like
         std::error_code, std::expected, boost::system::error_code, abseil::Status...

         Resolves issue https://github.com/llvm/llvm-project/issues/62884

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D151383

13 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Fri, 26 May 2023 20:58:20 +0000 (13:58 -0700)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

13 months agoRevert "Factor out xcrun into a function (NFC)"
Adrian Prantl [Fri, 26 May 2023 20:51:30 +0000 (13:51 -0700)]
Revert "Factor out xcrun into a function (NFC)"

This reverts commit 97ca34996dbe5a61e79d7c559af7b15dc39c08a5.

13 months agoRevert "Make function static (NFC)"
Adrian Prantl [Fri, 26 May 2023 20:51:25 +0000 (13:51 -0700)]
Revert "Make function static (NFC)"

This reverts commit cefd2802aa49274942da87edf5019b5a23315f01.

13 months ago[lldb] Skip instead of XFAIL TestInteractiveScriptedProcess
Jonas Devlieghere [Fri, 26 May 2023 20:10:51 +0000 (13:10 -0700)]
[lldb] Skip instead of XFAIL TestInteractiveScriptedProcess

The test is failing on x86_64 but passing on arm64. Skip until Ismail
can investigate this further.

13 months agoMake function static (NFC)
Adrian Prantl [Fri, 26 May 2023 20:12:12 +0000 (13:12 -0700)]
Make function static (NFC)

13 months agoFactor out xcrun into a function (NFC)
Adrian Prantl [Fri, 26 May 2023 20:01:34 +0000 (13:01 -0700)]
Factor out xcrun into a function (NFC)

13 months ago[PseudoProbe] Do not force the calliste debug loc to inlined probes from __nodebug__...
Hongtao Yu [Fri, 26 May 2023 05:41:58 +0000 (22:41 -0700)]
[PseudoProbe] Do not force the calliste debug loc to inlined probes from __nodebug__ functions.

For pseudo probes we would like to keep their original dwarf discriminator (either a zero or null) until the first FS-discriminator pass. The inliner is a violation of that, given that it assigns inlinee instructions with no debug info with the that of the callsite. This is being disabled in this patch.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D151568

13 months ago[PhaseOrdering] Add test for loop over span with hardened libc++.
Florian Hahn [Fri, 26 May 2023 19:58:05 +0000 (20:58 +0100)]
[PhaseOrdering] Add test for loop over span with hardened libc++.

Add a slightly reduced test case for a loop iterating over a std::span
with libc++ hardening.

See https://godbolt.org/z/cKerYq9fY.

13 months ago[MLIR][python bindings] Fix inferReturnTypes + AttrSizedOperandSegments for optional...
max [Fri, 26 May 2023 19:39:03 +0000 (14:39 -0500)]
[MLIR][python bindings] Fix inferReturnTypes + AttrSizedOperandSegments for optional operands

Right now `inferTypeOpInterface.inferReturnTypes` fails because there's a cast in there to `py::sequence` which throws a `TypeError` when it tries to cast the `None`s. Note `None`s are inserted into `operands` for omitted operands passed to the generated builder:

```
    operands.append(_get_op_result_or_value(start) if start is not None else None)
    operands.append(_get_op_result_or_value(stop) if stop is not None else None)
    operands.append(_get_op_result_or_value(step) if step is not None else None)
```

Note also that skipping appending to the list operands doesn't work either because [[ https://github.com/llvm/llvm-project/blob/27c37327da67020f938aabf0f6405f57d688441e/mlir/lib/Bindings/Python/IRCore.cpp#L1585 | build generic ]] checks against the number of operand segments expected.

Currently the only way around is to handroll through `ir.Operation.create`.

Reviewed By: rkayaith

Differential Revision: https://reviews.llvm.org/D151409

13 months ago[libc++][NFC] Add additional test case for modules issue in Objective-C++
Louis Dionne [Thu, 25 May 2023 16:46:21 +0000 (09:46 -0700)]
[libc++][NFC] Add additional test case for modules issue in Objective-C++

Differential Revision: https://reviews.llvm.org/D151467

13 months ago[SLP]Fix getSpillCost functions.
Alexey Bataev [Fri, 26 May 2023 17:35:25 +0000 (10:35 -0700)]
[SLP]Fix getSpillCost functions.

There are several issues in the current implementation. The instructions
are not properly ordered, if they are placed in different basic blocks,
need to reverse the order of blocks. Also, need to exclude
non-vectorizable nodes and check for CallBase, not CallInst, otherwise
invoke calls are not handled correctly.

13 months ago[RISCV] Simplify code in LowerIS_FPCLASS. NFC
Craig Topper [Fri, 26 May 2023 19:16:19 +0000 (12:16 -0700)]
[RISCV] Simplify code in LowerIS_FPCLASS. NFC

13 months ago[RISCV] Remove extra MVT::Other result from creation of RISCVISD::FCLASS_VL.
Craig Topper [Fri, 26 May 2023 19:01:14 +0000 (12:01 -0700)]
[RISCV] Remove extra MVT::Other result from creation of RISCVISD::FCLASS_VL.

13 months agoAdd fastmath attributes to llvm.call_intrinsic
electriclilies [Fri, 26 May 2023 18:53:17 +0000 (11:53 -0700)]
Add fastmath attributes to llvm.call_intrinsic

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D151492

13 months ago[RISCV] Tighten type constraint for RISCVISD::FCLASS_VL.
Craig Topper [Fri, 26 May 2023 18:49:55 +0000 (11:49 -0700)]
[RISCV] Tighten type constraint for RISCVISD::FCLASS_VL.

13 months ago[lldb] Pass CMAKE_SYSROOT through to LLDB shell tests
Daniel Thornburgh [Tue, 23 May 2023 18:48:28 +0000 (11:48 -0700)]
[lldb] Pass CMAKE_SYSROOT through to LLDB shell tests

This allows the LLDB Shell tests to succeed in (e.g. CI) environments where
system libraries are provided hermetically as a sysroot.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D151269

13 months ago[SLP][NFC]Add a test for spill cost, NFC.
Alexey Bataev [Fri, 26 May 2023 17:59:40 +0000 (10:59 -0700)]
[SLP][NFC]Add a test for spill cost, NFC.

13 months ago[mlir][sparse][gpu] fix merge conflict
Aart Bik [Fri, 26 May 2023 17:50:55 +0000 (10:50 -0700)]
[mlir][sparse][gpu] fix merge conflict

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D151574

13 months ago[lldb][NFCI] Include <cstdio> in SBDefines for FILE * definition
Alex Langford [Wed, 24 May 2023 22:01:22 +0000 (15:01 -0700)]
[lldb][NFCI] Include <cstdio> in SBDefines for FILE * definition

There are a few API headers that use FILE * but do not include the
correct header for their definition. Instead of including <cstdio> in each
of the headers manually, it seems easiest to include it in SBDefines to
get them all at once.

rdar://109579348

Differential Revision: https://reviews.llvm.org/D151381

13 months ago[libc++][PSTL] Add a test to make sure that customization points work properly
Nikolas Klauser [Fri, 26 May 2023 14:45:08 +0000 (07:45 -0700)]
[libc++][PSTL] Add a test to make sure that customization points work properly

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D151257

13 months agoSelectionDAG: Teach ComputeKnownBits about VSCALE
Craig Topper [Fri, 26 May 2023 17:48:49 +0000 (10:48 -0700)]
SelectionDAG: Teach ComputeKnownBits about VSCALE

This reverts commit 9b92f70d4758f75903ce93feaba5098130820d40.  The issue
with the re-applied change was an implicit truncation due to the
multiplication.  Although the operations were converted to `APInt`, the
values were implicitly converted to `long` due to the typing rules.

Fixes: #59594

Differential Revision: https://reviews.llvm.org/D140347

13 months ago[clang-tidy] Optimize misc-confusable-identifiers
Piotr Zegar [Fri, 26 May 2023 16:03:39 +0000 (16:03 +0000)]
[clang-tidy] Optimize misc-confusable-identifiers

Main performance issue in this check were caused by many
calls to getPrimaryContext and constant walk up to declaration
contexts using getParent. Also there were issue with forallBases
that is slow.

Profiled with perf and tested on open-source project Cataclysm-DDA.
Before changes check took 27320 seconds, after changes 3682 seconds.
That's 86.5% reduction. More optimizations are still possible in this
check.

Reviewed By: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D151051

13 months ago[libc++][ci] Install ccache in the Docker image
Louis Dionne [Thu, 18 May 2023 21:11:01 +0000 (14:11 -0700)]
[libc++][ci] Install ccache in the Docker image

This will allow using ccache in the jobs that build Clang, which
should speed up those jobs.

Differential Revision: https://reviews.llvm.org/D150907

13 months agoFix wrong error message when compiling C souce code:
Jennifer Yu [Thu, 25 May 2023 16:29:59 +0000 (09:29 -0700)]
Fix wrong error message when compiling C souce code:
Currently emit error for uses_allocators(alloc(traits)):

called object type 'omp_allocator_handle_t' (aka
'enum omp_allocator_handle_t') is not a function or function pointer

To fix this, since "alloc" is Id expresison(spce 5.2), during the parser
(in ParseOpenMP.cpp), using tryParseCXXIdExpression instead of
ParseExpression for C.

Differential Revision: https://reviews.llvm.org/D151517

13 months ago[mlir] [sparse] [gpu] adding transpose support to spmm spmv
Kun Wu [Fri, 26 May 2023 02:29:49 +0000 (02:29 +0000)]
[mlir] [sparse] [gpu] adding transpose support to spmm spmv

Reviewed By: aartbik, wrengr

Differential Revision: https://reviews.llvm.org/D151259

13 months ago[Driver][X86] Reject unsupported value for -mabi=
Fangrui Song [Fri, 26 May 2023 16:52:57 +0000 (09:52 -0700)]
[Driver][X86] Reject unsupported value for -mabi=

-mabi= was incorrectly claimed before D134671. -mabi=sysv appears to be
somewhat common in open-source packages, even if it was not intended to
be supported by Clang.
(For common options supported by multiple architectures, it's easy to
forget to report an error on unsupported targets. Unfortunately
the driver infrastructure doesn't make this less error-prone.)

On x86, support -mabi=sysv for non-Windows targets and -mabi=ms for Windows,
and remove the spurious -Wunused-command-line-argument warning.

With this change, all popular architectures claim -mabi=, so we don't
have to worry much about -Wunused-command-line-argument for other
architectures.

Differential Revision: https://reviews.llvm.org/D151509

13 months agohwasan: enable mmap interception (no tagging used)
Thurston Dang [Thu, 25 May 2023 20:37:11 +0000 (20:37 +0000)]
hwasan: enable mmap interception (no tagging used)

This enables HWASan interception for mmap, to prevent users from allocating in the shadow memory regions. For compatibility, it does not use pointer tagging, nor does it allow MAP_FIXED with a tagged address.

This patch initializes the common interceptors, but that should be a no-op (except for the mmap interceptor), due to the disable-by-default nature of hwasan_platform_interceptors.h (from D150708). As the first patch to utilize this common interceptor machinery for HWASan, it also defines some macros (e.g., COMMON_INTERCEPT_FUNCTION) that will be useful as future interceptors are enabled.

TestCases/Posix/mmap_write_exec.cpp now passes for HWASan.

Reviewed By: kstoimenov, vitalybuka

Differential Revision: D151262

13 months ago[lldb] Remove reproducer test suite (NFC)
Jonas Devlieghere [Fri, 26 May 2023 16:26:29 +0000 (09:26 -0700)]
[lldb] Remove reproducer test suite (NFC)

The reproducer feature as well as the ability to capture or replay tests
with reproducers was removed. This removes the corresponding CMake
target.

13 months ago[flang] Retain the sign of the argument for the result of fraction(0)
V Donaldson [Thu, 25 May 2023 17:05:26 +0000 (10:05 -0700)]
[flang] Retain the sign of the argument for the result of fraction(0)

The f18 clause 16.9.80 description of the FRACTION(X) intrinsic states:

    Result Value. The result has the value ....
    If X has the value zero, the result is zero.
    If X is an IEEE NaN, the result is that NaN.
    If X is an IEEE infinity, the result is an IEEE NaN.

This clause does not specify whether fraction(-0.0) should be -0.0 or +0.0.
However, a folded result and a runtime result should be consistent, and
returning -0.0 is more in line with the result for fraction(NaN).

For this test:

  print '(2f6.1)', 0.0, fraction(0.0)
  call f(0.0)
  print '(2f6.1)', -0.0, fraction(-0.0)
  call f(-0.0)
  end

  subroutine f(x)
    print '(2f6.1)', x, fraction(x)
  end

Current output is:

   0.0   0.0
   0.0   0.0
  -0.0  -0.0
  -0.0   0.0

Change that to:

   0.0   0.0
   0.0   0.0
  -0.0  -0.0
  -0.0  -0.0

13 months ago[VP][SelectionDAG][RISCV] Add get_vector_length intrinsics and generic SelectionDAG...
Craig Topper [Fri, 26 May 2023 16:01:28 +0000 (09:01 -0700)]
[VP][SelectionDAG][RISCV] Add get_vector_length intrinsics and generic SelectionDAG support.

The generic implementation is umin(TC, VF * vscale).

Lowering to vsetvli for RISC-V will come in a future patch.

This patch is a pre-requisite to be able to CodeGen vectorized code from
D99750.

Reviewed By: reames, frasercrmck

Differential Revision: https://reviews.llvm.org/D149916

13 months ago[MLIR][python bindings] Add TypeCaster for returning refined types from python APIs
max [Fri, 26 May 2023 15:23:17 +0000 (10:23 -0500)]
[MLIR][python bindings] Add TypeCaster for returning refined types from python APIs

depends on D150839

This diff uses `MlirTypeID` to register `TypeCaster`s (i.e., `[](PyType pyType) -> DerivedTy { return pyType; }`) for all concrete types (i.e., `PyConcrete<...>`) that are then queried for (by `MlirTypeID`) and called in `struct type_caster<MlirType>::cast`. The result is that anywhere an `MlirType mlirType` is returned from a python binding, that `mlirType` is automatically cast to the correct concrete type. For example:

```
      c0 = arith.ConstantOp(f32, 0.0)
      # CHECK: F32Type(f32)
      print(repr(c0.result.type))

      unranked_tensor_type = UnrankedTensorType.get(f32)
      unranked_tensor = tensor.FromElementsOp(unranked_tensor_type, [c0]).result

      # CHECK: UnrankedTensorType
      print(type(unranked_tensor.type).__name__)
      # CHECK: UnrankedTensorType(tensor<*xf32>)
      print(repr(unranked_tensor.type))
```

This functionality immediately extends to typed attributes (i.e., `attr.type`).

The diff also implements similar functionality for `mlir_type_subclass`es but in a slightly different way - for such types (which have no cpp corresponding `class` or `struct`) the user must provide a type caster in python (similar to how `AttrBuilder` works) or in cpp as a `py::cpp_function`.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D150927

13 months ago[mlir] make `fuse_into_containing_op` preserve the containing op handle
Alex Zinenko [Fri, 26 May 2023 11:26:52 +0000 (11:26 +0000)]
[mlir] make `fuse_into_containing_op` preserve the containing op handle

This partially undoes the intent of https://reviews.llvm.org/D151418 by
cheating its way to keep the "containing op" (aka loop) handle read-only
in fusion. It is crucial to do so for composability of tiling and
fusion. Specfically, after the "containing op" handle started being
consumed, it became impossible to perform additional tiling after fusion
except tiling the last-fused op:

  %tiled1, %loop1 = tile %op
  %producer1, %loop2 = fuse %producer into %loop1
  // invalid, because %tiled1 is invalidated by consuming %loop1
  // that points to its parent
  tile %tiled1

or

  %tiled1, %loop1 = tile %op
  %tiled2, %loop2 = tile %tiled1
  %p2 = fuse %producer into %loop1
  // invalid, because %loop2 is invalidated by consuming %loop1
  // that points to its parent
  fuse %p2 into %loop2

The approach here makes creative use of the state extension mechanism to
update the payload operation associted with the operand handle. Further
investigation is necessary to understand if is consistent with the
overall execution model of the transform dialect, but it is crucial to
restore composability ASAP.

Reviewed By: springerm, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D151555

13 months ago[mlir] teach expensive-checks transform mode about empty handle
Alex Zinenko [Fri, 26 May 2023 13:07:13 +0000 (13:07 +0000)]
[mlir] teach expensive-checks transform mode about empty handle

The transform dialect interpreter features the expensive-checks mode
that acts as an embedded sanitizer to track use-after-consume of
transform handles. Its logic is based on the relations between payload
operations, which made it silently ignore empty handles that are
consumed. Also catch and report this case because the remaining code may
hit an assertion on attempting to access a consumed handle (that is
removed from the mapping).

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D151560

13 months ago[lldb] Improve error message when evaluating expression when not stopped
Jonas Devlieghere [Fri, 26 May 2023 15:48:02 +0000 (08:48 -0700)]
[lldb] Improve error message when evaluating expression when not stopped

When trying to run an expression after a process has existed, you
currently are shown the following error message:

  (lldb) p strlen("")
  error: Can't make a function caller while the process is running

This error is wrong and pretty uninformative. After this patch, the
following error message is shown:

  (lldb) p strlen("")
  error: unable to evaluate expression while the process is exited: the
  process must be stopped because the expression might require
  allocating memory.

rdar://109731325

Differential revision: https://reviews.llvm.org/D151497

13 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 26 May 2023 14:58:48 +0000 (16:58 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)

13 months ago[FastISel] Implement translation of entry_value dbg.value intrinsics
Felipe de Azevedo Piovezan [Wed, 24 May 2023 11:53:26 +0000 (07:53 -0400)]
[FastISel] Implement translation of entry_value dbg.value intrinsics

For dbg.value intrinsics targeting an llvm::Argument address whose expression
starts with an entry value, we lower this to a DEBUG_VALUE targeting the livein
physical register corresponding to that Argument.

Depends on D151332

Differential Revision: https://reviews.llvm.org/D151333

13 months ago[gn build] Port 8d0412ce9d48
LLVM GN Syncbot [Fri, 26 May 2023 15:12:00 +0000 (15:12 +0000)]
[gn build] Port 8d0412ce9d48

13 months ago[RISCV] Revise test coverage for shuffle/insert idiom which become v(f)slide1ups
Philip Reames [Fri, 26 May 2023 14:59:08 +0000 (07:59 -0700)]
[RISCV] Revise test coverage for shuffle/insert idiom which become v(f)slide1ups

This fixes a couple mistakes in 0f64d4f877.  In particular, I'd not included a negative test where the slideup didn't write the entire VL, and had gotten all of my 4 element vector shuffle masks incorrect so they didn't match.  Also, add a test with swapped operands for completeness.

The transform is in D151468.

13 months ago[gn] attempt to port fe2f0ab37c33
Nico Weber [Fri, 26 May 2023 15:05:57 +0000 (11:05 -0400)]
[gn] attempt to port fe2f0ab37c33

13 months ago[InstCombine] Remove instructions in dead blocks during combining
Nikita Popov [Wed, 24 May 2023 14:47:15 +0000 (16:47 +0200)]
[InstCombine] Remove instructions in dead blocks during combining

We already do this during initial worklist population. Doing this
as part of primary combining allows us to remove instructions in
blocks that were rendered dead by condition folding within the
same instcombine iteration.

13 months ago[ValueTracking] Avoid optimizing away condition in test (NFC)
Nikita Popov [Fri, 26 May 2023 14:37:38 +0000 (16:37 +0200)]
[ValueTracking] Avoid optimizing away condition in test (NFC)

This is not what we're interested in testing, and it allows to
essentially optimize away the entire function with more powerful
optimization.

13 months ago[RISCV] Fix typo VLUpperBound to VLEN in SiFive7. NFC.
Michael Maitland [Thu, 25 May 2023 21:53:56 +0000 (14:53 -0700)]
[RISCV] Fix typo VLUpperBound to VLEN in SiFive7. NFC.

The scheduler models said VLUpperBound which was a typo and should have
said VLEN. This is a purley cosmetic fix.

Differential Revision: https://reviews.llvm.org/D151506

13 months ago[libc] Adapt includes after 25174976e19b2ef916bb94f4613662646c95cd46
Krasimir Georgiev [Fri, 26 May 2023 14:25:50 +0000 (14:25 +0000)]
[libc] Adapt includes after 25174976e19b2ef916bb94f4613662646c95cd46

13 months ago[AArch64] merge scaled and unscaled zero narrow stores.
Zain Jaffal [Fri, 19 May 2023 14:24:30 +0000 (15:24 +0100)]
[AArch64] merge scaled and unscaled zero narrow stores.

This patch fixes a crash when a sclaed and unscaled zero stores are merged.

Differential Revision: https://reviews.llvm.org/D150963

13 months ago[InstCombine] Optimize compares with multiple selects as operands
Tejas Joshi [Fri, 26 May 2023 14:02:22 +0000 (16:02 +0200)]
[InstCombine] Optimize compares with multiple selects as operands

In case of a comparison with two select instructions having the same
condition, check whether one of the resulting branches can be simplified.
If so, just compare the other branch and select the appropriate result.
For example:

    %tmp1 = select i1 %cmp, i32 %y, i32 %x
    %tmp2 = select i1 %cmp, i32 %z, i32 %x
    %cmp2 = icmp slt i32 %tmp2, %tmp1

The icmp will result false for the false value of selects and the result
will depend upon the comparison of true values of selects if %cmp is
true. Thus, transform this into:

    %cmp = icmp slt i32 %y, %z
    %sel = select i1 %cond, i1 %cmp, i1 false

Differential Revision: https://reviews.llvm.org/D150360

13 months ago[Clang] Correctly handle generic lambda used as default template argument.
Corentin Jabot [Wed, 24 May 2023 16:11:40 +0000 (18:11 +0200)]
[Clang] Correctly handle generic lambda used as default template argument.

Adjust the template pparameter depth when parsing default
template arguments as they may introduce generic lambda whose parameters
are not substituted at the same depth.

Fixes #62611

Reviewed By: erichkeane, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D151342