platform/upstream/llvm.git
2 years ago[ControlHeightReduction] Simplify addToMergedCondition() (NFC)
Nikita Popov [Fri, 13 May 2022 13:29:20 +0000 (15:29 +0200)]
[ControlHeightReduction] Simplify addToMergedCondition() (NFC)

2 years agoSuggest typo corrections for preprocessor directives
Ken Matsui [Fri, 13 May 2022 13:09:32 +0000 (09:09 -0400)]
Suggest typo corrections for preprocessor directives

When a preprocessor directive is unknown outside of a skipped
conditional block, we give an error diagnostic because we don't know
how to proceed with preprocessing. But when the directive is in a
skipped conditional block, we would not diagnose it on the theory that
the directive may be known to an implementation other than Clang.

Now, for unknown directives inside a skipped conditional block, we
diagnose the unknown directive as a warning if it is sufficiently
similar to a directive specific to preprocessor conditional blocks. For
example, we'll warn about `#esle` and suggest `#else` but we won't warn
about `#progma` because it's not a directive specific to preprocessor
conditional blocks.

Fixes #51598

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

2 years ago[LoopVectorize] Add overflow checks when tail-folding with scalable vectors
David Sherwood [Fri, 6 May 2022 14:14:06 +0000 (15:14 +0100)]
[LoopVectorize] Add overflow checks when tail-folding with scalable vectors

In InnerLoopVectorizer::getOrCreateVectorTripCount there is an
assert that the known minimum value for the VF is a power of 2
when tail-folding is enabled. However, for scalable vectors the
value of vscale may not be a power of 2, which means we have
to worry about the possibility of overflow. I have solved this
problem by adding preheader checks that prevent us from entering
the vector body if the canonical IV would overflow, i.e.

  if ((IntMax - TripCount) < (VF * UF)) ... skip vector loop ...

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

2 years ago[InstSimplify] Fold and/or using implied conditions
Nikita Popov [Fri, 13 May 2022 08:38:33 +0000 (10:38 +0200)]
[InstSimplify] Fold and/or using implied conditions

