platform/upstream/llvm.git
17 months agoAMDGPU: Teach getNegatedExpression about rcp
Matt Arsenault [Mon, 13 Feb 2023 18:57:38 +0000 (14:57 -0400)]
AMDGPU: Teach getNegatedExpression about rcp

17 months agoAMDGPU: Add test for getNegatedExpression with rcp
Matt Arsenault [Mon, 13 Feb 2023 20:12:44 +0000 (16:12 -0400)]
AMDGPU: Add test for getNegatedExpression with rcp

17 months agoAMDGPU: Add additional tests for combiner infinite loop
Matt Arsenault [Fri, 10 Feb 2023 13:44:46 +0000 (09:44 -0400)]
AMDGPU: Add additional tests for combiner infinite loop

17 months agollvm-reduce: Run instruction reduction last
Matt Arsenault [Fri, 10 Feb 2023 14:00:53 +0000 (10:00 -0400)]
llvm-reduce: Run instruction reduction last

With the current state of mir support, this is going to generate
a large number of verifier errors. Running the use and def
reductions first helps to mitigate the impact of this.

17 months ago[DAG] Handle build_vector with all undefs in reduceBuildVecTruncToBitCast
pvanhout [Mon, 13 Feb 2023 09:20:14 +0000 (10:20 +0100)]
[DAG] Handle build_vector with all undefs in reduceBuildVecTruncToBitCast

While working on D143731 I hit a case where a build_vector with 2 undef operands could be generated (with one undef hidden behind a bitcast).
That made `reduceBuildVecTruncToBitCast` crash because it seems to assume there is at least one good operand.

Reviewed By: arsenm

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

17 months ago[LangRef] Global variable declarations imply minimum size
Nikita Popov [Wed, 1 Feb 2023 10:18:47 +0000 (11:18 +0100)]
[LangRef] Global variable declarations imply minimum size

Adjust the wording added in D78952 to say that global variable
declarations (and interposable definitions) do imply a minimum
size (and alignment) on the global. They just don't imply a
maximum size.

We rely on these semantics in at least two places:

* Global dereferenceability: https://github.com/llvm/llvm-project/blob/2153544865a9733b06579823814c981f735e4201/llvm/lib/IR/Value.cpp#L907
* Global inbounds GEP: https://github.com/llvm/llvm-project/blob/2153544865a9733b06579823814c981f735e4201/llvm/lib/IR/ConstantFold.cpp#L2283

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

17 months ago[Coroutines] Don't run optimizations for optnone functions
Chuanqi Xu [Tue, 14 Feb 2023 07:19:20 +0000 (15:19 +0800)]
[Coroutines] Don't run optimizations for optnone functions

Currently we will run two optimization (rematerialization and sink
lifetime markers) unconditionally even if the coroutine is marked as
optnone (O0). This looks not good. This patch disables these 2
optimizations for optnone functions. An internal change shows the change
improve the compilation time for 3% in the debug build.

17 months ago[mlir][llvm] Reintroduce string based attribute setting.
Tobias Gysi [Mon, 13 Feb 2023 21:05:01 +0000 (22:05 +0100)]
[mlir][llvm] Reintroduce string based attribute setting.

Reintroduce string based attribute setting in the
translation from LLVM dialect to LLVM IR. The TypeSwitch
based implementation introduced in
https://reviews.llvm.org/D143654  does not work for
intrinsics that set the requiresAccessGroup or
requiresAliasScope flag.

Reviewed By: hgreving

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

17 months ago[PowerPC] Specify the dynamic loader prefix in ppc-float-abi-warning
Tulio Magno Quites Machado Filho [Tue, 14 Feb 2023 07:03:58 +0000 (15:03 +0800)]
[PowerPC] Specify the dynamic loader prefix in ppc-float-abi-warning

Ensure the tests do not fail during cross compilation by specifying
the dynamic loader prefix for a GNU installation that is expected to
support IEEE 128-bit long double.

Reviewed By: qiucf

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

17 months ago[LoopDeletion] Simplify. NFC
Fangrui Song [Tue, 14 Feb 2023 06:49:09 +0000 (22:49 -0800)]
[LoopDeletion] Simplify. NFC

17 months ago[docs] Add document for clang-scan-deps -format=p1689
Chuanqi Xu [Tue, 14 Feb 2023 05:56:32 +0000 (13:56 +0800)]
[docs] Add document for clang-scan-deps -format=p1689

The patches for `clang-scan-deps` have been landed. And we need to
document the behavior then.

17 months ago[OpenMP] Fix extra parenthesis in kmp_os.h
Vadim Paretsky (Intel Americas Inc) [Tue, 14 Feb 2023 05:39:28 +0000 (21:39 -0800)]
[OpenMP] Fix extra parenthesis in kmp_os.h

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

17 months ago[ARM] Use llvm::rotl and llvm::rotr (NFC)
Kazu Hirata [Tue, 14 Feb 2023 05:28:50 +0000 (21:28 -0800)]
[ARM] Use llvm::rotl and llvm::rotr (NFC)

17 months ago[RISCV] Rename InstFormatCSZN->InstFormatCU to match latest Zcb spec. NFC
Craig Topper [Tue, 14 Feb 2023 05:14:03 +0000 (21:14 -0800)]
[RISCV] Rename InstFormatCSZN->InstFormatCU to match latest Zcb spec. NFC

This was updated in version 1.0.2 of the spec. Latest version
https://github.com/riscv/riscv-code-size-reduction/releases/download/v1.0.3/Zc-v1.0.3.pdf

17 months ago[RISCV] Use llvm::rotl (NFC)
Kazu Hirata [Tue, 14 Feb 2023 04:16:48 +0000 (20:16 -0800)]
[RISCV] Use llvm::rotl (NFC)

17 months agoRecommit: [NFC][IR] Make Module::getAliasList() private
Vasileios Porpodas [Tue, 14 Feb 2023 03:19:36 +0000 (19:19 -0800)]
Recommit: [NFC][IR] Make Module::getAliasList() private

This reverts commit 6d4a674acbc56458bb084878d82d16e393d45a6b.

17 months ago[AArch64] Use llvm::rotl and llvm::rotr (NFC)
Kazu Hirata [Tue, 14 Feb 2023 04:07:09 +0000 (20:07 -0800)]
[AArch64] Use llvm::rotl and llvm::rotr (NFC)

17 months ago[bazel] build fix
Aart Bik [Tue, 14 Feb 2023 03:27:55 +0000 (19:27 -0800)]
[bazel] build fix

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

17 months ago[mlir][affine] Normalize constant valued bound loop
Kai Sasaki [Tue, 14 Feb 2023 02:15:07 +0000 (11:15 +0900)]
[mlir][affine] Normalize constant valued bound loop

This change aims to resolve the issue reported in https://github.com/llvm/llvm-project/issues/59994.

