platform/upstream/llvm.git
23 months ago[SROA] `isVectorPromotionViable()`: pointer-ness is sticky
Roman Lebedev [Tue, 22 Nov 2022 16:54:39 +0000 (19:54 +0300)]
[SROA] `isVectorPromotionViable()`: pointer-ness is sticky

As it has been established previously by precedent,
if we see a pointer type, then that is the type we must use.
Essentially, we don't want to introduce `inttoptr`'s.

23 months ago[AMDGPU] More cleanup after D117544. NFC.
Jay Foad [Tue, 22 Nov 2022 18:40:22 +0000 (18:40 +0000)]
[AMDGPU] More cleanup after D117544. NFC.

23 months ago[ELF] -r: don't define _TLS_MODULE_BASE_
Fangrui Song [Tue, 22 Nov 2022 20:59:45 +0000 (12:59 -0800)]
[ELF] -r: don't define _TLS_MODULE_BASE_

_TLS_MODULE_BASE_ is supposed to be defined by the final link. Defining it in a
relocatable link may render the final link value incorrect.

GNU ld i386/x86-64 have the same issue: https://sourceware.org/bugzilla/show_bug.cgi?id=29820

23 months ago[Sema] check InitListExpr format strings like {"foo"}
Yingchi Long [Fri, 11 Nov 2022 14:45:08 +0000 (22:45 +0800)]
[Sema] check InitListExpr format strings like {"foo"}

Adds InitListExpr case in format string checks.

e.g.

    int sprintf(char *__restrict, const char * __restrict, ...);

    int foo()
    {
        char data[100];
        constexpr const char* fmt2{"%d"};  // no-warning
        sprintf(data, fmt2, 123);
    }

Fixes: https://github.com/llvm/llvm-project/issues/58900

Reviewed By: aaron.ballman

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

23 months ago[ELF] -r: don't define __global_pointer$
Fangrui Song [Tue, 22 Nov 2022 20:37:51 +0000 (12:37 -0800)]
[ELF] -r: don't define __global_pointer$

This symbol is supposed to be defined by the final executable link. The new
behavor matches GNU ld.

23 months ago[X86] Don't lower f16->f80 fpext to libcall on darwin.
Davide Italiano [Tue, 22 Nov 2022 20:29:44 +0000 (12:29 -0800)]
[X86] Don't lower f16->f80 fpext to libcall on darwin.

We don't provide __extendhfxf2, and only have the soft-float
__extendhfsf2 in compiler-rt.  This only changed recently with
655ba9c8a1d2, so this patch reverts back to the previous behavior.

However, the f80->f16 fptrunc is not easily implementable without
the compiler-rt __truncxfhf2, but that has always been true, and
isn't an immediate regression.

Patch by Ahmed Bougacha.

rdar://102194995

23 months ago[llvm-mca] Fix class dominance warnings for parseCodeRegions
Michael Maitland [Tue, 22 Nov 2022 00:02:47 +0000 (16:02 -0800)]
[llvm-mca] Fix class dominance warnings for parseCodeRegions