This adds two conjugated folds:

 * A | B -> B if A implies B (https://alive2.llvm.org/ce/z/R6GU4j)
 * A & B -> A if A implies B (https://alive2.llvm.org/ce/z/EGMqyy)

If A and B are icmps themselves, we will usually fold this through
other logic already (though the tests show a couple additional cases
we previously missed). However, isImpliedCond() also supports A
being of the form X & Y, which allows us to handle cases like
(X & Y) | B where X implies B. This addresses the regression from
D125398.

Something that notably doesn't work yet is the (X | Y) & B case.
This is due to an asymmetry in the isImpliedCondition()
implementation that will have to be addressed separately.

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

2 years ago[SLP][X86] Add common CHECK prefix to sub-128-bit vector tests
Simon Pilgrim [Fri, 13 May 2022 13:07:27 +0000 (14:07 +0100)]
[SLP][X86] Add common CHECK prefix to sub-128-bit vector tests

2 years agofix typos to cycle bots
Nico Weber [Fri, 13 May 2022 12:56:54 +0000 (08:56 -0400)]
fix typos to cycle bots

2 years ago[libc++] Overhaul how we select the ABI library
Louis Dionne [Tue, 1 Mar 2022 13:42:13 +0000 (08:42 -0500)]
[libc++] Overhaul how we select the ABI library

This patch overhauls how we pick up the ABI library. Instead of setting
ad-hoc flags, it creates interface targets that can be linked against by
the rest of the build, which is easier to follow and extend to support
new ABI libraries.

This is intended to be a NFC change, however there are some additional
simplifications and improvements we can make in the future that would
require a slight behavior change.

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

2 years agoSilence some false positive -Wstrict-prototype warnings
Aaron Ballman [Fri, 13 May 2022 12:25:40 +0000 (08:25 -0400)]
Silence some false positive -Wstrict-prototype warnings

Before issuing the warning about use of a strict prototype, check if
the declarator is required to have a prototype through some other means
determined at parse time.

This silences false positives in OpenCL code (where the functions are
forced to have a prototype) and block literal expressions.

2 years ago[IRBuilder] Add IsInBounds parameter to CreateGEP()
Nikita Popov [Fri, 13 May 2022 10:48:52 +0000 (12:48 +0200)]
[IRBuilder] Add IsInBounds parameter to CreateGEP()

We commonly want to create either an inbounds or non-inbounds GEP
based on a boolean value, e.g. when preserving inbounds from
existing GEPs. Directly accept such a boolean in the API, rather
than requiring a ternary between CreateGEP and CreateInBoundsGEP.

This change is not entirely NFC, because we now preserve an
inbounds flag in a constant expression edge-case in InstCombine.

2 years ago[ConstraintElimination] Simplify ssub(A,B) if B s>=b && B s>=0.
Florian Hahn [Fri, 13 May 2022 12:19:41 +0000 (13:19 +0100)]
[ConstraintElimination] Simplify ssub(A,B) if B s>=b && B s>=0.

A first patch to use the reasoning in ConstraintElimination to simplify
sub with overflow to a regular sub, if the operation is guaranteed to
not overflow.

Reviewed By: spatel

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

2 years agoComment parsing: Treat properties as zero-argument inline commands
Aaron Puchert [Fri, 13 May 2022 11:47:22 +0000 (13:47 +0200)]
Comment parsing: Treat properties as zero-argument inline commands

That is more accurate, and using a separate class in TableGen seems
appropriate since these are not parts of the text but properties of the
declaration itself.

Reviewed By: gribozavr2

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

2 years agoComment parsing: Allow inline commands to have 0 or more than 1 argument
Aaron Puchert [Fri, 13 May 2022 11:37:30 +0000 (13:37 +0200)]
Comment parsing: Allow inline commands to have 0 or more than 1 argument

That's required to support `\n`, but can also be used for other commands.
We already had the infrastructure in place to parse a varying number of
arguments, we simply needed to generalize it so that it would work not
only for block commands.

This should fix #55319.

Reviewed By: gribozavr2

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

2 years agoComment parsing: Specify argument numbers for some block commands
Aaron Puchert [Fri, 13 May 2022 11:36:05 +0000 (13:36 +0200)]
Comment parsing: Specify argument numbers for some block commands

The command traits have a member NumArgs for which all the parsing
infrastructure is in place, but no command was setting it to a value
other than 0. By doing so we get warnings when passing an empty
paragraph to \retval (the first argument is the return value, then comes
the description). We also take \xrefitem along for the ride, although as
the documentation states it's unlikely to be used directly.

Reviewed By: gribozavr2

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

2 years ago[demangler] Avoid special-subst code duplication
Nathan Sidwell [Mon, 28 Mar 2022 19:55:45 +0000 (12:55 -0700)]
[demangler] Avoid special-subst code duplication

We need to expand special substitutions in four different ways.  This
refactors to only have one conversion from enum to string, and derive
the other 3 needs off that.

The SpecialSubstitution node is derived from the
ExpandedSpecialSubstitution.  While this may seem unintuitive, it
works out quite well, as SpecialSubstitution can then use the former's
getBaseName and remove an unneeded 'basic_' prefix, for those
substitutions that are instantiations (to known typedef).  Similarly
all those instantiations use the same set of template arguments (with
'basic_string', getting an additional 'allocator' arg).

Expansion tests were added in D123134, and remain unchanged.

Reviewed By: MaskRay, dblaikie

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

2 years ago[mlir] Fix declaration of nano time function in benchmark infra
Denys Shabalin [Mon, 9 May 2022 10:46:36 +0000 (12:46 +0200)]
[mlir] Fix declaration of nano time function in benchmark infra

In d4555698f89af373f43dcb4aa1587231496bcd31, the name of nano precision timer function has changed from `nano_time` to `nanoTime`, but benchmarks were not updated to reflect that. This change addresses the discrepancy.

Reviewed By: ftynse

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

2 years ago[X86] Add tests for vector widening with freeze(undef)
Simon Pilgrim [Fri, 13 May 2022 11:08:02 +0000 (12:08 +0100)]
[X86] Add tests for vector widening with freeze(undef)

As noted on D103874, the 'no-op' vector widening intrinsics currently depend on undef shuffle mask indices, moving to poison we need to adjust this to reference a 'undefined' second vector operand, which will be a freeze(undef).

2 years ago[ASTMatchers][clang-tidy][NFC] Hoist `forEachTemplateArgument` matcher into the core...
Whisperity [Wed, 11 May 2022 13:33:27 +0000 (15:33 +0200)]
[ASTMatchers][clang-tidy][NFC] Hoist `forEachTemplateArgument` matcher into the core library

Fixes the `FIXME:` related to adding `forEachTemplateArgument` to the
core AST Matchers library.

Reviewed By: aaron.ballman

Differential Revision: http://reviews.llvm.org/D125383

2 years ago[MLIR] Fix areIdsUnique in AffineStructures
Groverkss [Fri, 13 May 2022 10:44:27 +0000 (16:14 +0530)]
[MLIR] Fix areIdsUnique in AffineStructures

This patch fixes a bug in areIdsUnique where it ignores the [start, end] range.

No test case is added since there are no use cases through IR from where it
can be tested, and it is hard to create a unittest since we do not currently
have Values in unittests.

Reviewed By: arjunp

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

2 years ago[InstCombine] Fix unused variable warning (NFC)
Nikita Popov [Fri, 13 May 2022 10:42:53 +0000 (12:42 +0200)]
[InstCombine] Fix unused variable warning (NFC)

2 years ago[IRBuilder] Remove redundant createGEP() overloads (NFC)
Nikita Popov [Fri, 13 May 2022 10:42:03 +0000 (12:42 +0200)]
[IRBuilder] Remove redundant createGEP() overloads (NFC)

ArrayRef<Value *> also accepts a single Value *, there's no need
to create separate overloads for this.

2 years agoAdd cmake dependency for TensorToLinalg
Tres Popp [Fri, 13 May 2022 10:33:06 +0000 (12:33 +0200)]
Add cmake dependency for TensorToLinalg

2 years ago[ArgPromotion] Add tests for already seen offsets (NFC)
Pavel Samolysov [Fri, 13 May 2022 09:57:16 +0000 (12:57 +0300)]
[ArgPromotion] Add tests for already seen offsets (NFC)

If a load with the same offset has already been seen but the load had
a lower alignment, the pass has to check whether the pointer is
dereferenceable and is sufficiently aligned (so, the new alignment must
be taken into account).

2 years ago[mlir] Add TensorToLinalgPass
Tres Popp [Wed, 11 May 2022 12:10:12 +0000 (14:10 +0200)]
[mlir] Add TensorToLinalgPass

This pass is to handle computationally complex operations like
tensor.pad which are not simply lowered to the exact same operation in
the memref dialect.

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

2 years ago[InstSimplify] Add tests for and/or with implied conditions (NFC)
Nikita Popov [Fri, 13 May 2022 10:07:57 +0000 (12:07 +0200)]
[InstSimplify] Add tests for and/or with implied conditions (NFC)

2 years ago[gn build] Port 3a24df992cf8
LLVM GN Syncbot [Fri, 13 May 2022 09:48:26 +0000 (09:48 +0000)]
[gn build] Port 3a24df992cf8

2 years ago[ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum
Archibald Elliott [Fri, 13 May 2022 09:40:43 +0000 (10:40 +0100)]
[ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum

This adds a late Machine Pass to work around a Cortex CPU Erratum
affecting Cortex-A57 and Cortex-A72:
- Cortex-A57 Erratum 1742098
- Cortex-A72 Erratum 1655431

The pass inserts instructions to make the inputs to the fused AES
instruction pairs no longer trigger the erratum. Here the pass errs on
the side of caution, inserting the instructions wherever we cannot prove
that the inputs came from a safe instruction.

The pass is used:
- for Cortex-A57 and Cortex-A72,
- for "generic" cores (which are used when using `-march=`),
- when the user specifies `-mfix-cortex-a57-aes-1742098` or
  `mfix-cortex-a72-aes-1655431` in the command-line arguments to clang.

Reviewed By: dmgreen, simon_tatham

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

2 years ago[mlir] use dynamic sections in MLIR Doxygen
Alex Zinenko [Fri, 13 May 2022 09:41:23 +0000 (11:41 +0200)]
[mlir] use dynamic sections in MLIR Doxygen

Due to an apparent bug in the Doxygen version <1.8.16 used to generate
documentation for MLIR, parts of the navigation (specifically, the lists
of inherited methods for classes) are unusable due to dynsections.js
missing from the output generated by Doxygen. Setting this flag makes
Doxygen always produce the file.

2 years ago[NFC][ARM] Tests for Cortex-A57 and Cortex-A72 Fused AES Erratum
Archibald Elliott [Fri, 13 May 2022 09:38:19 +0000 (10:38 +0100)]
[NFC][ARM] Tests for Cortex-A57 and Cortex-A72 Fused AES Erratum

These are the tests for the pass added in
https://reviews.llvm.org/D119720

Reviewed By: dmgreen

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

2 years ago[mlir][sparse][NFC] Use RewriterBase/OpBuilder when possible
Matthias Springer [Fri, 13 May 2022 09:32:14 +0000 (11:32 +0200)]
[mlir][sparse][NFC] Use RewriterBase/OpBuilder when possible

Most functions do not need a PatternRewriter or ConversionPatternRewriter.

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

2 years ago[mlir][bufferize][NFC] Make getContiguousMemRefType a static function
Matthias Springer [Fri, 13 May 2022 09:26:40 +0000 (11:26 +0200)]
[mlir][bufferize][NFC] Make getContiguousMemRefType a static function

No need to expose this as public API anymore.

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

2 years ago[RISCV] Add the passthru operand for RVV unmasked segment load IR intrinsics.
Zakk Chen [Tue, 10 May 2022 15:36:13 +0000 (08:36 -0700)]
[RISCV] Add the passthru operand for RVV unmasked segment load IR intrinsics.

The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.

Reviewed By: craig.topper

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

2 years ago[TypePromotion] Avoid some unnecessary truncs
Sam Parker [Fri, 13 May 2022 08:42:52 +0000 (09:42 +0100)]
[TypePromotion] Avoid some unnecessary truncs

Recommit.

Check for legal zext 'sinks' before inserting a trunc.

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

2 years ago[GlobalISel] Change ConstantFoldVectorBinop to return vector of APInt
Jay Foad [Thu, 20 Jan 2022 09:38:24 +0000 (09:38 +0000)]
[GlobalISel] Change ConstantFoldVectorBinop to return vector of APInt

Previously it built MIR for the results and returned a Register.

This avoids building constants for earlier elements of the vector if
later elements will fail to fold, and allows CSEMIRBuilder::buildInstr
to avoid unconditionally building a copy from the result.

Use a new helper function MachineIRBuilder::buildBuildVectorConstant
to build a G_BUILD_VECTOR of G_CONSTANTs.

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

2 years ago[NFC][TypePromotion][AArch64] Tests
Sam Parker [Fri, 13 May 2022 08:22:12 +0000 (09:22 +0100)]
[NFC][TypePromotion][AArch64] Tests

Simplify existing test and also add it as a codegen test for aarch64.

2 years ago[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.
Daniel Kiss [Fri, 13 May 2022 07:12:07 +0000 (09:12 +0200)]
[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.

Program may set the RA_SIGN_STATE pseudo register by expressions.
Libunwind expected only the DW_CFA_AARCH64_negate_ra_state could change the value
of the register which leads to runtime errors on PAC enabled systems.
In the recent version of the aadwarf64[1] a limitation is added[2] to forbid the mixing the
DW_CFA_AARCH64_negate_ra_state with other DWARF Register Rule Instructions.

[1] https://github.com/ARM-software/abi-aa/releases/tag/2022Q1
[2] https://github.com/ARM-software/abi-aa/pull/129

Reviewed By: #libunwind, MaskRay

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

2 years ago[analyzer] Add taint to the BoolAssignmentChecker
Endre Fülöp [Wed, 11 May 2022 08:54:48 +0000 (10:54 +0200)]
[analyzer] Add taint to the BoolAssignmentChecker

BoolAssignment checker is now taint-aware and warns if a tainted value is
assigned.

Original author: steakhal

Reviewed By: martong

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

2 years ago[RS4GC] Cache BDVs and bases alogn with IsKnownBase flag (NFC)
Dmitry Makogon [Thu, 12 May 2022 09:48:12 +0000 (16:48 +0700)]
[RS4GC] Cache BDVs and bases alogn with IsKnownBase flag (NFC)

This refactors RS4GC to cache results returned findBaseDefiningValue
and also gets rid of BaseDefiningValueResult by caching the
IsKnownBase flag for BDVs and bases.

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

2 years ago[LegalizeTypes][VP] Add integer promotion support for vp.setcc
Lian Wang [Thu, 12 May 2022 08:28:41 +0000 (08:28 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.setcc

Reviewed By: frasercrmck

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

2 years ago[WebAssembly] Implement ref.is_null MC layer support and codegen
Alex Bradbury [Fri, 13 May 2022 05:55:31 +0000 (06:55 +0100)]
[WebAssembly] Implement ref.is_null MC layer support and codegen

Custom type-checking (in WebAssemblyAsmTypeCheck.cpp) is used to
workaround the fact that separate variants of the instruction are
defined for externref and funcref.

Based on an initial patch by Paulo Matos <pmatos@igalia.com>.

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

2 years ago[compiler-rt] Add NO_EXEC_STACK_DIRECTIVE on s390x
Timm Bäder [Thu, 12 May 2022 08:49:42 +0000 (10:49 +0200)]
[compiler-rt] Add NO_EXEC_STACK_DIRECTIVE on s390x

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

2 years ago[clang][preprocessor] Fix unsigned-ness of utf8 char literals
Timm Bäder [Thu, 5 May 2022 10:09:52 +0000 (12:09 +0200)]
[clang][preprocessor] Fix unsigned-ness of utf8 char literals

UTF8 char literals are always unsigned.

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

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

2 years ago[Object] Support relocation resolver for CSKY
Zi Xuan Wu (Zeson) [Thu, 12 May 2022 07:27:54 +0000 (15:27 +0800)]
[Object] Support relocation resolver for CSKY

It enables relocation resolver for CSKY to pass some check-all test,
and also add some test about dwarf relocs.

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

2 years agoRevert D125410 "[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of commo...
Fangrui Song [Fri, 13 May 2022 03:41:22 +0000 (20:41 -0700)]
Revert D125410 "[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-size"

This reverts commit ebdb9d635a077274e38baa8584f5b0e631b4b1d3.

Changing p_memsz is insufficient and may make PT_GNU_RELRO extend beyond the
PT_LOAD.

2 years ago[LegalizeTypes][VP] Add integer promotion support for vp.merge
Lian Wang [Thu, 12 May 2022 07:31:06 +0000 (07:31 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.merge

Reviewed By: frasercrmck

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

2 years ago[LLVM][Casting.h] Don't create a temporary while casting.
bzcheeseman [Thu, 12 May 2022 17:38:49 +0000 (13:38 -0400)]
[LLVM][Casting.h] Don't create a temporary while casting.

C-style casting can create a temporary when compiled by a C++ compiler, which was emitting a warning casting a reference to another reference. We can't use C++-style casting directly because it doesn't always work with incomplete types. In order to support the current use-cases, for references we switch to pointer space to perform the cast.

Reviewed By: qiongsiwu1

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

2 years ago[NFC] add the missing //@}
Chen Zheng [Fri, 13 May 2022 02:42:12 +0000 (22:42 -0400)]
[NFC] add the missing //@}

address code review comments for D123995

2 years ago[RISCV][NFC] Add an RV64 RUN line to rv32zfhmin-invalid.s
Ping Deng [Fri, 13 May 2022 02:19:41 +0000 (02:19 +0000)]
[RISCV][NFC] Add an RV64 RUN line to rv32zfhmin-invalid.s

Reviewed By: sunshaoce, asb, craig.topper

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

2 years ago[DirectX] Fix typo in CMakeLists.txt.
Xiang Li [Thu, 12 May 2022 23:27:00 +0000 (16:27 -0700)]
[DirectX] Fix typo in CMakeLists.txt.

Change Bitwriter to BitWriter.

Reviewed By: beanz

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

2 years ago[InstCombine] fix sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))
Chenbing Zheng [Fri, 13 May 2022 01:54:10 +0000 (09:54 +0800)]
[InstCombine] fix sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))

This patch fix bug left in D124503. We should do
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Z,Y)) instead of
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Y,Z)).

Reviewed By: spatel

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

2 years ago[TSan] Relax pthread introspection-based test
Julian Lettner [Fri, 13 May 2022 01:03:05 +0000 (18:03 -0700)]
[TSan] Relax pthread introspection-based test

Thread create/destroy events are not guaranteed to belivered on the
parent thread, e.g., output from a CI job:
```
5: THREAD_CREATE 0x7e8000104000, self: 0x1102ebdc0, name: n/a
6: THREAD_START 0x7e8000104000, self: 0x7e8000104000, name: n/a
7: Hello from pthread
8: THREAD_TERMINATE 0x7e8000104000, self: 0x7e8000104000, name: child thread
9: THREAD_DESTROY 0x7e8000104000, self: 0x7e8000104000, name: child thread
```
Here, THREAD_DESTROY is delivered on the thread being destroyed.

rdar://92679941

2 years ago[LinkerWrapper] Group static libraries in their own buffer
Joseph Huber [Thu, 12 May 2022 17:22:08 +0000 (13:22 -0400)]
[LinkerWrapper] Group static libraries in their own buffer

Summary:
Static libraries need to be handled differently from regular inpout
files, namely they are loaded lazily. Previously we used a flag to
indicate a file camm from a static library. This patch simplifies this
by simply keeping a different array that contains the static libraries
so we don't need to parse them out again.

2 years ago[LinkerWrapper] Remove stripping features from the linker wrapper
Joseph Huber [Thu, 12 May 2022 16:39:15 +0000 (12:39 -0400)]
[LinkerWrapper] Remove stripping features from the linker wrapper

Summary:
The linker wrapper previously had functionality to strip the sections
manually. We don't use this at all because this is much better done by
the linker via the `SHF_EXCLUDE` flag. This patch simply removes the
support for thi sfeature to simplify the code.

2 years ago[lldb/test] Skip TestCppIncompleteTypeMembers.py for -gmodules on macOS
Med Ismail Bennani [Fri, 13 May 2022 00:09:43 +0000 (17:09 -0700)]
[lldb/test] Skip TestCppIncompleteTypeMembers.py for -gmodules on macOS

Following 8b9caad8eb449c1dc4df13e566a5f6c59de9be7c, this only skips
TestCppIncompleteTypeMembers.py on macOS if we test with `-gmodules` enabled.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years agoIn 92eaad2dd7adb5ee92f397cef85ab11f2612294e I made it possible to run
Jim Ingham [Thu, 12 May 2022 20:27:22 +0000 (13:27 -0700)]
In 92eaad2dd7adb5ee92f397cef85ab11f2612294e I made it possible to run
a debug session with only a remote path to the file you are debugging
using the SB API's. This patch makes it possible to do this using
target create --remote-file <some_path> without supplying a local file
as well.

Prior to this change we errored out saying that we haven't implemented
copying the binary back from the remote. I didn't implement the copy
back (in the case I'm interested in - iOS debugging - we don't
actually have a way for lldb to do that). This patch doesn't impede
doing that, I just didn't need it. I think for some object file
formats debugging w/o the binary file is hard because of what doesn't
get mapped in. I didn't try to arbitrate that, I'm assuming anybody
who has to do this knows what they are going to get.

If there's a connected platform that can check that the remote file
exists, it will do so, otherwise we trust the user's input - if it
isn't there the process launch is going to fail with no-such-file so
it will be pretty clear what went wrong.

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

2 years ago[mlir][sparse] Factoring out an enumerator over elements of SparseTensorStorage
wren romano [Wed, 11 May 2022 22:58:42 +0000 (15:58 -0700)]
[mlir][sparse] Factoring out an enumerator over elements of SparseTensorStorage

Work towards fixing: https://github.com/llvm/llvm-project/issues/51652

Depends On D122928

Reviewed By: aartbik

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

2 years ago[lldb/test] Skip TestCppIncompleteTypeMembers.py on Darwin (NFC)
Med Ismail Bennani [Thu, 12 May 2022 23:53:20 +0000 (16:53 -0700)]
[lldb/test] Skip TestCppIncompleteTypeMembers.py on Darwin (NFC)

This skips `TestCppIncompleteTypeMembers.py` on Darwin platforms since
it requires `-flimit-debug-info` which is not supported.

This should fix the Green Dragon bot test run:

https://green.lab.llvm.org/green/job/lldb-cmake/43678

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/API] Add SBCompileUnit::GetIndexForLineEntry method to SB API
Med Ismail Bennani [Thu, 12 May 2022 02:33:37 +0000 (19:33 -0700)]
[lldb/API] Add SBCompileUnit::GetIndexForLineEntry method to SB API

This patch adds a new `GetIndexForLineEntry` method to the `SBCompileUnit`
class. As the name suggests, given an `SBLineEntry` object, this will
return the line entry index within a specific compile unit.

This method can take a `exact` boolean that will make sure that the
provided line entry matches perfectly another line entry in the compile unit.

rdar://47450887

Differention Revision: https://reviews.llvm.org/D125437

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[clang-format] Handle comments below r_brace in RemoveBracesLLVM
owenca [Thu, 12 May 2022 07:40:37 +0000 (00:40 -0700)]
[clang-format] Handle comments below r_brace in RemoveBracesLLVM

If a closing brace is followed by a non-trailing comment, the
newline before the closing brace must also be removed.

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

2 years ago[Lit] Add pushd and popd builtins
David Goldman [Thu, 12 May 2022 20:32:29 +0000 (16:32 -0400)]
[Lit] Add pushd and popd builtins

This behaves just like the sh/cmd.exe equivalents.

pushd/popd are useful to verify path handling of the driver,
typically testing prefix maps or relative path handling.

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

2 years ago[llvm][lldb] use FindLibEdit.cmake everywhere
Tobias Ribizel [Thu, 12 May 2022 22:59:41 +0000 (15:59 -0700)]
[llvm][lldb] use FindLibEdit.cmake everywhere

Currently, LLVM's LineEditor and LLDB both use libedit, but find them in different (inconsistent) ways.
This causes issues e.g. when you are using a locally installed version of libedit, which will not be used
by clang-query, but by lldb if picked up by FindLibEdit.cmake

Reviewed By: MaskRay

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

2 years ago[mlir][sparse] add sparse sign integration test
Aart Bik [Thu, 12 May 2022 18:39:20 +0000 (11:39 -0700)]
[mlir][sparse] add sparse sign integration test

Implements a floating-point sign operator (using the new semi-ring ops)
that accomodates +/-Inf and +/-NaN in consistent way.

Reviewed By: bixia

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

2 years ago[mlir] Bump mlir-vscode to 0.0.7
River Riddle [Thu, 12 May 2022 22:52:46 +0000 (15:52 -0700)]
[mlir] Bump mlir-vscode to 0.0.7

The syntax highlighting for mlir has gotten a significant facelift,
we also have some recent bug fixes for server launches.

2 years ago[mlir] Significantly overhaul the textmate grammar
River Riddle [Thu, 12 May 2022 10:02:51 +0000 (03:02 -0700)]
[mlir] Significantly overhaul the textmate grammar

The current grammar is really crusty, only supports a handful of
cases, and is also out-of-date after various refactorings. This commit
refactors the textmate grammar to handle significantly more cases,
and now provides proper coloring for a majority of cases (including
dialect attributes, operations, types, etc.)

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

2 years ago[MIPS} Address ISel failures for 64 bit fpus in microMIPS
Simon Dardis [Sun, 1 May 2022 00:06:41 +0000 (01:06 +0100)]
[MIPS} Address ISel failures for 64 bit fpus in microMIPS

Add the instructions and patterns for loads and stores in microMIPSr3
when a 64 bit FPU is present. Previously, this would lead to an
instruction selection failure.

This resolves PR/49200.

Thanks to jdeguire for reporting the issue!

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

2 years ago[LV] Add crashing test from #55096.
Florian Hahn [Thu, 12 May 2022 21:40:27 +0000 (22:40 +0100)]
[LV] Add crashing test from #55096.

2 years ago[MIPS] Correct the implementation of the msub optimization
Simon Dardis [Sun, 1 May 2022 18:25:03 +0000 (19:25 +0100)]
[MIPS] Correct the implementation of the msub optimization

The MIPS backend attempts to combine integer multiply and addition or
subtraction into a madd or msub operation. This optimization is
heavily restricted due to its utility in many cases.

PR/51114 highlighted that the optimization was performed on an
associative basis which is correct in the `add` case but not in
the `sub` case.

Resolve this bug by performing an early exit in the case where the
multiply is the LHS operand of the subtraction.

This resolves PR/51114.

Thanks to digitalseraphim for reporting the issue!

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

2 years agoRevision 3339000e0bda696c2e29173d15958c0a4978a143 caused the Language
Jim Ingham [Thu, 12 May 2022 21:30:09 +0000 (14:30 -0700)]
Revision 3339000e0bda696c2e29173d15958c0a4978a143 caused the Language
plugin to get queried earlier on in the startup, so that for .s files
we call the language "unknown" not "not-loaded".  This test was checking
against that string, so I fixed it for the change.

2 years ago[runtimes] [CMake] Fix checks for -Werror when building with incomplete toolchains
Martin Storsjö [Mon, 25 Apr 2022 06:24:00 +0000 (09:24 +0300)]
[runtimes] [CMake] Fix checks for -Werror when building with incomplete toolchains

When we add `--unwindlib=none` during the CMake configure phase (to
make CMake linking tests succeed before the unwind library has been
built for the first time - when bootstrapping a cross toolchain from
scratch), we add it to `CMAKE_REQUIRED_FLAGS` to make later CMake tests
pass.

When the option is added to `CMAKE_REQUIRED_FLAGS`, it gets added to
both compilation and linking commands. When --unwindlib=none is added
to the compilation command, it causes warnings (about being unused
during compilation, as it only affects linking).

When all CMake test compilations produce warnings, later CMake tests
for `-Werror` fail.

Add `--{start,end}-no-unused-arguments` around `--unwindlib=none`, if
supported, to avoid unnecessary warnings due to this option.

If the CMake requirement is bumped to 3.14, we could use
`CMAKE_REQUIRED_LINK_OPTIONS` instead, removing the need for the
`--{start,end}-no-unused-arguments` options. (However, do note that
`CMAKE_REQUIRED_LINK_OPTIONS` is problematic in combination with
`CMAKE_TRY_COMPILE_TARGET_TYPE` set to `STATIC_LIBRARY`; see
https://gitlab.kitware.com/cmake/cmake/-/issues/23454.)

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

2 years ago[AArch64] Add `foldADCToCINC` DAG combine.
Karl Meakin [Thu, 12 May 2022 21:21:20 +0000 (22:21 +0100)]
[AArch64] Add `foldADCToCINC` DAG combine.

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

2 years ago[AArch64] Replace `performANDSCombine` with `performFlagSettingCombine`.
Karl Meakin [Thu, 12 May 2022 21:16:21 +0000 (22:16 +0100)]
[AArch64] Replace `performANDSCombine` with `performFlagSettingCombine`.

`performFlagSettingCombine` is a generalised version of `performANDSCombine` which also works on  `ADCS` and `SBCS`.

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

2 years ago[yaml2obj][COFF] Add missing RISCV constants
Eli Friedman [Thu, 12 May 2022 20:57:19 +0000 (13:57 -0700)]
[yaml2obj][COFF] Add missing RISCV constants

2 years ago[mlir] Fix pipeline-parsing.mlir on windows
River Riddle [Thu, 12 May 2022 20:40:16 +0000 (13:40 -0700)]
[mlir] Fix pipeline-parsing.mlir on windows

We shouldn't be making assumptions about the result of llvm::getTypeName,
which may have different results for anonymous namespaces depending
on the platform.

2 years ago[mlir:Pass] Add support for op-agnostic pass managers
River Riddle [Mon, 11 Apr 2022 09:36:10 +0000 (02:36 -0700)]
[mlir:Pass] Add support for op-agnostic pass managers

This commit refactors the current pass manager support to allow for
operation agnostic pass managers. This allows for a series of passes
to be executed on any viable pass manager root operation, instead
of one specific operation type. Op-agnostic/generic pass managers
only allow for adding op-agnostic passes.

These types of pass managers are extremely useful when constructing
pass pipelines that can apply to many different types of operations,
e.g., the default inliner simplification pipeline. With the advent of
interface/trait passes, this support can be used to define FunctionOpInterface
pass managers, or other pass managers that effectively operate on
specific interfaces/traits/etc (see #52916 for an example).

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

2 years ago[libc] add printf converter
Michael Jones [Tue, 10 May 2022 17:15:18 +0000 (10:15 -0700)]
[libc] add printf converter

This adds the main pieces of the last piece of printf, the converter.
This takes the completed format section from the parser and then
converts it to a string for the writer, which is why it was the last
piece to be written. So far it supports chars and strings, but more
pieces are coming. Additionally, it supports replacing all of the
conversion functions with user supplied versions at compile time to
allow for additional functionality.

Reviewed By: sivachandra

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

2 years ago[libc][docs] Add doc for libc stdio functions
Michael Jones [Thu, 14 Apr 2022 21:32:16 +0000 (14:32 -0700)]
[libc][docs] Add doc for libc stdio functions

This patch adds a document describing the status of the string functions
in LLVM-libc.

Reviewed By: sivachandra, lntue

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

2 years ago[RISCV] Add extra space into error message about unsupported extension version.
Craig Topper [Thu, 12 May 2022 19:09:11 +0000 (12:09 -0700)]
[RISCV] Add extra space into error message about unsupported extension version.

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

2 years ago[llvm-readobj] [COFF] Fix the printout for ARM64 packed homed parameters
Martin Storsjö [Thu, 12 May 2022 11:33:49 +0000 (14:33 +0300)]
[llvm-readobj] [COFF] Fix the printout for ARM64 packed homed parameters

If the function has homed parameters but the number of saved registers
is odd, the homed parameters are aligned at the top of the stack (so
they line up with later varargs on the stack), not tightly after the
other saved registers.

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

2 years agoWe don't require users to type out the full context of a function, for
Jim Ingham [Thu, 12 May 2022 18:00:18 +0000 (11:00 -0700)]
We don't require users to type out the full context of a function, for
symbol name matches. Instead, we extract the incoming path's base
name, look up all the symbols with that base name, and then compare
the rest of the context that the user provided to make sure it
matches. However, we do this comparison using just a strstr. So for
instance:

break set -n foo::bar

will match not only "a::foo::bar" but "notherfoo::bar". The former is
pretty clearly the user's intent, but I don't think the latter is, and
results in breakpoints picking up too many matches.

This change adds a Language::DemangledNameContainsPath API which can
do a language aware match against the path provided. If the language
doesn't provide this we fall back to the strstr (though that's changed
to StringRef::contains in the patch).

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

2 years ago[runtimes] [cmake] Fix -Werror detection in common build configs
Martin Storsjö [Mon, 25 Apr 2022 07:54:04 +0000 (10:54 +0300)]
[runtimes] [cmake] Fix -Werror detection in common build configs

We add `--unwindlib=none` to `CMAKE_REQUIRED_FLAGS`
to make sure that builds with a yet-incomplete toolchain succeed,
to avoid linker failures about missing unwindlib.

When this option is added to `CMAKE_REQUIRED_FLAGS`, it gets added to
both compile and link commands in CMake compile tests. If
`--unwindlib=none` is included in compilation commands, it causes
warnings about unused arguments, as the flag only is relevant for
linking.

Due to the warnings in CMake tests, the later CMake test for the
`-Werror` option failed (as the tested `-Werror` option caused the
preexisting warning due to unused `--unwindlib=none` to become a
hard error). Therefore, most CI configurations that build with
`LIBCXX_ENABLE_WERROR` didn't actually end up enabling `-Werror`
after all.

When looking at the CI build log of recent CI builds, they do
end up printing:

    -- Performing Test LIBCXX_SUPPORTS_WERROR_FLAG
    -- Performing Test LIBCXX_SUPPORTS_WERROR_FLAG - Failed
    -- Performing Test LIBCXX_SUPPORTS_WX_FLAG
    -- Performing Test LIBCXX_SUPPORTS_WX_FLAG - Failed

Thus while the configurations are meant to error out on warnings,
they actually haven't done that, due to the interaction of these
options.

To fix this, remove the individual cases of adding `--unwindlib=none`
into `CMAKE_REQUIRED_FLAGS` in libcxx and libunwind.
`runtimes/CMakeLists.txt` still adds `--unwindlib=none` if needed, but
not otherwise. (The same issue with enabling `-Werror` does remain
if `--unwindlib=none` strictly is needed though - that can be fixed
separately afterwards.)

These individual cases in libunwind and libcxx were added while
standalone builds of the runtimes still were supported - but no longer
are necessary now.

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

2 years ago[mlir] translate memref.reshape ops that have static shapes
Ashay Rane [Thu, 5 May 2022 20:18:28 +0000 (13:18 -0700)]
[mlir] translate memref.reshape ops that have static shapes

This patch references code for translating memref.reinterpret_cast ops
to add translation rules for memref.reshape ops that have a static shape
argument.  Since reshape ops don't have offsets, sizes, or strides, this
patch simply sets the allocated and aligned pointers of the MemRef
descriptor.

Reviewed By: ftynse, cathyzhyi

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

2 years ago[libc++] Mark <stdatomic.h> as requiring C++23
Louis Dionne [Thu, 12 May 2022 18:43:20 +0000 (14:43 -0400)]
[libc++] Mark <stdatomic.h> as requiring C++23

Otherwise, we might get errors with modules in pre-C++23 when mixing
<atomic> and <stdatomic.h>. This should fix breakage on Green Dragon.

2 years ago[libc] fix uint includes and libc bazel
Michael Jones [Thu, 12 May 2022 18:38:31 +0000 (11:38 -0700)]
[libc] fix uint includes and libc bazel

This patch fixes the includes for the new UInt class so that the api
test now passes, additionally it fixes the bazel files to account for
the new dependencies.

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

2 years ago[LAA] Initial support for runtime checks with pointer selects.
Florian Hahn [Thu, 12 May 2022 18:33:48 +0000 (19:33 +0100)]
[LAA] Initial support for runtime checks with pointer selects.

Scaffolding support for generating runtime checks for multiple SCEV expressions
per pointer. The initial version just adds support for looking through
a single pointer select.

The more sophisticated logic for analyzing forks is in D108699

Reviewed By: huntergr

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

2 years ago[SLP][NFC] Added test to exercise the cause of a crash caused by reordering.
Vasileios Porpodas [Thu, 12 May 2022 02:09:38 +0000 (19:09 -0700)]
[SLP][NFC] Added test to exercise the cause of a crash caused by reordering.

This is to support 0950d4060cd916a1d08da657db2513d2ce3e38fa.
External users that can affect reordering, with range == VL.size() but
non consecutive (like stores to A[0],A[0],A[3],A[3]) would escape the check
for consecutive accesses and would cause a crash.

2 years ago[libc] add uint128 implementation
Michael Jones [Tue, 3 May 2022 16:55:00 +0000 (09:55 -0700)]
[libc] add uint128 implementation

Some platforms don't support proper 128 bit integers, but some
algorithms use them, such as any that use long doubles. This patch
modifies the existing UInt class to support the necessary operators.
This does not put this new class into use, that will be in followup
patches.

Reviewed By: sivachandra, lntue

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

2 years ago[clang] Allow all string types for all attribute(format) styles
Félix Cloutier [Thu, 12 May 2022 18:09:06 +0000 (11:09 -0700)]
[clang] Allow all string types for all attribute(format) styles

This allows using any recognized kind of string for any
__attribute__((format)) archetype. Before this change, for instance,
the printf archetype would only accept char pointer types and the
NSString archetype would only accept NSString pointers. This is
more restrictive than necessary as there exist functions to
convert between string types that can be annotated with
__attribute__((format_arg)) to transfer format information.

Reviewed By: ahatanak

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

rdar://89060618

2 years ago[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-size
Fangrui Song [Thu, 12 May 2022 18:03:12 +0000 (11:03 -0700)]
[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-size

We picked common-page-size to match GNU ld. Recently, the resolution to GNU ld
https://sourceware.org/bugzilla/show_bug.cgi?id=28824 (milestone: 2.39) switched
to max-page-size so that the last page can be protected by RELRO in case the
system page size is larger than common-page-size.

Thanks to our two RW PT_LOAD scheme (D58892), switching to max-page-size does
not change file size (while GNU ld's scheme may increase file size).

Reviewed By: peter.smith

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

2 years ago[llvm-profgen] Filter out oversized LBR ranges.
Hongtao Yu [Thu, 12 May 2022 04:33:09 +0000 (21:33 -0700)]
[llvm-profgen] Filter out oversized LBR ranges.

As a follow up to {D123271}, LBR ranges that are too big should also be considered as invalid.

For example, the last two pairs in the following trace form a range [0x0d7b02b0, 0x368ba706] that covers a ton of functions in the binary. Such oversized range should also be ignored.

   0x0c74505f/0x368b99a0 **0x368ba706**/0x0c745040  0x0d7b1c3f/**0x0d7b02b0**

Add a defensive check to filter out those ranges based that the valid range should not cross the unconditional branch(Call, return, unconditional jmp).

Reviewed By: hoy, wenlei

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

2 years ago[Sanitizers][Darwin] Add READ/WRITE detection on arm64 for darwin.
Blue Gaston [Wed, 11 May 2022 19:52:32 +0000 (12:52 -0700)]
[Sanitizers][Darwin] Add READ/WRITE detection on arm64 for darwin.

On arm64 the read/write flag is set on the esr register.
Adding this flag check for arm64 enables a more accurate
print out for sanitizer signal reports and matches the
behavior on x86.

Fixes bug: https://bugs.llvm.org/show_bug.cgi?id=27543 https://github.com/google/sanitizers/issues/653

These tests are now passing:
SanitizerCommon-asan-arm64-Darwin :: Posix/illegal_read_test.cpp
SanitizerCommon-asan-arm64-Darwin :: Posix/illegal_write_test.cpp
SanitizerCommon-asan-arm64e-Darwin :: Posix/illegal_read_test.cpp
   SanitizerCommon-asan-arm64e-Darwin :: Posix/illegal_write_test.cpp
   SanitizerCommon-tsan-arm64-Darwin :: Posix/illegal_read_test.cpp
   SanitizerCommon-tsan-arm64-Darwin :: Posix/illegal_write_test.cpp
   SanitizerCommon-tsan-arm64e-Darwin :: Posix/illegal_read_test.cpp
   SanitizerCommon-tsan-arm64e-Darwin :: Posix/illegal_write_test.cpp
   SanitizerCommon-ubsan-arm64-Darwin :: Posix/illegal_read_test.cpp
   SanitizerCommon-ubsan-arm64-Darwin :: Posix/illegal_write_test.cpp
   SanitizerCommon-ubsan-arm64e-Darwin :: Posix/illegal_read_test.cpp
   SanitizerCommon-ubsan-arm64e-Darwin :: Posix/illegal_write_test.cpp

rdar://92104440

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

2 years ago[InstCombine] freeze operand in div+mul fold
Sanjay Patel [Thu, 12 May 2022 16:37:29 +0000 (12:37 -0400)]
[InstCombine] freeze operand in div+mul fold

As discussed in issue #37809, this transform is not safe
if the input is an undefined value.

This is similar to recent changes for urem and sdiv:
d428f09b2c9d
99ef341ce943

There is no difference in codegen on the basic examples,
but this could lead to regressions. We may need to
improve freeze analysis or lowering if that happens.

Presumably, in real cases that are similar to the tests
where a subsequent transform removes the rem, we
will also be able to remove the freeze by seeing that
the parameter has 'noundef'.

2 years ago[RISCV] Extend dataflow workaround from D119518 to fallthrough blocks
Philip Reames [Thu, 12 May 2022 17:10:12 +0000 (10:10 -0700)]
[RISCV] Extend dataflow workaround from D119518 to fallthrough blocks

We've got a lurking problem with our data flow implementation where different phases disagree, resulting in possible miscompiles. D119518 introduced a workaround, but failed to consider blocks without terminators (e.g. fallthroughs).

I have a deeper rework of the algorithm in flight over in D125232, but this patch is specifically a minimal fix for an active miscompile. That change can be reworked over this once landed.

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

2 years ago[libc++abi][NFC] Add comment on long reaching #if
Louis Dionne [Thu, 12 May 2022 17:26:16 +0000 (13:26 -0400)]
[libc++abi][NFC] Add comment on long reaching #if

2 years agoCheck for resource exhaustion when recursively parsing declarators
Aaron Ballman [Thu, 12 May 2022 17:19:26 +0000 (13:19 -0400)]
Check for resource exhaustion when recursively parsing declarators

With sufficiently tortured code, it's possible to cause a stack
overflow when parsing declarators. Thus, we now check for resource
exhaustion when recursively parsing declarators so that we can at least
warn the user we're about to crash before we actually crash.

Fixes #51642

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

2 years ago[libc++abi] Refactor exception type demangling into a separate function
Louis Dionne [Mon, 9 May 2022 20:41:38 +0000 (16:41 -0400)]
[libc++abi] Refactor exception type demangling into a separate function

As a fly-by fix, also let `__cxa_demangle` allocate its buffer alone,
since we are not allowed to pass a non-malloc'd buffer to it.

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

2 years ago[CostModel][X86] Auto generate partial interleaved load LV costs using UTC_ARGS ...
Simon Pilgrim [Thu, 12 May 2022 16:46:41 +0000 (17:46 +0100)]
[CostModel][X86] Auto generate partial interleaved load LV costs using UTC_ARGS --filter control

2 years ago[CostModel][X86] Auto generate masked load/store LV costs using UTC_ARGS --filter...
Simon Pilgrim [Thu, 12 May 2022 16:40:40 +0000 (17:40 +0100)]
[CostModel][X86] Auto generate masked load/store LV costs using UTC_ARGS --filter control

Also fix a sse42 -> sse4.2 typo so that we actually test costs for sse4.2

2 years ago[CostModel][X86] Auto generate gather/scatter LV costs using UTC_ARGS --filter control
Simon Pilgrim [Thu, 12 May 2022 16:06:34 +0000 (17:06 +0100)]
[CostModel][X86] Auto generate gather/scatter LV costs using UTC_ARGS --filter control

Also fix a sse42 -> sse4.2 typo so that we actually test costs for sse4.2

2 years ago[Headers][MSVC] Define wchar_t in stddef.h like MSVC if not using the builtin type
Stephen Long [Thu, 12 May 2022 16:10:43 +0000 (09:10 -0700)]
[Headers][MSVC] Define wchar_t in stddef.h like MSVC if not using the builtin type

 MSVC expects wchar_t to be defined in stddef.h if /Zc:wchar_t- is specified

Reviewed By: efriedma

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

2 years ago[CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when conve...
Hongtao Yu [Thu, 12 May 2022 16:28:25 +0000 (09:28 -0700)]
[CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested.

Recent experiments with our two large internal services showed that duplicating context profiles into base profile caused code size inflation and didn't deliver good performance compared to no such duplication. It was a trick we made to catch up with the CS flat profile and I'm now turning it off by default.

The code size inflation mainly comes from the enriched based profiles. A base profile for a function represents the uninlined (or outlined) portion of the whole function running time. Such portion could be very small if a function is inlined into most of its hot callsites. Duplicating context profiles of the function into its base profiles could cause the outlined body to be hot enough and in turn get many of its callees inlined, thus increases the code size. The size inflation could further cause perf regression.

Reviewed By: wenlei

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

2 years ago[TypePromotion] Promote undef by converting to 0.
Craig Topper [Thu, 12 May 2022 07:32:45 +0000 (00:32 -0700)]
[TypePromotion] Promote undef by converting to 0.

If we're promoting an undef I think that means that we expect the
upper bits are zero. undef doesn't guarantee that.

This patch replaces undef with 0 to ensure this. This matches how
a zext or sext of undef would be folded by InstCombine/InstSimplify.

I haven't found a failure from this was just thinking through the code.

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