After calling AffineForOp#setUpperBound and setLowerBound, it makes the original affine map structure inconsistent. It's necessary to keep the original map to build the new induction vars.

Reviewed By: bondhugula

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

17 months agoRevert "[NFC][IR] Make Module::getAliasList() private"
Vasileios Porpodas [Tue, 14 Feb 2023 03:12:30 +0000 (19:12 -0800)]
Revert "[NFC][IR] Make Module::getAliasList() private"

This reverts commit b64f7d028bdcaf679130afeed9518c09663f6dc8.

17 months agoRevert "[DAGCombiner] handle more store value forwarding"
Arthur Eubanks [Tue, 14 Feb 2023 03:00:32 +0000 (19:00 -0800)]
Revert "[DAGCombiner] handle more store value forwarding"

This reverts commit f35a09daebd0a90daa536432e62a2476f708150d.

Causes miscompiles, see D138899

17 months agoRevert "[DAGCombiner] fix comments for D138899; NFC"
Arthur Eubanks [Tue, 14 Feb 2023 03:00:15 +0000 (19:00 -0800)]
Revert "[DAGCombiner] fix comments for D138899; NFC"

This reverts commit 63854f91d3ee1056796a5ef27753648396cac6ec.

Dependent commit to be reverted.

17 months ago[NFC][IR] Make Module::getAliasList() private
Vasileios Porpodas [Mon, 6 Feb 2023 21:05:01 +0000 (13:05 -0800)]
[NFC][IR] Make Module::getAliasList() private

This patch adds several missing AliasList modifier functions, like
removeAlias(), eraseAlias() and insertAlias().
There is no longer need to access the list directly so it also makes
getAliaList() private.

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

17 months ago[PowerPC][GISel] add support for fpconstant
Chen Zheng [Mon, 12 Dec 2022 09:53:53 +0000 (09:53 +0000)]
[PowerPC][GISel] add support for fpconstant

Reviewed By: arsenm

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

17 months agoRevert "[mlir] Make the vast majority of integration and runner tests work on Windows"
Aart Bik [Tue, 14 Feb 2023 02:19:36 +0000 (18:19 -0800)]
Revert "[mlir] Make the vast majority of integration and runner tests work on Windows"

This reverts commit 161b9d741a3c25f7bd79620598c5a2acf3f0f377.

REASON:

cmake --build . --target check-mlir-integration

Failed Tests (186):
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-addi-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-cmpi-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-compare-results-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-constants-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-max-min-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-muli-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-shli-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-shrsi-i16.mlir
  MLIR :: Integration/Dialect/Arith/CPU/test-wide-int-emulation-shrui-i16.mlir
  MLIR :: Integration/Dialect/Async/CPU/microbench-linalg-async-parallel-for.mlir
  MLIR :: Integration/Dialect/Async/CPU/microbench-scf-async-parallel-for.mlir
  MLIR :: Integration/Dialect/Async/CPU/test-async-parallel-for-1d.mlir
  MLIR :: Integration/Dialect/Async/CPU/test-async-parallel-for-2d.mlir
  MLIR :: Integration/Dialect/Complex/CPU/correctness.mlir
  MLIR :: Integration/Dialect/LLVMIR/CPU/X86/test-inline-asm-vector.mlir
  MLIR :: Integration/Dialect/LLVMIR/CPU/X86/test-inline-asm.mlir
  MLIR :: Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
  MLIR :: Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/matmul-vs-matvec.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/rank-reducing-subview.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-collapse-tensor.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-conv-1d-call.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-conv-1d-nwc-wcf-call.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-conv-2d-call.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-conv-2d-nhwc-hwcf-call.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-conv-3d-call.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-conv-3d-ndhwc-dhwcf-call.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-elementwise.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-expand-tensor.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-one-shot-bufferize.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-padtensor.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-subtensor-insert-multiple-uses.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-subtensor-insert.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-tensor-e2e.mlir
  MLIR :: Integration/Dialect/Linalg/CPU/test-tensor-matmul.mlir
  MLIR :: Integration/Dialect/Memref/cast-runtime-verification.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/concatenate.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/dense_output.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_cast.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_codegen_foreach.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_complex32.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_complex64.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_complex_ops.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_constant_to_sparse_tensor.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_1d_nwc_wcf.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nhwc_hwcf.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_3d.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_ndhwc_dhwcf.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_dyn.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_ptr.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2sparse.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_dot.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_expand.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_file_io.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_flatten.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_foreach_slices.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_index.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_insert_1d.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_insert_2d.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_insert_3d.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_matrix_ops.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_out_mult_elt.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_out_reduction.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_out_simple.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_pack.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_re_im.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_prod.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reductions.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reductions_prod.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_reshape.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_rewrite_push_back.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sampled_mm_fusion.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_scale.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_scf_nested.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_select.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sign.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sorted_coo.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum_bf16.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum_c32.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_sum_f16.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_tensor_ops.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
  MLIR :: Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir
  MLIR :: Integration/Dialect/SparseTensor/python/test_SDDMM.py
  MLIR :: Integration/Dialect/SparseTensor/python/test_SpMM.py
  MLIR :: Integration/Dialect/SparseTensor/python/test_elementwise_add_sparse_output.py
  MLIR :: Integration/Dialect/SparseTensor/python/test_output.py
  MLIR :: Integration/Dialect/SparseTensor/python/test_stress.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_MTTKRP.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_SDDMM.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_SpMM.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_SpMV.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_Tensor.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_scalar_tensor_algebra.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_simple_tensor_algebra.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_tensor_complex.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_tensor_types.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_tensor_unary_ops.py
  MLIR :: Integration/Dialect/SparseTensor/taco/test_true_dense_tensor_algebra.py
  MLIR :: Integration/Dialect/SparseTensor/taco/unit_test_tensor_core.py
  MLIR :: Integration/Dialect/SparseTensor/taco/unit_test_tensor_io.py
  MLIR :: Integration/Dialect/SparseTensor/taco/unit_test_tensor_utils.py
  MLIR :: Integration/Dialect/Standard/CPU/test-ceil-floor-pos-neg.mlir
  MLIR :: Integration/Dialect/Standard/CPU/test_subview.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-mulf-full.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-mulf.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-muli-ext.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-muli-full.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-muli.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-tilezero-block.mlir
  MLIR :: Integration/Dialect/Vector/CPU/AMX/test-tilezero.mlir
  MLIR :: Integration/Dialect/Vector/CPU/X86Vector/test-dot.mlir
  MLIR :: Integration/Dialect/Vector/CPU/X86Vector/test-inline-asm-vector-avx512.mlir
  MLIR :: Integration/Dialect/Vector/CPU/X86Vector/test-mask-compress.mlir
  MLIR :: Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
  MLIR :: Integration/Dialect/Vector/CPU/X86Vector/test-sparse-dot-product.mlir
  MLIR :: Integration/Dialect/Vector/CPU/X86Vector/test-vp2intersect-i32.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-0-d-vectors.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-broadcast.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-compress.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-constant-mask.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-contraction.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-create-mask-v4i1.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-create-mask.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-expand.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-extract-strided-slice.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-flat-transpose-col.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-flat-transpose-row.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-fma.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-gather.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-index-vectors.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-insert-strided-slice.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-maskedload.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-maskedstore.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-matrix-multiply-col.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-matrix-multiply-row.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-outerproduct-f32.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-outerproduct-i64.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-print-int.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-realloc.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f32-reassoc.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f32.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f64-reassoc.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-f64.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-i32.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-i4.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-i64.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-si4.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-reductions-ui4.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-scan.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-scatter.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-shape-cast.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-shuffle.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-sparse-dot-matvec.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-sparse-saxpy-jagged-matvec.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read-1d.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read-2d.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read-3d.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transfer-read.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transfer-to-loops.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transfer-write.mlir
  MLIR :: Integration/Dialect/Vector/CPU/test-transpose.mlir