Fixes issue [59091](https://github.com/llvm/llvm-project/issues/59091).

`CodeRegionGenerator::parseCodeRegions` is implemented by `AsmCodeRegionGenerator`.
If it were to be implemented in `AnalysisRegionGenerator` or `InstrumentRegionGenerator`,
then `parseCodeRegions` from an `AsmAnalysisRegionGenerator` or `AsmInstrumentRegionGenerator`
object would be ambiguous. To solve this, `AsmAnalysisRegionGenerator` and
`AsmInstrumentRegionGenerator` qualify their call to `AsmCodeRegionGenerator::parseCodeRegions`.

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

23 months ago[libcxxabi] Always use thread_local for cxa_exception_storage
Shoaib Meenai [Mon, 21 Nov 2022 23:59:42 +0000 (15:59 -0800)]
[libcxxabi] Always use thread_local for cxa_exception_storage

This was previously guarded by HAS_THREAD_LOCAL, which was never set by
CMake and had to be specified manually. Android has been setting this to
solve https://github.com/android/ndk/issues/1200 [1], but every compiler
and platform libc++abi supports should have thread_local by now, so we
can just get rid of the fallback implementation and simplify things
significantly (including removing the now unused fallback calloc).

[1] https://android-review.googlesource.com/c/toolchain/llvm-project/+/1285596

Reviewed By: #libc_abi, MaskRay, ldionne

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

23 months ago[Hexagon] Add missing patterns for select
Ikhlas Ajbar [Tue, 22 Nov 2022 20:19:36 +0000 (12:19 -0800)]
[Hexagon] Add missing patterns for select

Fixes https://github.com/llvm/llvm-project/issues/59077.

23 months ago[VectorCombine] Don't touch instruction after foldSingleElementStore, it might be...
Benjamin Kramer [Tue, 22 Nov 2022 20:12:42 +0000 (21:12 +0100)]
[VectorCombine] Don't touch instruction after foldSingleElementStore, it might be deleted

Use after free found by asan.

23 months agoMake -fsanitize=scudo use scudo_standalone. Delete check-scudo.
Mitch Phillips [Tue, 22 Nov 2022 18:27:46 +0000 (10:27 -0800)]
Make -fsanitize=scudo use scudo_standalone. Delete check-scudo.

Leaves the implementation and tests files in-place for right now, but
deletes the ability to build the old sanitizer-common based scudo. This
has been on life-support for a long time, and the newer scudo_standalone
is much better supported and maintained.

Also patches up some GWP-ASan wording, primarily related to the fact
that -fsanitize=scudo now is scudo_standalone, and therefore the way to
reference the GWP-ASan options through the environment variable has
changed.

Future follow-up patches will delete the original scudo, and migrate all
its tests over to be part of the scudo_standalone test suite.

Reviewed By: vitalybuka

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

23 months agoRevert "[CGObjC] Add run line for release mode in test arc-exceptions-seh.mm (NFC)"
Stefan Gränitz [Tue, 22 Nov 2022 19:51:09 +0000 (20:51 +0100)]
Revert "[CGObjC] Add run line for release mode in test arc-exceptions-seh.mm (NFC)"

This reverts commit 01023bfcd33f922ed8c934ce563e54abe8bfe246. The extended test now triggers undefined behavior:
```
/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:577:41: runtime error: load of value 180, which is not a valid value for type 'bool'
    #0 0xaaaae3333a30 in hasCFGChanged /b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:577:41
    #1 0xaaaae3333a30 in llvm::ObjCARCOptPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:2494:26
    ...
```

23 months ago[ELF] addRelIpltSymbols: make it explicit some passes are for non-relocatable links...
Fangrui Song [Tue, 22 Nov 2022 19:38:57 +0000 (11:38 -0800)]
[ELF] addRelIpltSymbols: make it explicit some passes are for non-relocatable links. NFC

and prepare for __global_pointer$ and _TLS_MODULE_BASE_ fix.

23 months ago[CHR] Add a threshold for the code duplication
Rong Xu [Tue, 22 Nov 2022 19:22:38 +0000 (11:22 -0800)]
[CHR] Add a threshold for the code duplication

ControlHeightReduction (CHR) clones the code region to reduce the
branches in the hot code path. The number of clones is linear to the
depth of the region.

Currently it does not have control over the code size increase. We are
seeing one ~9000 BB functions get expanded to ~250000 BBs, an 25x
increase. This creates a big compile time issue for the downstream
optimizations.

This patch adds a cap for number of clones for one region.

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

23 months ago[libc++][math.h][NFC] Refactor enable_ifs
Nikolas Klauser [Fri, 4 Nov 2022 19:08:56 +0000 (20:08 +0100)]
[libc++][math.h][NFC] Refactor enable_ifs

Reviewed By: ldionne, Mordante, #libc

Spies: EricWF, libcxx-commits

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

23 months ago[libc++][math.h] Remove some code duplication
Nikolas Klauser [Fri, 4 Nov 2022 16:01:22 +0000 (17:01 +0100)]
[libc++][math.h] Remove some code duplication

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

23 months ago[libc++][math.h] Remove __libcpp_<func> functions and instead call builtins directly
Nikolas Klauser [Fri, 4 Nov 2022 15:56:51 +0000 (16:56 +0100)]
[libc++][math.h] Remove __libcpp_<func> functions and instead call builtins directly

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

23 months ago[libc++] Assume that builtins for math.h functions are available
Nikolas Klauser [Fri, 4 Nov 2022 15:45:35 +0000 (16:45 +0100)]
[libc++] Assume that builtins for math.h functions are available

All supported compilers support the builtins, so this removes dead code and simplifies a lot of the functions through that.

Reviewed By: ldionne, #libc, EricWF

Spies: EricWF, michaelplatings, libcxx-commits

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

23 months ago[libc++] Remove duplication in math_h.pass.cpp and improve coverage
Nikolas Klauser [Fri, 28 Oct 2022 01:11:44 +0000 (03:11 +0200)]
[libc++] Remove duplication in math_h.pass.cpp and improve coverage

Reviewed By: ldionne, huixie90, #libc

Spies: mstorsjo, EricWF, libcxx-commits

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

23 months ago[Hexagon] Use V6_vmpyuhvs for 16-bit mulhu on HVX v69+
Krzysztof Parzyszek [Fri, 18 Nov 2022 22:31:04 +0000 (14:31 -0800)]
[Hexagon] Use V6_vmpyuhvs for 16-bit mulhu on HVX v69+

23 months agoReland "[LTO][COFF] Use bitcode file names in lto native object file names."
Zequan Wu [Tue, 22 Nov 2022 19:00:56 +0000 (11:00 -0800)]
Reland "[LTO][COFF] Use bitcode file names in lto native object file names."

This reverts commit eef5405f74ae208e3e2eb7daacecac923d7338f2.

23 months agoRevert "[clang-doc] Move file layout to the generators."
Paul Kirth [Tue, 22 Nov 2022 19:12:58 +0000 (19:12 +0000)]
Revert "[clang-doc] Move file layout to the generators."

This reverts commit f8a469fc572778d05b72f34a772082cf3abd3cda.

The test in single-file-public.cpp breaks on Mac, due to an unknown
regextype in the find command.

23 months ago[mlir] Add tablegen types for fp8 types
Benjamin Kramer [Tue, 22 Nov 2022 19:05:12 +0000 (20:05 +0100)]
[mlir] Add tablegen types for fp8 types

For consistency and allowing users easy access to these types.

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

23 months agoRevert "[AArch64] Add GPR rr instructions to isAssociativeAndCommutative"
Vitaly Buka [Tue, 22 Nov 2022 18:50:40 +0000 (10:50 -0800)]
Revert "[AArch64] Add GPR rr instructions to isAssociativeAndCommutative"

Breaks msan on aarch64.

This reverts commit 5f7f484ee54ebbf702ee4c5fe9852502dc237121.

23 months agoRevert "[LTO][COFF] Use bitcode file names in lto native object file names."
Zequan Wu [Tue, 22 Nov 2022 18:54:46 +0000 (10:54 -0800)]
Revert "[LTO][COFF] Use bitcode file names in lto native object file names."

This reverts commit 531ed6d5aa65f41c6dfe2e74905d5c6c88fc95a7.

23 months ago[Driver][Test] Fix pic.c when CLANG_DEFAULT_PIE_ON_LINUX set to OFF
Mariya Podchishchaeva [Tue, 22 Nov 2022 16:44:54 +0000 (11:44 -0500)]
[Driver][Test] Fix pic.c when CLANG_DEFAULT_PIE_ON_LINUX set to OFF

23 months ago[clang-doc] Move file layout to the generators.
Brett Wilson [Tue, 15 Nov 2022 20:51:45 +0000 (12:51 -0800)]
[clang-doc] Move file layout to the generators.

Previously file naming and directory layout was handled on a per Info
object basis by ClangDocMain and the generators blindly wrote to the
files given. This means all generators must use the same file layout and
caused problems where multiple objects mapped to the same file. The
object collision problem happens most easily with template
specializations because the template parameters are not part of the
"name".

This patch moves the responsibility for output file organization to the
generators. Currently HTML and MD use the same structure as before. But
they now collect all objects that map to a given file and combine them,
avoiding the corruption problems.

Converts the YAML generator to naming files based on USR in one
directory. This is easier for downstream tools to manage and avoids
the naming problems with template specializations. Since this change
requires backward-incompatible output changes to referenced files anyway
(since each one is now an array), this is a good time to introduce this
change.

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

23 months ago[LLDB][Minidump] Merge executable module's architecture into target's architecture.
Zequan Wu [Thu, 17 Nov 2022 21:31:40 +0000 (13:31 -0800)]
[LLDB][Minidump] Merge executable module's architecture into target's architecture.

This allows minidump process ABI to match the PE/COFF file ABI.

Reviewed By: labath

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

23 months ago[Clang][Driver] Add KCFI to SupportsCoverage
Sami Tolvanen [Tue, 22 Nov 2022 18:09:22 +0000 (18:09 +0000)]
[Clang][Driver] Add KCFI to SupportsCoverage

Allow `-fsanitize=kcfi` to be enabled with `-fsanitize-coverage=` modes
such as `trace-{pc,cmp}`.

Link: https://github.com/ClangBuiltLinux/linux/issues/1743
Reviewed By: MaskRay

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

23 months ago[LTO][COFF] Use bitcode file names in lto native object file names.
Zequan Wu [Wed, 2 Nov 2022 00:06:01 +0000 (17:06 -0700)]
[LTO][COFF] Use bitcode file names in lto native object file names.

Currently the lto native object files have names like main.exe.lto.1.obj. In
PDB, those names are used as names for each compiland. Microsoft’s tool
SizeBench uses those names to present to users the size of each object files.
So, names like main.exe.lto.1.obj is not user friendly.

This patch makes the lto native object file names more readable by using
the bitcode file names as part of the file names. For example, if the input
bitcode file has path like "path/to/foo.obj", its corresponding lto native
object file path would be "path/to/main.exe.lto.foo.obj". Since the lto native
object file name only bothers PDB, this patch only changes the lld-linker's
behavior.

Reviewed By: tejohnson, MaskRay, #lld-macho

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

23 months ago[DAG] isGuaranteedNotToBeUndefOrPoison - handle FrameIndex/TargetFrameIndex
Simon Pilgrim [Tue, 22 Nov 2022 18:16:09 +0000 (18:16 +0000)]
[DAG] isGuaranteedNotToBeUndefOrPoison - handle FrameIndex/TargetFrameIndex

Fixes #58904

23 months ago[Utils] Improved chunk-print-before-all.py script
dbakunevich [Mon, 14 Nov 2022 09:26:55 +0000 (16:26 +0700)]
[Utils] Improved chunk-print-before-all.py script

As part of this patch, the ability to work with dump files
containing ir after passes received using the -print-after-all
option was added to script chunk-print-before-all.py.
The names of the output files have also been changed.
Before: chunk-NUM.ll
Now: NUM-STAGE-PASS_NAME.ll
NUM - sequence number of the pass operation.
STAGE - stage of the pass operation (for example: before, after, dump).
PASS_NAME - the name of the pass.

23 months ago[AMDGPU] Avoid SCC clobbering before S_CSELECT_B32
Alexander Timofeev [Tue, 18 Oct 2022 13:34:49 +0000 (15:34 +0200)]
[AMDGPU] Avoid SCC clobbering before S_CSELECT_B32

Frame lowering inserts scalar addition to compute the offset to the
stack objects.  This instructions inserted in arbitrary place and may clobber
SCC between its definition and S_CSELECT_B32 instruction.  This change
workarounds this particular code pattern. It queries the scavenger for SGPR and
if available saves SCC to it and restore its value after frame lowering code
insertion.

Reviewed By: foad

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

23 months ago[AArch64][SME]: Generate streaming-compatible code for fp_arith and fp-fma
Hassnaa Hamdi [Fri, 18 Nov 2022 13:26:53 +0000 (13:26 +0000)]
[AArch64][SME]: Generate streaming-compatible code for fp_arith and fp-fma

1-To generate code compatible to streaming mode:
 - enable custom lowering for FADD, FDIV, FMA, FNEG, FSQRT, FSUB, and FABS.

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

23 months ago[AArch64][SME]: Add precursory tests for D138290
Hassnaa Hamdi [Fri, 18 Nov 2022 13:20:40 +0000 (13:20 +0000)]
[AArch64][SME]: Add precursory tests for D138290

Add testing files:
 - fp-arith.ll
 - fp-fma.ll

23 months ago[ADT] Define None as std::nullopt (NFC)
Kazu Hirata [Tue, 22 Nov 2022 17:57:22 +0000 (09:57 -0800)]
[ADT] Define None as std::nullopt (NFC)

This patch defines NoneType and None as std::nullopt_t and
std::nullopt, respectively.

This patch effectively makes None and std::nullopt interchangeable, so
we can gradually replace None with std::nullopt all while we continue
to use llvm::Optional.

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

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

23 months ago[X86] Cleanup WriteBlend classes to match (V)PLENDW instruction
Simon Pilgrim [Tue, 22 Nov 2022 17:56:07 +0000 (17:56 +0000)]
[X86] Cleanup WriteBlend classes to match (V)PLENDW instruction

Minor cleanup toward fixing the unnecessary scheduler overrides warnings from D138359

23 months ago[Hexagon] Make local array static in getIntrinsicForHexagonNonClangBuiltin
Krzysztof Parzyszek [Tue, 22 Nov 2022 17:11:17 +0000 (09:11 -0800)]
[Hexagon] Make local array static in getIntrinsicForHexagonNonClangBuiltin

It should not be created on every call, the omission of `static` was a bug
in the patch that introduced it.

23 months ago[Sanitizer][NFC] Rearranged prototype definitions in lsan_common.h to group them...
Kirill Stoimenov [Fri, 18 Nov 2022 23:46:54 +0000 (23:46 +0000)]
[Sanitizer][NFC] Rearranged prototype definitions in lsan_common.h to group them by implementation file.

Reviewed By: vitalybuka

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

23 months ago[AArch64] Correctly recognize -reserve-regs-for-regalloc=X30,X29
Guozhi Wei [Tue, 22 Nov 2022 17:18:29 +0000 (17:18 +0000)]
[AArch64] Correctly recognize -reserve-regs-for-regalloc=X30,X29

In AArch64 backend X30 is named as LR, X29 is named as FP. So the code in AArch64Subtarget::AArch64Subtarget can't recognize these 2 registers.

  for (unsigned i = 0; i < 31; ++i) {
    if (ReservedRegNames.count(TRI->getName(AArch64::X0 + i)))
      ReserveXRegisterForRA.set(i);
  }

This patch add code to explicitly handle these 2 registers.

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

23 months ago[AMDGPU] Remove RegStrictDom variable. NFC.
Jay Foad [Tue, 22 Nov 2022 17:06:53 +0000 (17:06 +0000)]
[AMDGPU] Remove RegStrictDom variable. NFC.

D117544 removed the only substantive use of RegStrictDom. Now we can
simplify by using StrictDom for everything.

23 months ago[AMDGPU] Define and use new allZeroWaitcnt helper. NFC.
Jay Foad [Tue, 22 Nov 2022 16:59:53 +0000 (16:59 +0000)]
[AMDGPU] Define and use new allZeroWaitcnt helper. NFC.

23 months ago[AArch64] Add zext test with scalable vectors.
Florian Hahn [Tue, 22 Nov 2022 16:55:08 +0000 (16:55 +0000)]
[AArch64] Add zext test with scalable vectors.

23 months ago[libc++][format] Fixes visit_format_arg.
Mark de Wever [Tue, 15 Nov 2022 18:53:30 +0000 (19:53 +0100)]
[libc++][format] Fixes visit_format_arg.

The Standard specifies which types are stored in the basic_format_arg
"variant" and which types are stored as a handle. Libc++ stores
additional types in the "variant". During a reflector discussion
@jwakely mention this is user observable; visit_format_arg uses the type
instead of a handle as argument.

This optimization is useful and will probably be used for other small
types in the future. To be conferment the visitor creates a handle and
uses that as argument. There is a second visitor so the formatter can
still directly access the 128-bit integrals.

The test for the visitor and get has been made public too, there is no
reason not too. The 128-bit integral types are required by the Standard,
when they are available.

Reviewed By: ldionne, #libc

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

23 months ago[mlir][tensor] Add dim(expand_shape/collapse_shape) folding
Matthias Springer [Tue, 22 Nov 2022 16:26:19 +0000 (17:26 +0100)]
[mlir][tensor] Add dim(expand_shape/collapse_shape) folding

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

23 months ago[clang][Parse] Remove constant expression from if condition
Timm Bäder [Fri, 18 Nov 2022 13:13:18 +0000 (14:13 +0100)]
[clang][Parse] Remove constant expression from if condition

MaybeTypeCast here is not a variable, it's an enum member with value 1.

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

23 months ago[mlir][sparse] Fix a bug in concatenate operator rewriting.
bixia1 [Mon, 21 Nov 2022 05:57:30 +0000 (21:57 -0800)]
[mlir][sparse] Fix a bug in concatenate operator rewriting.

When calculating the dynamic dimensions for the concatenate result, we
shouldn't accumulate the sizes for the non-concatenating dimensions.

Reviewed By: aartbik, Peiming

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

23 months agoclang/HIP: Add new header test for math IR gen
Matt Arsenault [Sun, 20 Nov 2022 17:08:34 +0000 (09:08 -0800)]
clang/HIP: Add new header test for math IR gen

The current header testing is pretty thin. This is in
preparation for a series of patches to replace many
builtin implementations.

I did try to stress everything in this header, but skipped
a few things. Mostly I didn't understand why we have
various language version checks which skip defining some
things. It doesn't seem right to have any of these if guards
on __cplusplus,  __HIPCC_RTC__, and __OPENMP_AMDGCN__.

23 months agoLoopDeletion: Fix missing newlines in debug printing
Matt Arsenault [Mon, 21 Nov 2022 03:07:01 +0000 (19:07 -0800)]
LoopDeletion: Fix missing newlines in debug printing

23 months ago[clang][dataflow] Add widening API and implement it for built-in boolean model.
Yitzhak Mandelbaum [Thu, 3 Nov 2022 00:36:58 +0000 (00:36 +0000)]
[clang][dataflow] Add widening API and implement it for built-in boolean model.

* Adds API support for widening of lattice elements and environments,
* Updates the algorithm to apply widening where appropriate,
* Implements widening for boolean values. In the process, moves the unsoundness
  of comparison from the default implementation of
  `Environment::ValueModel::compare` to model-specific handling inside
  `DataflowEnvironment::equivalentTo`. This change is intended to clarify
  the source and location of unsoundess.

This patch is a replacement for, and was based substantially on, https://reviews.llvm.org/D131645.

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

23 months ago[mlir][bufferize][NFC] Minor code and comment cleanups
Matthias Springer [Tue, 22 Nov 2022 16:03:32 +0000 (17:03 +0100)]
[mlir][bufferize][NFC] Minor code and comment cleanups

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

23 months ago[Flang] Removing Float Bessel functions for AIX
Kelvin Li [Tue, 22 Nov 2022 15:09:47 +0000 (10:09 -0500)]
[Flang] Removing Float Bessel functions for AIX

AIX libc only provides bessel functions j0,j1,jn and y0,y1,yn but
does not have their float equivalents j0f,j1f,jnf and y0f,y1f,ynf.

Committed on behalf of madanial

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

23 months ago[libcxx] Add BOT_OWNERS.txt
David Spickett [Mon, 21 Nov 2022 17:01:11 +0000 (17:01 +0000)]
[libcxx] Add BOT_OWNERS.txt

Buildkite doesn't provide a way to list bot owners so currently
we are pinging people on Discord and Phabricator.

Which works ok until that person is on vacation. This file gives us
a place to list multiple people, or group contacts for each bot.

I've stuck to the CODE_OWNERS.txt format because there's no great
reason to change it.

Reviewed By: #libc, EricWF, ldionne

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

23 months ago[lld-macho] Fix bug in CUE folding that resulted in wrong unwind table.
Vy Nguyen [Fri, 18 Nov 2022 20:21:23 +0000 (15:21 -0500)]
[lld-macho] Fix bug in CUE folding that resulted in wrong unwind table.

PR/59070

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

23 months ago[HIP] Fix lld failure when devie object is empty
Yaxun (Sam) Liu [Thu, 17 Nov 2022 17:04:57 +0000 (12:04 -0500)]
[HIP] Fix lld failure when devie object is empty

When -fgpu-rdc is used for linking relocatable objects, clang driver launches
clang-offload-bundler to extract a device relocatable object from each input
relocatable object file and passes the extracted files to lld. The input relocatable
object file could either come from HIP program or C++ program. The relocatable
object file from C++ program does not contain device relocatable objects, therefore
clang-offload-bundler extracts an empty file and passes it to lld. lld treates
empty file as linker script. When there is no object input file to lld, lld
will emit error:

target emulation unknown: -m or at least one .o file required

This patch adds "elf64_amdgpu" to lld so that lld always know the target
no matter whether there are object input files or not.

Reviewed by: Artem Belevich, Fangrui Song

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

23 months ago[PowerPC] Add handling for WACC register spilling.
Stefan Pintilie [Tue, 22 Nov 2022 14:41:14 +0000 (08:41 -0600)]
[PowerPC] Add handling for WACC register spilling.

This patch adds spilling for the new WACC registers.

In order to get the spilling test to work the MMA instructions from Power 10 are
now supported for Future CPU except that they are all using the new WACC
registers instead of the ACC registers from Power 10.

Reviewed By: amyk, saghir

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

23 months ago[VectorCombine] switch on opcode to compile faster
Sanjay Patel [Tue, 22 Nov 2022 14:28:55 +0000 (09:28 -0500)]
[VectorCombine] switch on opcode to compile faster

This follows 87debdadaf18 to further eliminate wasting time
calling helper functions only to early return to the main
run loop.

Once again, this results in significant savings based on
experimental data:
https://llvm-compile-time-tracker.com/compare.php?from=01023bfcd33f922ed8c934ce563e54abe8bfe246&to=3dce4f70b73e48ccb045decb634c185e6b4c67d5&stat=instructions:u

This is NFCI other than making the pass faster. The total
cost of VectorCombine runs in an -O3 build appears to be
well under 0.1% of compile-time now, so there's not much
left to do AFAICT.

There's a TODO about making the code cleaner, but it
probably doesn't change timing much. I didn't include those
changes here because it requires updating much more code.

23 months ago[lldb] rm include/lldb/Host/posix/Fcntl.h
Pavel Labath [Sun, 6 Nov 2022 08:43:27 +0000 (09:43 +0100)]
[lldb] rm include/lldb/Host/posix/Fcntl.h

File is unused.

23 months agoAdd include guards for PlatformQemuUser.h
Pavel Labath [Sun, 6 Nov 2022 08:45:17 +0000 (09:45 +0100)]
Add include guards for PlatformQemuUser.h

23 months ago[mlir] fix incorrect summary/description in doc
Oleksandr "Alex" Zinenko [Tue, 22 Nov 2022 15:08:47 +0000 (16:08 +0100)]
[mlir] fix incorrect summary/description in doc

Summary is the short one.

23 months ago[SVE] Fix incorrect predicate for fixed length int/fp conversion.
Paul Walker [Fri, 11 Nov 2022 21:01:59 +0000 (21:01 +0000)]
[SVE] Fix incorrect predicate for fixed length int/fp conversion.

When performing shrinking int/fp conversions the predicate should
be created to match the original fixed length vector type so the
unused lanes don't trigger side effects.

This patch also includes related refactoring to better detect such
issues and streamline the code a little.

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

23 months ago[lldb] Allow plugins to extend DWARF expression parsing for vendor extensions
Philip Pfaffe [Tue, 22 Nov 2022 14:29:19 +0000 (14:29 +0000)]
[lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

Parsing DWARF expressions currently does not support DW_OPs that are vendor
extensions. With this change expression parsing calls into SymbolFileDWARF for
unknown opcodes, which is the semantically "closest" plugin that we have right
now. Plugins can then extend SymbolFileDWARF to add support for vendor
extensions.

Reviewed By: labath

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

23 months ago[AMDGPU][NFC] Remove isLegalVOP3PShuffleMask
Pierre van Houtryve [Tue, 22 Nov 2022 14:14:46 +0000 (14:14 +0000)]
[AMDGPU][NFC] Remove isLegalVOP3PShuffleMask

Unused function since D134967

Reviewed By: arsenm

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

23 months ago[OpenMP][OMPIRBuilder] Add a configuration class that captures flags that affect...
Jan Sjodin [Wed, 16 Nov 2022 13:54:05 +0000 (08:54 -0500)]
[OpenMP][OMPIRBuilder] Add a configuration class that captures flags that affect codegen

This patch introudces the OpenMPIRBuilderConfig class which contains various
flags that are needed to lower OMP constructs to LLVM-IR. The purpose is to
keep the flags in one place so they do not have to be passed in every time.
The flags can be set optionally since some uses cases don't rely on functions
that depend on these flags.

Reviewed By: jdoerfert, tschuett

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

23 months ago[AArch64][clang] implement 2022 General Data-Processing instructions
Ties Stuij [Tue, 22 Nov 2022 12:38:47 +0000 (12:38 +0000)]
[AArch64][clang] implement 2022 General Data-Processing instructions

This patch implements the 2022 Architecture General Data-Processing Instructions

They include:

Common Short Sequence Compression (CSSC) instructions
- scalar comparison instructions
  SMAX, SMIN, UMAX, UMIN (32/64 bits) with or without immediate
- ABS (absolute), CNT (count non-zero bits), CTZ (count trailing zeroes)
- command-line options for CSSC

Associated with these instructions in the documentation is the Range Prefetch
Memory (RPRFM) instruction, which signals to the memory system that data memory
accesses from a specified range of addresses are likely to occur in the near
future. The instruction lies in hint space, and is made unconditional.

Specs for the individual instructions can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/

contributors to this patch:
- Cullen Rhodes
- Son Tuan Vu
- Mark Murray
- Tomas Matheson
- Sam Elliott
- Ties Stuij

Reviewed By: lenary

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

23 months ago[AMDGPU][GISel] Select llvm.amdgcn.fcmp intrinsics
Pierre van Houtryve [Tue, 22 Nov 2022 08:35:02 +0000 (08:35 +0000)]
[AMDGPU][GISel] Select llvm.amdgcn.fcmp intrinsics

Adds FP CCs opcodes/selection logic, including src mods selection

Depends on D136591, D136448
Resolves #58326 (https://github.com/llvm/llvm-project/issues/58326)

Reviewed By: arsenm, foad

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

23 months ago[Sanitizer] Fix the implementation of internal_fstat on LoongArch
Youling Tang [Tue, 22 Nov 2022 14:08:47 +0000 (22:08 +0800)]
[Sanitizer] Fix the implementation of internal_fstat on LoongArch

If `pathname` is an empty string and the AT_EMPTY_PATH flag is specified in `flags`,
statx `pathname` argument is of type `const char *restrict`, so it should be `""`
instead of `0`.

Reviewed By: SixWeining, xen0n, xry111, lixing-star

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

23 months ago[flang][NFC] Switch CollectBindings return to SymbolVector
Valentin Clement [Tue, 22 Nov 2022 14:13:18 +0000 (15:13 +0100)]
[flang][NFC] Switch CollectBindings return to SymbolVector

As suggested on D138129, switching rteurn of CollectBindings
function to SymbolVector.

Reviewed By: jeanPerier

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

23 months ago[scudo] Add loongarch64 support for scudo
Youling Tang [Tue, 22 Nov 2022 14:02:30 +0000 (22:02 +0800)]
[scudo] Add loongarch64 support for scudo

Enable scudo on LoongArch64 on both clang side and compiler-rt side.

Reviewed By: SixWeining

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

23 months ago[flang] Set initial size and type code for unlimited polymorphic descriptor
Valentin Clement [Tue, 22 Nov 2022 13:47:05 +0000 (14:47 +0100)]
[flang] Set initial size and type code for unlimited polymorphic descriptor

Initialization of unlimited polymorphic descriptor was raising an error.
This patch sets a default size and type code for unlimited polymoprhic descriptor
that will be updated once allocated/assigned.

Reviewed By: PeteSteinfeld

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

23 months ago[SelectOptimize] Add some debug logging. NFC
David Green [Tue, 22 Nov 2022 13:47:56 +0000 (13:47 +0000)]
[SelectOptimize] Add some debug logging. NFC

This is some quick debug messages for the SelectOptimize pass, adding
some information for the costs that are measured from getInstructionCost
calls, and re-using the existing optimization remarks to print some
information about if transforms were performed or not.

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

23 months ago[RISCV][NFC] Mark rs1 in most memory instructions as memory operand.
Dmitry Bushev [Tue, 22 Nov 2022 11:52:10 +0000 (14:52 +0300)]
[RISCV][NFC] Mark rs1 in most memory instructions as memory operand.

Marking rs1 (memory offset base) as memory operand provides additional
semantic value to this operand that can be used by different tools
(e.g. llvm-exegesis).

This change does not affect neigther Isel nor assembler. However it
required some tweaks in tablegen compressed inst emmiter.

Reviewed By: craig.topper

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

23 months ago[mlir][bufferize][NFC] Rename DialectAnalysisState and move to OneShotAnalysis
Matthias Springer [Tue, 22 Nov 2022 13:29:47 +0000 (14:29 +0100)]
[mlir][bufferize][NFC] Rename DialectAnalysisState and move to OneShotAnalysis

`DialectAnalysisState` is now `OneShotAnalysisState::Extension`.

This state extension mechanism is needed only for One-Shot Analysis, so it is moved from `BufferizableOpInterface.h` to `OneShotAnalysis.h`.

Extensions are now identified via TypeIDs instead of StringRefs. The API of state extensions is cleaned up and follows the same pattern as other extension mechanisms in MLIR (e.g., `transform::TransformState::Extension`).

Also delete some dead code.

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

23 months ago[Clang][Sema] Added space after ',' in a warning
Fahad Nayyar [Tue, 22 Nov 2022 13:26:21 +0000 (13:26 +0000)]
[Clang][Sema] Added space after ',' in a warning

This change fixes a typo in a warning message.

rdar://79707705

23 months ago[InstCombine] Fold extractelt with select of constants
Thomas Symalla [Mon, 14 Nov 2022 08:45:58 +0000 (09:45 +0100)]
[InstCombine] Fold extractelt with select of constants

An extractelt with a constant index which extracts an element from the
two vector operands of a select can be directly folded into a select.

extractelt (select %x, %vec1, %vec2), %const ->
select %x, %vec1[%const], %vec2[%const]

Note: the implementation currently only works for constant vector operands.

Reviewed By: foad, spatel

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

23 months ago[CGObjC] Add run line for release mode in test arc-exceptions-seh.mm (NFC)
Stefan Gränitz [Mon, 7 Nov 2022 11:23:58 +0000 (12:23 +0100)]
[CGObjC] Add run line for release mode in test arc-exceptions-seh.mm (NFC)

In release mode `arc-exceptions-seh.mm` fails. It needs `-enable-objc-arc-opts=false` to skip ObjC ARC optimizations.

Reviewed By: triplef

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

23 months agoRevert "[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass...
Nuno Lopes [Tue, 22 Nov 2022 12:41:22 +0000 (12:41 +0000)]
Revert "[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]"

This reverts commit f50423c1a4422900aa1240fed643f5920451a88d.

23 months ago[AMDGPU] precommit test for D138401; NFC
chenglin.bi [Tue, 22 Nov 2022 12:39:25 +0000 (20:39 +0800)]
[AMDGPU] precommit test for D138401; NFC

23 months ago[XCOFF] set fragment for XMC_PR csects.
esmeyi [Tue, 22 Nov 2022 12:17:44 +0000 (07:17 -0500)]
[XCOFF] set fragment for XMC_PR csects.

Summary: -xcoff-traceback-table is a default option on AIX regardless of optimization and debug levels. An error of relocation for paired relocatable term is not yet supported in XCOFFObjectWriter::recordRelocation occurred when both of the -xcoff-traceback-table and -function-sections are enabled.
The root cause is that we missed to calculate the symbols difference as absolute value before adding fixups when symbol_A without the fragment set is the csect itself and symbol_B is in it.
This patch only sets the fragment for XMC_PR csects because we don't have other cases that hit this problem yet.

Reviewed By: DiggerLin, hubert.reinterpretcast

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

23 months agoRevert "[libc++] Remove workarounds for systems that used to require __need_XXX macros"
Yi Kong [Tue, 22 Nov 2022 11:11:42 +0000 (20:11 +0900)]
Revert "[libc++] Remove workarounds for systems that used to require __need_XXX macros"

This reverts commit 119cef40d18c48240854edc553dca61c4e9fdf27.

The change broke multiple builders.

23 months ago[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]
Manuel Brito [Tue, 22 Nov 2022 11:40:06 +0000 (11:40 +0000)]
[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]

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

23 months ago[CGObjC] Open cleanup scope before SaveAndRestore CurrentFuncletPad and push CatchRet...
Stefan Gränitz [Tue, 22 Nov 2022 09:13:33 +0000 (10:13 +0100)]
[CGObjC] Open cleanup scope before SaveAndRestore CurrentFuncletPad and push CatchRetScope early

Pushing the `CatchRetScope` early causes cleanups for catch parameters to be emitted in the basic block of the catch handler instead of the `catchret.dest` block. This is important because the latter is not part of the catchpad and this caused code truncations due to ARC PreISel intrinsics in WinEHPrepare.

Reviewed By: rnk

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

23 months ago[AMDGPU] Add encoding tests for SALU_CYCLE_2/3
Piotr Sobczak [Tue, 22 Nov 2022 09:35:07 +0000 (10:35 +0100)]
[AMDGPU] Add encoding tests for SALU_CYCLE_2/3

Add missing assembler/disassembler tests for INSTID_SALU_CYCLE_2
and INSTID_SALU_CYCLE_3 which are possible arguments in S_DELAY_ALU.

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

23 months ago[MLIR][Tensor] Use the existing helper function `applyPermutationToVector` (NFC)
Lorenzo Chelini [Tue, 22 Nov 2022 09:19:34 +0000 (10:19 +0100)]
[MLIR][Tensor] Use the existing helper function `applyPermutationToVector` (NFC)

Avoid duplicate code by using an existing helper function to interchange
a vector based on a permutation. Address comments emerged after landing
D138119.

Reviewed By: nicolasvasilache

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

23 months ago[mlir][SCF] Add tensor.dim(scf.foreach_thread) folding
Matthias Springer [Tue, 22 Nov 2022 10:20:41 +0000 (11:20 +0100)]
[mlir][SCF] Add tensor.dim(scf.foreach_thread) folding

Dim sizes of `scf.foreach_thread` op results match the dim sizes of their respective tied shared_outs operands.

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

23 months ago[mlir] Update custom<DynamicIndexList> for Pack/Unpack.
Alexander Belyaev [Tue, 22 Nov 2022 09:58:23 +0000 (10:58 +0100)]
[mlir] Update custom<DynamicIndexList> for Pack/Unpack.

23 months ago[mlir] Clean-up ViewLikeOpInterface w.r.t. kDynamic change.
Alexander Belyaev [Tue, 22 Nov 2022 07:55:59 +0000 (08:55 +0100)]
[mlir] Clean-up ViewLikeOpInterface w.r.t. kDynamic change.

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

23 months ago[bazel] Add missing dependency after 9aa505a28d
Benjamin Kramer [Tue, 22 Nov 2022 09:46:52 +0000 (10:46 +0100)]
[bazel] Add missing dependency after 9aa505a28d

23 months ago[mlir] Initial MLIR VP intrinsic integration test on host and RVV emulator.
zhanghb97 [Fri, 11 Nov 2022 08:01:05 +0000 (16:01 +0800)]
[mlir] Initial MLIR VP intrinsic integration test on host and RVV emulator.

This patch adds the initial VP intrinsic integration test on the host backend and RVV emulator. Please see more detailed [discussion on the discourse](https://discourse.llvm.org/t/mlir-vp-ops-on-rvv-backend-integration-test-and-issues-report/66343).

- Run the test cases on the host by configuring the CMake option: `-DMLIR_INCLUDE_INTEGRATION_TESTS=ON`
- Build the RVV environment and run the test cases on RVV QEMU by [this doc](https://gist.github.com/zhanghb97/ad44407e169de298911b8a4235e68497).

Reviewed By: aartbik

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

23 months ago[CodeGen] Refactor visitSCALAR_TO_VECTOR. NFC.
Han-Kuan Chen [Tue, 8 Nov 2022 09:43:11 +0000 (01:43 -0800)]
[CodeGen] Refactor visitSCALAR_TO_VECTOR. NFC.

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

23 months ago[RISCV] Add CodeGen support and MC testcase of RISCV Zca Extension
WuXinlong [Mon, 21 Nov 2022 03:20:41 +0000 (11:20 +0800)]
[RISCV] Add CodeGen support and MC testcase of RISCV Zca Extension

This patch add the support of RISCV Zca ext

`Zca` is a subset of C extension instructions that are compatible with the Zc extension.

So this patch implements Zca code generation with reference to the C extension and sets the 2-byte alignment for the Zca extension, just like C extension does.

Reviewed By: craig.topper

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

23 months ago[AMDGPU] Make aperture registers 64 bit
Pierre van Houtryve [Tue, 22 Nov 2022 09:13:57 +0000 (09:13 +0000)]
[AMDGPU] Make aperture registers 64 bit

Makes the SRC_(SHARED|PRIVATE)_(BASE|LIMIT) registers 64 bit instead of 32.
They're still usable as 32 bit operands by using the _LO suffix.

Preparation for D137542

Reviewed By: arsenm

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

23 months agoRevert "[flang][NFC] Switch CollectBindings return to SymbolVector"
Valentin Clement [Tue, 22 Nov 2022 09:11:50 +0000 (10:11 +0100)]
Revert "[flang][NFC] Switch CollectBindings return to SymbolVector"

This reverts commit 97e8eeb758fcae4f2afd9ac516ffc9509b4daaf0.

23 months ago[SCEV][NFC] Introduce API for getting basic block's symbolic max exit count
Max Kazantsev [Tue, 22 Nov 2022 08:52:49 +0000 (15:52 +0700)]
[SCEV][NFC] Introduce API for getting basic block's symbolic max exit count

Currently, it just returns exact exit count. This is a refectoring step
before it is actually implemented.

23 months ago[LoongArch] Fix issue on CMake Xcode build configuration
gonglingqin [Tue, 22 Nov 2022 08:16:09 +0000 (16:16 +0800)]
[LoongArch] Fix issue on CMake Xcode build configuration

Add missing dependency for loongarch-resource-headers. This patch refers to D126892 to repair same error.

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

23 months ago[flang][NFC] Switch CollectBindings return to SymbolVector
Valentin Clement [Tue, 22 Nov 2022 08:42:32 +0000 (09:42 +0100)]
[flang][NFC] Switch CollectBindings return to SymbolVector

As suggested on D138129, switching rteurn of CollectBindings
function to SymbolVector.

Reviewed By: jeanPerier

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

23 months ago[flang] Do not propagate type desc when box type is not polymorphic
Valentin Clement [Tue, 22 Nov 2022 08:41:09 +0000 (09:41 +0100)]
[flang] Do not propagate type desc when box type is not polymorphic

When the rhs is non-polymorphic the type descriptor should not
be propagated. An error in the EmboxOp verifier was raised in that case.
This patch propagate the type descriptor only if the result type of the
EmboxOp operation is polymorphic.

Reviewed By: PeteSteinfeld

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

23 months ago[libcxx] Fix std::equal not accepting volatile types by refactoring __equal_to
Alvin Wong [Tue, 22 Nov 2022 08:33:35 +0000 (16:33 +0800)]
[libcxx] Fix std::equal not accepting volatile types by refactoring __equal_to

Fixes https://github.com/llvm/llvm-project/issues/59021

Reviewed By: #libc, philnik

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

23 months ago[SCEV][NFC] Call getExitCount with SymbolicMaximum when computing loop symbolic max
Max Kazantsev [Tue, 22 Nov 2022 08:18:05 +0000 (15:18 +0700)]
[SCEV][NFC] Call getExitCount with SymbolicMaximum when computing loop symbolic max

Currently this is NFC, because SymbolicMaximum for BB is not implemented and just
reuses exact result. However, from code purity perspective, it's a necessary step
to do. Plans to implement symbolic max for blocks are underway.

23 months ago[AMDGPU][GISel] Add llvm.amdgcn.icmp selection
Pierre van Houtryve [Tue, 22 Nov 2022 08:23:29 +0000 (08:23 +0000)]
[AMDGPU][GISel] Add llvm.amdgcn.icmp selection

Add missing logic to select i16 variants and enable GISel testing.

Reviewed By: arsenm

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