Testing Time: 0.29s
  Unsupported:  31
  Passed     :   5
  Failed     : 186

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

17 months ago[flang] Disable libc++ assertions in the runtime library
Shao-Ce SUN [Mon, 13 Feb 2023 09:41:35 +0000 (17:41 +0800)]
[flang] Disable libc++ assertions in the runtime library

Similar to D143168. Solve compiling error caused by D143612.

Error info:
```
flang-new -flang-experimental-exec hello.f90
/usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x25
llvm-project/build/lib/libFortranRuntime.a(unit.cpp.o): in function `std::__1::optional<unsigned long>::operator*[abi:v170000]() &':
unit.cpp:(.text._ZNRSt3__18optionalImEdeB7v170000Ev[_ZNRSt3__18optionalImEdeB7v170000Ev]+0x4f): undefined reference to `std::__1::__libcpp_verbose_abort(char const*, ...)'
/usr/bin/ld: llvm-project/build/lib/libFortranRuntime.a(unit.cpp.o): in function `void std::__1::__optional_storage_base<long, false>::__construct[abi:v170000]<unsigned long>(unsigned long&&)':
unit.cpp:(.text._ZNSt3__123__optional_storage_baseIlLb0EE11__constructB7v170000IJmEEEvDpOT_[_ZNSt3__123__optional_storage_baseIlLb0EE11__constructB7v170000IJmEEEvDpOT_]+0x55): undefined reference to `std::__1::__libcpp_verbose_abort(char const*, ...)'
```

Reviewed By: vzakhari

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

17 months ago[flang] Catch repeated BIND(C) attribute specifications for a symbol
Peter Klausler [Thu, 9 Feb 2023 00:49:10 +0000 (16:49 -0800)]
[flang] Catch repeated BIND(C) attribute specifications for a symbol

A BIND(C) attribute statement or type-declaration-stmt attribute, just
like most attributes, can only appear once.  Name resolution was excluding
the BIND(C) attribute from its check for duplicated attributes, but I
don't see a reason that remains to do so.

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

17 months ago[Clang][RISCV] Guard vector float16 type correctly with semantic analysis
eopXD [Thu, 9 Feb 2023 16:12:02 +0000 (08:12 -0800)]
[Clang][RISCV] Guard vector float16 type correctly with semantic analysis

Before this commit, vector float 16 types (e.g. `vfloat16m1_t`) of RVV
is only defined when extension `zvfh` is defined. However this
generate inaccurate diagnostics like:

```
error: unknown type name 'vfloat16m1_t'
```

This commit improves the compiler by guarding type check correctly
under semantic analysis.

Reviewed By: craig.topper

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

17 months ago[mlir][NFC] Remove unused variable 'indexType' in GPUTransformOps.cpp
Jie Fu [Tue, 14 Feb 2023 01:48:09 +0000 (09:48 +0800)]
[mlir][NFC] Remove unused variable 'indexType' in GPUTransformOps.cpp

/data/jiefu/llvm-project/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp:430:13: error: unused variable 'indexType' [-Werror,-Wunused-variable]
  IndexType indexType = rewriter.getIndexType();
            ^
1 error generated.

17 months ago[mlir][gpu] NFC change to pass threadID ops to rewriteOneForeachThreadToGpuThreads
Thomas Raoux [Tue, 14 Feb 2023 01:14:37 +0000 (01:14 +0000)]
[mlir][gpu] NFC change to pass threadID ops to rewriteOneForeachThreadToGpuThreads

This allows user to give both the thread ids and dimension of the threads we want to distribute on.
This means we can use it to distribute on warps as well.

Reviewed By: harsh

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

17 months ago[flang] Check for invalid BIND(C) names
Peter Klausler [Thu, 9 Feb 2023 00:28:08 +0000 (16:28 -0800)]
[flang] Check for invalid BIND(C) names

Require BIND(C) interoperable names to be valid C identifiers.

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

17 months ago[flang] Check for non-interoperable intrinsic types in BIND(C) derived types
Peter Klausler [Wed, 8 Feb 2023 23:30:07 +0000 (15:30 -0800)]
[flang] Check for non-interoperable intrinsic types in BIND(C) derived types

Every component of a BIND(C) interoperable derived type must have an
interoperable type.  Semantics was checking components with derived types,
but not components with intrinsic types.

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

17 months ago[libc++][NFC] Remove duplicated line from `Cxx20Issues.csv`
Adrian Vogelsgesang [Tue, 14 Feb 2023 00:33:21 +0000 (16:33 -0800)]
[libc++][NFC] Remove duplicated line from `Cxx20Issues.csv`

17 months ago[flang] Pointers returned from functions are not definable as pointers
Peter Klausler [Wed, 8 Feb 2023 21:31:25 +0000 (13:31 -0800)]
[flang] Pointers returned from functions are not definable as pointers

A reference to a pointer-valued function is a "variable" in the argot of
the Fortran standard, and can be the left-hand side of an assignment
statement or passed as a definable actual argument -- but it is not a
definable pointer, and cannot be associated with a pointer dummy argument
that is not INTENT(IN).

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

17 months ago[flang] Respect inaccessibility of type-bound ASSIGNMENT(=)
Peter Klausler [Wed, 8 Feb 2023 18:44:20 +0000 (10:44 -0800)]
[flang] Respect inaccessibility of type-bound ASSIGNMENT(=)

When a derived type has a PRIVATE type-bound generic binding for
a defined ASSIGNMENT(=), don't use it in scopes outside of the
module that defines the type.  We already get this case right
for other type-bound generics, including defined operators,
and for non-type-bound generic interfaces, but the check was
not applied for this case.

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

17 months agoRevert "[lldb] Use portable format string PRIx64"
Pranav Kant [Mon, 13 Feb 2023 23:42:57 +0000 (15:42 -0800)]
Revert "[lldb] Use portable format string PRIx64"

This reverts commit be7d7ca1101840fc8e19e0e48f9dc395da569d23.

This commit was made to fix be7d7ca1101840fc8e19e0e48f9dc395da569d23
which got reverted in 620b3d9ba3343d7bc5bab2340174a20952fcd00f. We need
to revert this commit as well because types in log statements are 32 bit again.

17 months ago[Fuchsia] Add FUCHSIA_ENABLE_LLDB option.
Daniel Thornburgh [Fri, 10 Feb 2023 21:49:40 +0000 (13:49 -0800)]
[Fuchsia] Add FUCHSIA_ENABLE_LLDB option.

This CMake option builds/installs LLDB as part of the Fuchsia toolchain.
Once this is better supported, the effects of this will be inlined into
the toolchain cache file.

Reviewed By: phosek

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

17 months ago[flang] Warn about dangerous TRANSFER()
Peter Klausler [Wed, 8 Feb 2023 01:45:23 +0000 (17:45 -0800)]
[flang] Warn about dangerous TRANSFER()

When the source or mold of a reference to the intrinsic function TRANSFER()
has a derived type with a direct component that contains a descriptor,
such as an allocatable or a pointer, emit a warning.  User programs
should never access descriptors directly.

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

17 months ago[TLS] Added a LangRef entry wrt the module flag MaxTLSAlign.
Wolfgang Pieb [Mon, 13 Feb 2023 23:15:43 +0000 (15:15 -0800)]
[TLS] Added a LangRef entry wrt the module flag MaxTLSAlign.

The module flag was introduced with commit 5d07e0448e38d4be0.

17 months ago[flang] Catch obscure structure constructor error
Peter Klausler [Tue, 7 Feb 2023 23:09:03 +0000 (15:09 -0800)]
[flang] Catch obscure structure constructor error

A scalar value in a structure constructor may correspond to an
array component in the derived type only when that component has
a shape to which the scalar value may be expanded.

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

17 months agoFind SDK path more lazily in Apple Simulator platforms
Jason Molenda [Mon, 13 Feb 2023 23:11:46 +0000 (15:11 -0800)]
Find SDK path more lazily in Apple Simulator platforms

In https://reviews.llvm.org/D122373 I delayed the search for
the SDK filepath until the simulator platform is Created.
In the qProcessInfo binary-addresses key, I have to force-Create
every platform to find one that can handle a kernel fileset;
this forced all of the simulator platforms to create, taking the
SDK filepath discovery perf hit.

This patch delays that path search further until the Apple
Simulator platform calls a method that actually needs the full
filepath; it saves the SDK name ("WatchSimulator.sdk" etc) until
it needs to expand it.

Differential Revision: https://reviews.llvm.org/D143932
rdar://103380717

17 months ago[scudo] Call getStats when the region is exhausted
Chia-hung Duan [Tue, 17 Jan 2023 19:04:52 +0000 (19:04 +0000)]
[scudo] Call getStats when the region is exhausted

Because of lock contention, we temporarily disabled the printing of
regions' status when it's exhausted. Given that it's useful when the
Region OOM happens, this CL brings it back without lock contention.

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

17 months ago[scudo] Calling getStats requires holding lock
Chia-hung Duan [Thu, 19 Jan 2023 17:52:12 +0000 (17:52 +0000)]
[scudo] Calling getStats requires holding lock

We didn't acquire the mutex while accessing those lock protected data,
this CL fixes it and now we don't need to disable the allocator while
reading its states.

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

17 months ago[flang] Conform with standard (mostly) for character length mismatches on arguments
Peter Klausler [Sat, 11 Feb 2023 19:10:58 +0000 (11:10 -0800)]
[flang] Conform with standard (mostly) for character length mismatches on arguments

Fortran 2018 defines some flavors of dummy arguments to require exact
matching of character lengths between dummy and actual arguments;
these situations tend to be those in which the interface must be
explicit and a descriptor is involved: assumed shape, assumed rank,
allocatable, and pointer.

Fortran allows an actual argument in other cases to have a longer
length than the dummy argument; as a common extension, we support a
shorter actual argument as well by means of blank padding, but should
emit a warning.

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

17 months ago[mlir][sparse] Extend readCOOIndices to support overhead types beyond index_type.
bixia1 [Mon, 13 Feb 2023 20:43:03 +0000 (12:43 -0800)]
[mlir][sparse] Extend readCOOIndices to support overhead types beyond index_type.

This is to prepare for implementing the C API for reading a COO tensor to the
given buffers for indices and values.

Reviewed By: wrengr

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

17 months ago[flang] Diagnose REPEAT with negative NCOPIES=
Peter Klausler [Tue, 7 Feb 2023 01:08:06 +0000 (17:08 -0800)]
[flang] Diagnose REPEAT with negative NCOPIES=

Emit an error when the NCOPIES= argument to the intrinsic function
REPEAT has a negative value.  (The current implementation crashes, which
isn't informative.)

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

17 months ago[mlir][sparse] fix a memory leakage when converting from a tensor slice
Peiming Liu [Mon, 13 Feb 2023 17:46:06 +0000 (17:46 +0000)]
[mlir][sparse] fix a memory leakage when converting from a tensor slice

Reviewed By: aartbik

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

17 months ago[libc] Write stub files to a new directory to avoid conflicts
Joseph Huber [Mon, 13 Feb 2023 22:38:59 +0000 (16:38 -0600)]
[libc] Write stub files to a new directory to avoid conflicts

Summary:
This hack with stub files is used to make the final object archive
have human-understandable names. We currently output these into the
current binary directory, which sometimes interferes with the actual
source file. Put these in their own directory to be certain they don't
conflict.

17 months ago[flang][build] Fix build issue reported on recent commit
Peter Klausler [Mon, 13 Feb 2023 22:22:02 +0000 (14:22 -0800)]
[flang][build] Fix build issue reported on recent commit

Some compiler (not specified) reported to issue an error on a
"default:" clause in a switch statement whose cases cover all of
the values of an "enum class".  Since other compilers/versions
are known to complain in the other direction, change the switch
statement to a cascade of ifs.

17 months agoRevert "[LLDB] Enable 64 bit debug/type offset"
Alexander Yermolovich [Mon, 13 Feb 2023 22:08:40 +0000 (14:08 -0800)]
Revert "[LLDB] Enable 64 bit debug/type offset"

This reverts commit f36fe009c0fc1d655bfc6168730bedfa1b36e622.

17 months ago[OpenMP] Add check for target allocator regardless of the availability of libmemkind
Nawrin Sultana [Wed, 25 Jan 2023 22:01:02 +0000 (16:01 -0600)]
[OpenMP] Add check for target allocator regardless of the availability of libmemkind

Current runtime implementation only checks for target allocator when libmemkind is
not available. This patch adds checks for target allocator regardless of the
presence of libmemkind library.

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

17 months ago[mlir][tosa] Enable `apply_scale` unrolling
Jakub Kuderski [Mon, 13 Feb 2023 21:51:37 +0000 (16:51 -0500)]
[mlir][tosa] Enable `apply_scale` unrolling

Make `tosa.apply_scale` implement `VectorUnrollOpInterface` so that we
can unroll it.

Reviewed By: rsuderman

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

17 months ago[Release] Produce bolt tarball
Peter Jung [Mon, 13 Feb 2023 22:00:22 +0000 (14:00 -0800)]
[Release] Produce bolt tarball

Source tarball's are used from some distribution to build the project

Reviewed By: Amir

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

17 months ago[lldb] Use portable format string PRIx64
Benjamin Kramer [Mon, 13 Feb 2023 21:45:21 +0000 (22:45 +0100)]
[lldb] Use portable format string PRIx64

17 months ago[runtimes] Set LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default to ON for OS390
Fanbo Meng [Mon, 13 Feb 2023 15:31:49 +0000 (10:31 -0500)]
[runtimes] Set LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default to ON for OS390

Reviewed By: abhina.sreeskantharajan, zibi

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

17 months agolibclc: remove sqrt/rsqrt from clspv SOURCES
Kévin Petit [Mon, 13 Feb 2023 21:24:13 +0000 (21:24 +0000)]
libclc: remove sqrt/rsqrt from clspv SOURCES

https://reviews.llvm.org/D134040

Patch by: Aaron Greig <aaron.greig@codeplay.com>

17 months ago[VPlan] Use properlyDominates predicate for ordering FOR users.
Florian Hahn [Mon, 13 Feb 2023 21:24:57 +0000 (21:24 +0000)]
[VPlan] Use properlyDominates predicate for ordering FOR users.

The current implementation may return true for A < B and B < A, which
may cause issues if the sort implementation assures this property of the
comperator. This should fix a crash with MSVC.

17 months ago[mlir] Make the vast majority of integration and runner tests work on Windows
Markus Böck [Mon, 13 Feb 2023 16:32:08 +0000 (17:32 +0100)]
[mlir] Make the vast majority of integration and runner tests work on Windows

This patch contains the changes required to make the vast majority of integration and runner tests run on Windows.
Historically speaking, the JIT support for Windows has been lacking behind, but recent versions of ORC JIT have now caught up and works for basically all examples in repo.

Sadly due to these tests previously not working on Windows, basically all of them are making unix-like assumptions about things like filenames, paths, shell syntax etc.
This patch fixes all these issues in one big swoop and enables Windows support for the vast majority of integration tests.

More specifically, following changes had to be done:
* The various JIT runners used paths to the runtime libraries that assumed a Unix toolchain layout and filenames. I abstracted the specific path and filename of these runtime libraries away by making the paths to the runtime libraries be passed from cmake into lit. This now also allows a much more convenient syntax: `--shared-libs=%mlir_c_runner_utils` instead of `--shared-libs=%mlir_lib_dir/lib/libmlir_c_runner_utils%shlibext`
* Some tests using python set environment variables using the `ENV=VALUE cmd` format. This works on Unix, but on Windows it has to prefixed using `env ENV=VALUE cmd`
* Some tests used C functions that are simply not available or exported on Windows (`fabsf`, `aligned_alloc`). These tests have either been adjusted or explicitly marked as `UNSUPPORTED`

Some tests remain disabled on Windows as before:
* In SparseTensor some tests have non-trivial logic for finding the runtime libraries which seems to be required for the use of emulators. I do not have the time to port these so I simply kept them disabled
* Some tests requiring special hardware which I simply cannot test remain disabled on Windows. These include usage of AVX512 or AMX

The tests for `mlir-vulkan-runner` and `mlir-spirv-runner` all work now as well and so do the vast majority of `mlir-cpu-runner`.

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

17 months ago[mlir][SPIRVToLLVM] Add pass option to emit opaque-pointers
Markus Böck [Mon, 13 Feb 2023 11:39:02 +0000 (12:39 +0100)]
[mlir][SPIRVToLLVM] Add pass option to emit opaque-pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the pass option and required changes to the patterns to support the emission of LLVM IR opaque pointers. Given how close SPIRV semantics are to LLVM IR semantics this boils down to just a few changes:
* Making sure that GEP and alloca are built with the explicit base pointer type
* creating opaque pointers instead of typed pointers if requested
* omitting pointer to pointer bitcasts

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

17 months ago[mlir][LLVM] Verify correct pointer casts with `llvm.bitcast`
Markus Böck [Sun, 12 Feb 2023 22:55:47 +0000 (23:55 +0100)]
[mlir][LLVM] Verify correct pointer casts with `llvm.bitcast`

`llvm.bitcast` has so far not had a verifier and this allowed various bugs to sneak into the codebase (including within tests!) which could only be caught once translated to actual LLVM IR. This patch fixes those problematic cases by now verifying bitcasts on pointers are done correctly.

Specifically, it verifies that if pointers are involved, that both result and source types are pointers, that this also applies to vector of pointers and that pointer casts are of the same address space.

The only thing left unverified is the general case of "source type size does not match result type size". I think this case is less trivial and more prone to false positives, so I did not yet implement it.

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

17 months ago[mlir][GPU] add required address space cast when lowering to LLVM
Markus Böck [Sun, 12 Feb 2023 22:52:16 +0000 (23:52 +0100)]
[mlir][GPU] add required address space cast when lowering to LLVM

The runtime functions `memset` and `memcpy` are lowered are declared with pointers to the default address space (0) while their ops however are compatible with memrefs taking any address space.
Such cases do not cause any issues with MLIRs LLVM Dialect due to `bitcast`s verifier being too lenient at the moment, but actual LLVM IR does not allow casting between address spaces using `bitcast`: https://godbolt.org/z/3a1z97rc9

This patch fixes the issue by inserting an address space cast before the bitcast, to first cast the pointer into the correct address space before doing the bitcast.

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

17 months ago[mlir][tosa] Fix segmentation fault in case of folding unranked tensor
Kai Sasaki [Mon, 13 Feb 2023 20:54:42 +0000 (12:54 -0800)]
[mlir][tosa] Fix segmentation fault in case of folding unranked tensor

Trying to fold the unranked tensor for "tosa.equal" crashes due to null reference.
We need to check the dynamic cast result beforehand. This is reported in
https://github.com/llvm/llvm-project/issues/60192.

Reviewed By: rsuderman

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

17 months ago[LLDB] Enable 64 bit debug/type offset
Alexander Yermolovich [Mon, 13 Feb 2023 20:49:32 +0000 (12:49 -0800)]
[LLDB] Enable 64 bit debug/type offset

This came out of from https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902
With big binaries we can have .dwp files where .debug_info.dwo section can grow
beyond 4GB. We would like to support this in LLVM and in LLDB.

The plan is to enable manual parsing of cu/tu index in DWARF library
(https://reviews.llvm.org/D137882), and then
switch internal index data structure to 64 bit.
For the second part is to enable 64bit offset support in LLDB with
this patch.

Depends on D139955

Reviewed By: labath

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

17 months ago[libc][bazel] Update math function unit tests' dependency computation.
Tue Ly [Mon, 13 Feb 2023 20:52:51 +0000 (15:52 -0500)]
[libc][bazel] Update math function unit tests' dependency computation.

17 months ago[flang] Warn on mismatched DATA substring sizes rather than crashing
Peter Klausler [Tue, 7 Feb 2023 00:40:21 +0000 (16:40 -0800)]
[flang] Warn on mismatched DATA substring sizes rather than crashing

When a DATA statement initializes a substring with a character constant
of the wrong length, do the right thing with blank padding or truncation,
and emit a warning.  Current code is crashing due to an unhandled error
reported from the low-level data image initialization framework.

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

17 months ago[lld][WebAssembly] Limit size of shared 64-bit memories of 2^^34
Sam Clegg [Fri, 10 Feb 2023 22:33:52 +0000 (14:33 -0800)]
[lld][WebAssembly] Limit size of shared 64-bit memories of 2^^34

This is current limit in v8.  See
https://github.com/WebAssembly/memory64/issues/33 how we might change
this in the future.

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

17 months ago[libc] Add a loader utility for AMDHSA architectures for testing
Joseph Huber [Mon, 6 Feb 2023 17:01:20 +0000 (11:01 -0600)]
[libc] Add a loader utility for AMDHSA architectures for testing

This is the first attempt to get some testing support for GPUs in LLVM's
libc. We want to be able to compile for and call generic code while on
the device. This is difficult as most GPU applications also require the
support of large runtimes that may contain their own bugs (e.g. CUDA /
HIP / OpenMP / OpenCL / SYCL). The proposed solution is to provide a
"loader" utility that allows us to execute a "main" function on the GPU.

This patch implements a simple loader utility targeting the AMDHSA
runtime called `amdhsa_loader` that takes a GPU program as its first
argument. It will then attempt to load a predetermined `_start` kernel
inside that image and launch execution. The `_start` symbol is provided
by a `start` utility function that will be linked alongside the
application. Thus, this should allow us to run arbitrary code on the
user's GPU with the following steps for testing.

```
clang++ Start.cpp --target=amdgcn-amd-amdhsa -mcpu=<arch> -ffreestanding -nogpulib -nostdinc -nostdlib -c
clang++ Main.cpp --target=amdgcn-amd-amdhsa -mcpu=<arch> -nogpulib -nostdinc -nostdlib -c
clang++ Start.o Main.o --target=amdgcn-amd-amdhsa -o image
amdhsa_loader image <args, ...>
```

We determine the `-mcpu` value using the `amdgpu-arch` utility provided
either by `clang` or `rocm`. If `amdgpu-arch` isn't found or returns an
error we shouldn't run the tests as the machine does not have a valid
HSA compatible GPU. Alternatively we could make this utility in-source
to avoid the external dependency.

This patch provides a single test for this untility that simply checks
to see if we can compile an application containing a simple `main`
function and execute it.

The proposed solution in the future is to create an alternate
implementation of the LibcTest.cpp source that can be compiled and
launched using this utility. This approach should allow us to use the
same test sources as the other applications.

This is primarily a prototype, suggestions for how to better integrate
this with the existing LibC infastructure would be greatly appreciated.
The loader code should also be cleaned up somewhat. An implementation
for NVPTX will need to be written as well.

Reviewed By: sivachandra, JonChesterfield

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

17 months ago[extract_symbols.py] Be more permissive when examining nm output
John Brawn [Mon, 13 Feb 2023 19:33:54 +0000 (19:33 +0000)]
[extract_symbols.py] Be more permissive when examining nm output

The regex which checks for undefined symbols in the nm output was
written assuming GNU nm, but other versions of nm (e.g. llvm-nm) have
slightly different output. Make the regex more permissive to account
for this.

17 months ago[Clang][LLVM] Enable __arithmetic_fence and fprotect-parens on AArch64
Alexander Shaposhnikov [Mon, 13 Feb 2023 18:29:16 +0000 (18:29 +0000)]
[Clang][LLVM] Enable __arithmetic_fence and fprotect-parens on AArch64

Enable __arithmetic_fence and fprotect-parens on AArch64.

Test plan: ninja check-clang check-clang-tools check-llvm

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

17 months agoRevert "[Hexagon] Add release note for LLVM 16"
Krzysztof Parzyszek [Mon, 13 Feb 2023 19:22:11 +0000 (11:22 -0800)]
Revert "[Hexagon] Add release note for LLVM 16"

This reverts commit 140bc411b245260680d90fd981635317b261ef0e.

The release notes update has been backported to releases/16.x, and
can now be reverted in main.

17 months ago[mlir][arith] Allow to specify `constFoldBinaryOp` result type
Jakub Kuderski [Mon, 13 Feb 2023 19:18:12 +0000 (14:18 -0500)]
[mlir][arith] Allow to specify `constFoldBinaryOp` result type

This enables us to use the common fold helpers on elementwise ops that
produce different result type than operand types, e.g., `arith.cmpi` or
`arith.addui_extended`.

Use the updated helper to teach `arith.cmpi` to fold constant vectors.

Reviewed By: Mogball

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

17 months ago[mlir][arith] Fold selection over constant vector conditions
Jakub Kuderski [Mon, 13 Feb 2023 18:38:11 +0000 (13:38 -0500)]
[mlir][arith] Fold selection over constant vector conditions

Also add missing tests for the scalar and splat cases.

Reviewed By: antiagainst, Mogball

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

17 months ago[lldb] Fix image lookup crash
Alex Langford [Fri, 10 Feb 2023 23:51:49 +0000 (15:51 -0800)]
[lldb] Fix image lookup crash

lldb may crash when performing `image lookup --verbose --address $ADDR`.
The ExecutionContext that gets passed into DWARFExpression::Evaluate may
be valid but unpopulated. However, in one specific case, we were
assuming that it has a valid Target and using it without checking first.

We reach this codepath when we attempt to get information about an
address that doesn't map to a CompileUnit in the module containing the
requested address. lldb then checks to see if it maps to a global
variable, so lldb has to evaluate the location of each global variable
in the module. If a location expression contains DW_OP_deref_size that
uses a FileAddress, we hit this code path. The simplest test case is to
take a module that has a global variable with DW_OP_deref_size in its
location expression, attempt to read an address that doesn't map to a
CompileUnit (e.g. 0x0) and ensure we don't crash.

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

17 months ago[clang] Add test for CWG2396
Vlad Serebrennikov [Mon, 13 Feb 2023 07:43:09 +0000 (10:43 +0300)]
[clang] Add test for CWG2396

Also mark [[ https://wg21.link/cwg1291 | CWG1291 ]] as "na".

[[ https://wg21.link/p1787 | P1787 ]]: CWG1291 and CWG2396 are resolved by explicitly specifying how to look up names in a conversion-type-id.
Wording: see changes to [basic.lookup.unqual]/5 and [basic.lookup.qual]/2.

"Calling a conversion function" example in [[ https://wg21.link/p1787 | P1787 ]] is also relevant.

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

17 months ago[RISCV] Make vsetvli intrinsics default to MA.
Craig Topper [Mon, 13 Feb 2023 18:39:55 +0000 (10:39 -0800)]
[RISCV] Make vsetvli intrinsics default to MA.

The vsetvli insertion pass can replace it with MU if needed by
a using instruction. The vsetvli insertion pass will not convert
MU to MA so we need to start at MA.

Reviewed By: eopXD

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

17 months ago[OpenMP] generate the Windows import library that imports by name rather
Vadim Paretsky (Intel Americas Inc) [Mon, 13 Feb 2023 18:29:10 +0000 (10:29 -0800)]
[OpenMP] generate the Windows import library that imports by name rather
than ordinal

This check-in changes the OpenMP build script to generate the Windows
import library that imports by name rather than ordinal to reduce
ordinals order dependency and promote runtime flavors compatibility
going forward. The existing ordinals ordering is preserved to maintain
backward compatibility.

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

17 months ago[mlir] Add Float8E5M2FNUZ and Float8E4M3FNUZ types to MLIR
Jake Hall [Mon, 13 Feb 2023 14:10:20 +0000 (14:10 +0000)]
[mlir] Add Float8E5M2FNUZ and Float8E4M3FNUZ types to MLIR

Float8E5M2FNUZ and Float8E4M3FNUZ have been added to APFloat in D141863.
This change adds these types as MLIR builtin types alongside Float8E5M2
and Float8E4M3FN (added in D133823 and D138075).

Reviewed By: krzysz00

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

17 months ago[flang] Emit portability warning for extension
Peter Klausler [Mon, 6 Feb 2023 01:25:28 +0000 (17:25 -0800)]
[flang] Emit portability warning for extension

f18 accepts statement labels in fixed form source even if they follow
a semicolon -- i.e., they're not in the fixed form's label field.
Emit a warning for such usage.

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

17 months ago[mlir] Avoid building some shared libraries when PIC is off
Han Zhu [Mon, 30 Jan 2023 23:45:47 +0000 (15:45 -0800)]
[mlir] Avoid building some shared libraries when PIC is off

When `LLVM_ENABLE_PIC = OFF`, shared libraries cannot be built against code
that's compiled without -fPIC. Example error message:
``
ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in lib/libLLVMSupport.a(StringMap.cpp.o)
>>> referenced by StringMap.cpp
>>>               StringMap.cpp.o:(llvm::StringMapImpl::StringMapImpl(unsigned
>>>               int, unsigned int)) in archive lib/libLLVMSupport.a
``
Similar to [how libclang handles
this](https://github.com/llvm/llvm-project/blob/main/clang/tools/clang-shlib/CMakeLists.txt#L2-L4),
skip building these shared libraries when `LLVM_ENABLE_PIC = OFF`.

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

17 months agoRevert "Reland "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if...
Michael Buch [Mon, 13 Feb 2023 18:04:44 +0000 (18:04 +0000)]
Revert "Reland "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing""

This reverts commit 19128792e2aa320c1a149f7f93638cbd7f3c83c6.

As pointed out in https://reviews.llvm.org/D143652 this implementation
doesn't quite work for subobject constructors/destructors because DWARF
can map multiple definitions of a ctor/dtor to the same specification DIE.
With the current implementation we would pick the first definition we
find and use that linkage name which means we can sometimes pick the
wrong dtor/ctor and fail to execute a valid expression.

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

17 months agoRevert "[lldb][Test][NFC] TestExternalCtorDtorLookup: add more instantiations to...
Michael Buch [Mon, 13 Feb 2023 18:03:44 +0000 (18:03 +0000)]
Revert "[lldb][Test][NFC] TestExternalCtorDtorLookup: add more instantiations to test linkage name is correct"

This reverts commit 3c160d3051dc5d637bd35cfa673871338589ad8e.

This patch depends on the reverted patch in https://reviews.llvm.org/D143652

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

17 months ago[docs] Speculative link syntax fix
Philip Reames [Mon, 13 Feb 2023 17:42:25 +0000 (09:42 -0800)]
[docs] Speculative link syntax fix

17 months ago[ADT] Add llvm::rotl and llvm::rotr to bit.h
Kazu Hirata [Mon, 13 Feb 2023 17:40:27 +0000 (09:40 -0800)]
[ADT] Add llvm::rotl and llvm::rotr to bit.h

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

17 months ago[libc++][doc] Updates format status page.
Mark de Wever [Mon, 13 Feb 2023 17:32:04 +0000 (18:32 +0100)]
[libc++][doc] Updates format status page.

This adds the papers voted in during the Issaquah plenary.

17 months ago[clang] fix DR status in cxx_status.html
Corentin Jabot [Mon, 13 Feb 2023 17:24:20 +0000 (09:24 -0800)]
[clang] fix DR status in cxx_status.html

17 months ago[Driver] Add --vfsoverlay flag
Alex Brachet [Mon, 13 Feb 2023 17:24:40 +0000 (17:24 +0000)]
[Driver] Add --vfsoverlay flag

This flag implies `-ivfsoverlay`, and additionally passes the same
argument to the linker if it supports it. At present the only linker
which does is lld-link, so this functionality has only been added to
the MSVC toolchain. Additionally this option has been made a
CoreOption so that clang-cl can use it without `-Xclang`

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

17 months ago[flang] Allow for user-defined intrinsic operators (regression)
Peter Klausler [Mon, 6 Feb 2023 23:25:53 +0000 (15:25 -0800)]
[flang] Allow for user-defined intrinsic operators (regression)

The recent code that uses an iterative rather than recursive walk
over the parse tree when processing expressions needs to allow for
the rare case in which an intrinsic operator (e.g., +) is extended
by a generic interface in the program.

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

17 months ago[CSSPGO][Preinliner] Set default value of sample-profile-inline-limit-max to 50000.
Hongtao Yu [Fri, 10 Feb 2023 01:48:53 +0000 (17:48 -0800)]
[CSSPGO][Preinliner] Set default value of sample-profile-inline-limit-max to 50000.

The previous threshold 3000 is too small to enable any inlining for giant functions which come in with bigger size than that. In real world, I've seen a big hot function with 34000 dissasembly size. Motivated by that I'm changing the value to 50000.

With the new value the allowance size growth should still be reasonable, as it is also bounded by another threshold, i.e, --sample-profile-inline-growth-limit , which defaults to 12. The new value should mostly only affect giant functions.

I've seen for serveral internal services, the new threshold boosts performance, and it has neutral impact for other services without hot giant functions. So far I haven't seen any performance regression with that.

Reviewed By: wenlei

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

17 months ago[Clang] Export CanPassInRegisters as a type trait
Roy Jacobson [Mon, 13 Feb 2023 17:14:22 +0000 (19:14 +0200)]
[Clang] Export CanPassInRegisters as a type trait

While working on D140664, I thought it would be nice to be able to write tests
for parameter passing ABI. Currently we test this by dumping the AST and
matching the results which makes it hard to write new tests.
Adding this builtin will allow writing better ABI tests which
can help improve our coverage in this area.

While less useful, maybe some users would also find it useful for asserting
against pessimisations for their classes.

Reviewed By: erichkeane

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

17 months ago[RISCV][docs] Describe status of zicsr and zifencei
Philip Reames [Mon, 13 Feb 2023 17:07:28 +0000 (09:07 -0800)]
[RISCV][docs] Describe status of zicsr and zifencei

This has been a repeated point of recent confusion. There are a couple attempts in flight to change the way we handle the extensions, but for the moment, let's just document what's going on.

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

17 months ago[Tooling/Inclusion] Add symbol mappings for `std::experimental::filesystem`
Younan Zhang [Mon, 13 Feb 2023 11:17:26 +0000 (19:17 +0800)]
[Tooling/Inclusion] Add symbol mappings for `std::experimental::filesystem`

Clangd maintains a symbol map from standard library, in order to prevent
unexpected header/symbol leaks from internal files. (e.g. files under
`bits/` for libstdc++) This symbol map was generated by a python script
that parses pages of offline cppreference archive. The script didn't
handle the case for `std::experimental::`, where most symbols are from
TS. It works well as symbols are directly laid out in the corresponding
header under `experimental` directory for most of time.

However, libstdc++'s implementation split symbols of TS FS into a few
header files located in `experimental/bits`. This would make the code
completion provide internal headers when we simply select the symbols.

There are slightly differences between TS FS and C++17 FS. Some
functions like `system_complete` was replaced by `absolute` and
relative-related operations were introduced later by another proposal.
Even so, all mainstream implementation are based on N4100, the final
filesystem TS draft that was published in 2014 and from which symbols
we've added are exported.

This fixes https://github.com/clangd/clangd/issues/1481

Reviewed By: kadircet

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

17 months agoReland "[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during...
Michael Buch [Fri, 10 Feb 2023 15:38:10 +0000 (15:38 +0000)]
Reland "[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during expression evaluation"

This relands a patch previously reverted
in `181d6e24ca3c09bfd6ec7c3b20affde3e5ea9b40`.
This wasn't quite working on Linux because we
weren't populating the manual DWARF index with
`DW_TAG_imported_declaration`. The relanded patch
does this.

**Summary**

This patch makes the expression evaluator understand
namespace aliases.

This will become important once `std::ranges` become
more widespread since `std::views` is defined as:

```
namespace std {
namespace ranges::views {}

namespace views = ranges::views;
}
```

**Testing**

* Added API test

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

17 months ago[RISCV] Fix -Wbraced-scalar-init warning. NFC
Philipp Tomsich [Mon, 13 Feb 2023 16:56:20 +0000 (17:56 +0100)]
[RISCV] Fix -Wbraced-scalar-init warning. NFC

Fix the following warning:
/lib/Target/RISCV/RISCVISelLowering.cpp:315:24: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init]
    setOperationAction({ISD::CTLZ}, XLenVT, Legal);
                       ^~~~~~~~~~~

17 months ago[ORC] StaticLibraryDefinitionGenerator -- support in-memory universal binaries.
Lang Hames [Mon, 13 Feb 2023 16:28:07 +0000 (08:28 -0800)]
[ORC] StaticLibraryDefinitionGenerator -- support in-memory universal binaries.

Add new StaticLibraryDefinitionGenerator::Create methods to support construction
from in-memory universal binaries.

17 months ago[libc++] Reorganize exception_guard
Louis Dionne [Fri, 3 Feb 2023 22:27:39 +0000 (17:27 -0500)]
[libc++] Reorganize exception_guard

We try to keep as little code as possible within #ifdef.

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

17 months ago[AMDGPU] Allow architected SGPRs for workgroup IDs
Christudasan Devadasan [Fri, 10 Feb 2023 07:54:07 +0000 (13:24 +0530)]
[AMDGPU] Allow architected SGPRs for workgroup IDs

Some subtargets use architected SGPRs for workgroup
IDs instead of the regular SGPRs. This patch enables
the support for the same and is guarded under the
subtarget feature FeatureArchitectedSGPRs.

Reviewed By: foad

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

17 months ago[AMDGPU] Add switch to enable architected SGPRs.
Christudasan Devadasan [Fri, 10 Feb 2023 06:22:00 +0000 (11:52 +0530)]
[AMDGPU] Add switch to enable architected SGPRs.

Reviewed By: rampitec, foad

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

17 months ago[extract_symbols.py] Adjust usage of nm again
John Brawn [Mon, 13 Feb 2023 15:59:20 +0000 (15:59 +0000)]
[extract_symbols.py] Adjust usage of nm again

The previous change to extract_symbols.py means that building on macOS
with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS fails as we try to export some
local symbols, as the regex used to match external symbols wasn't good
enough. Solve this by using the -g option to nm, so we only get
external symbols and don't have to check for local symbols at all.

17 months ago[AArch64] Add NZCV Def for TLSDESC_CALLSEQ
Mirko Müller [Mon, 13 Feb 2023 16:14:23 +0000 (16:14 +0000)]
[AArch64] Add NZCV Def for TLSDESC_CALLSEQ

The glibc and older musl handlers of tlsdesc_dynamic use a cmp instruction
which will clobber NZCV.

See glibc's _dl_tlsdesc_dynamic:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/aarch64/dl-tlsdesc.S;hb=refs/heads/release/2.37/master

See v1.1.21 Musl's __tlsdesc_dynamic:
https://git.musl-libc.org/cgit/musl/tree/src/ldso/aarch64/tlsdesc.s?h=v1.1.21

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

17 months ago[DAGCombine] Allow DAGCombine to remove dead masked stores.
Dinar Temirbulatov [Mon, 13 Feb 2023 16:07:06 +0000 (16:07 +0000)]
[DAGCombine] Allow DAGCombine to remove dead masked stores.

Remove a dead masked store if another one has the same base pointer and mask or
the following store has all true constant mask and size if equal or bigger to
the first store.

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