platform/upstream/llvm.git
2 years ago[mlir][linalg][bufferize][NFC] Simplify getAliasingOpResult()
Matthias Springer [Thu, 7 Oct 2021 13:39:52 +0000 (22:39 +0900)]
[mlir][linalg][bufferize][NFC] Simplify getAliasingOpResult()

The signature of this function was confusing. Check for hasKnownBufferizationAliasingBehavior separately when needed.

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

2 years ago[mlir][vector] Split populateVectorContractLoweringPatterns
Lei Zhang [Thu, 7 Oct 2021 13:33:51 +0000 (09:33 -0400)]
[mlir][vector] Split populateVectorContractLoweringPatterns

It was bundling quite a lot of patterns that convert high-D
vector ops into low-D elementary ops. It might not be good
for all of the patterns to happen for a particular downstream
user. For example, `ShapeCastOpRewritePattern` rewrites
`vector.shape_cast` into data movement extract/insert ops.

Instead, split the entry point into multiple ones so users
can pull in patterns on demand.

Reviewed By: ftynse

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

2 years ago[Clang][OpenMP] Fix fat archive tests for Mac and Windows
Saiyedul Islam [Thu, 7 Oct 2021 13:31:13 +0000 (13:31 +0000)]
[Clang][OpenMP] Fix fat archive tests for Mac and Windows

Fixes missing libomptarget on Mac and Windows in check lines. Issue
was introduced by D105191.

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

2 years ago[mlir][linalg][bufferize][NFC] Change bufferizableInPlaceAnalysis signature
Matthias Springer [Thu, 7 Oct 2021 13:32:18 +0000 (22:32 +0900)]
[mlir][linalg][bufferize][NFC] Change bufferizableInPlaceAnalysis signature

Move getInplaceableOpResult() call into bufferizableInPlaceAnalysis.

Note: The only goal of this change is to make the signature of bufferizableInPlaceAnalysis smaller. (Fewer arguments.)

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

2 years ago[mlir][linalg][bufferize] tensor.cast may require a copy
Matthias Springer [Thu, 7 Oct 2021 13:23:10 +0000 (22:23 +0900)]
[mlir][linalg][bufferize] tensor.cast may require a copy

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

2 years ago[mlir] Add alignment attribute to memref.global
Eugene Zhulenev [Thu, 7 Oct 2021 12:49:59 +0000 (05:49 -0700)]
[mlir] Add alignment attribute to memref.global

Revived https://reviews.llvm.org/D102435

Add alignment attribute to `memref.global` and propagate it to llvm global in memref->llvm lowering

Reviewed By: ftynse

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

2 years agoFix two unused-variable warnings.
Michael Forster [Thu, 7 Oct 2021 13:17:58 +0000 (15:17 +0200)]
Fix two unused-variable warnings.

2 years ago[PowerPC] refactor rewriteLoadStores for reusing; nfc
Chen Zheng [Thu, 23 Sep 2021 05:48:46 +0000 (05:48 +0000)]
[PowerPC] refactor rewriteLoadStores for reusing; nfc

This is split from https://reviews.llvm.org/D108750.
Refactor rewriteLoadStores() so that we can reuse the outlined
functions.

Reviewed By: jsji

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

2 years ago[libcxx][pretty printers] Correct tests run detection
David Spickett [Thu, 7 Oct 2021 12:36:01 +0000 (13:36 +0100)]
[libcxx][pretty printers] Correct tests run detection

Missing "global" meant that we set a local "has_run_tests"
so the global was False by the time everything has run.

2 years ago[ARM] Introduce a MQPRCopy
David Green [Thu, 7 Oct 2021 11:52:12 +0000 (12:52 +0100)]
[ARM] Introduce a MQPRCopy

Currently when creating tail predicated loops, we need to validate that
all the live-outs of a loop will be equivalent with and without tail
predication, and if they are not we cannot legally create a
tail-predicated loop, leaving expensive vctp and vpst instructions in
the loop. These notably can include register-allocation instructions
like stack loads and stores, and copys lowered from COPYs to MVE_VORRs.

Instead of trying to prove this is valid late in the pipeline, this
patch introduces a MQPRCopy pseudo instruction that COPY is lowered to.
This can then either be converted to a MVE_VORR where possible, or to a
couple of VMOVD instructions if not. This way they do not behave
differently within and outside of tail-predications regions, and we can
know by construction that they are always valid. The idea is that we can
do the same with stack load and stores, converting them to VLDR/VSTR or
VLDM/VSTM where required to prove tail predication is always valid.

This does unfortunately mean inserting multiple VMOVD instructions,
instead of a single MVE_VORR, but my experiments show it to be an
improvement in general.

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

2 years ago[MachineCopyPropagation] Handle propagation of undef copies
Carl Ritson [Thu, 7 Oct 2021 10:36:10 +0000 (19:36 +0900)]
[MachineCopyPropagation] Handle propagation of undef copies

When propagating undefined copies the undef flag must also be
propagated.

Reviewed By: foad

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

2 years ago[lldb] Rewrite/expand TestCppTypedef and document a lookup bug.
Raphael Isemann [Thu, 7 Oct 2021 09:18:22 +0000 (11:18 +0200)]
[lldb] Rewrite/expand TestCppTypedef and document a lookup bug.

Just regrouping the checks for the same typedef together and also giving the
different typedefs unique names. We might want to have a second test with
identical names to see how LLDB handle the potential name conflict, but that
should be a separate test and not part of the main typedef test.

Also this test is actually unintentionally passing. LLDB can't lookup typedefs
in a struct/class scope, but in the test the check passes as the local variable
in the expression evaluation scope pulls in the typedef. I added a second check
that makes it clear that this is not working right now.

2 years ago[lldb/gdb-remote] Delete SendPacketsAndConcatenateResponses
Pavel Labath [Thu, 7 Oct 2021 11:07:42 +0000 (13:07 +0200)]
[lldb/gdb-remote] Delete SendPacketsAndConcatenateResponses

ReadExtFeature provides equivalent functionality. Also fix a but in
ReadExtFeature, which prevented it from being used for auxv data (it
contains nul characters).

2 years agoFunctionLoweringInfo.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 10:42:56 +0000 (11:42 +0100)]
FunctionLoweringInfo.h - remove unused Optional.h include

2 years agoTargetSchedule.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 10:32:23 +0000 (11:32 +0100)]
TargetSchedule.h - remove unused Optional.h include

2 years agoMCSchedule.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 10:27:21 +0000 (11:27 +0100)]
MCSchedule.h - remove unused Optional.h include

2 years ago[ExecutionEngine] remove unused <string> includes
Simon Pilgrim [Thu, 7 Oct 2021 10:08:02 +0000 (11:08 +0100)]
[ExecutionEngine] remove unused <string> includes

2 years agoScalarEvolution.h - remove unused Hashing.h include
Simon Pilgrim [Thu, 7 Oct 2021 09:51:27 +0000 (10:51 +0100)]
ScalarEvolution.h - remove unused Hashing.h include

2 years ago[libomptarget] Move device environment to shared header, remove divergence
Jon Chesterfield [Thu, 7 Oct 2021 11:03:46 +0000 (12:03 +0100)]
[libomptarget] Move device environment to shared header, remove divergence

Follow on to D110006, related to D110957

Where implementations have diverged this resolves to match the new DeviceRTL

- replaces definitions of this struct in deviceRTL and plugins with include
- changes the dynamic_shared_size field from D110006 to 32 bits
- handles stdint being unavailable in DeviceRTL
- adds a zero initializer for the field to amdgpu
- moves the extern declaration for deviceRTL to target_interface
  (omptarget.h is more natural, but doesn't work due to include order
  with debug.h)
- Renames the fields everywhere to match the LLVM format used in DeviceRTL
- Makes debug_level uint32_t everywhere (previously sometimes int32_t)

Reviewed By: jdoerfert

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

2 years ago[clang][ASTImporter] Simplify code of attribute import [NFC].
Balázs Kéri [Thu, 7 Oct 2021 07:48:06 +0000 (09:48 +0200)]
[clang][ASTImporter] Simplify code of attribute import [NFC].

The code of `ASTImporter::Import(const Attr *)` was repetitive,
it is now simplified. (There is still room for improvement but
probably only after big changes.)

Reviewed By: martong, steakhal

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

2 years ago[ARM] Add tests for code that spills in tail predicate loops.
David Green [Thu, 7 Oct 2021 10:35:02 +0000 (11:35 +0100)]
[ARM] Add tests for code that spills in tail predicate loops.

2 years ago[libcxx][pretty printers] Report not being able to trace test program
David Spickett [Fri, 1 Oct 2021 14:29:48 +0000 (15:29 +0100)]
[libcxx][pretty printers] Report not being able to trace test program

If you don't have ptrace permissions this test will fail to run
silently, this adds a check for that and anything else that
might do similar things.

The output will now be:
```
FAILED test program did not run correctly, check gdb warnings

/usr/bin/gdb: warning: Couldn't determine a path for the index cache
directory.
No symbol table is loaded.  Use the "file" command.
warning: Error disabling address space randomization: Operation not
permitted
warning: Could not trace the inferior process.
warning: ptrace: Operation not permitted

error: command failed with exit status: 255
```

We already have a feature to check for a compatible python enabled
gdb, so I think it's reasonable to check for this at test runtime.

Note that this is different to the catch all at the end of the test
script. That would be a case where you can trace but something else
made it stop mid way that wasn't our test breakpoints.

Reviewed By: saugustine

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

2 years agoRecommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo
Pavel Labath [Thu, 23 Sep 2021 12:10:49 +0000 (14:10 +0200)]
Recommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo

The previous version of the patch did not update the definitions in
conditionally compiled code. This patch includes changes to ARC and
windows targets.

Original commit message was:

These were added to support some mips registers on linux, but linux mips
support has now been removed due.

They are still referenced in the freebds mips implementation, but the
completeness of that implementation is also unknown. All other
architectures just set these fields to zero, which is a cause of
significant bloat in our register info definitions.

Arm also has registers with variable sizes, but they were implemented in
a more gdb-compatible fashion and don't use this feature.

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

2 years ago[TwoAddressInstruction] Fix ReplacedAllUntiedUses in processTiedPairs
Jay Foad [Thu, 30 Sep 2021 15:35:44 +0000 (16:35 +0100)]
[TwoAddressInstruction] Fix ReplacedAllUntiedUses in processTiedPairs

Fix the calculation of ReplacedAllUntiedUses when any of the tied defs
are early-clobber. The effect of this is to fix the placement of kill
flags on an instruction like this (from @f2 in
 test/CodeGen/SystemZ/asm-18.ll):

  INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], killed %4:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit

After TwoAddressInstruction without this patch:

  %3:grh32bit = COPY killed %4:grh32bit
  INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], %3:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit

Note that the COPY kills %4, even though there is a later use of %4 in
the INLINEASM. This fails machine verification if you force it to run
after TwoAddressInstruction (currently it is disabled for other
reasons).

After TwoAddressInstruction with this patch:

  %3:grh32bit = COPY %4:grh32bit
  INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], %3:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit

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

2 years ago[TwoAddressInstruction] Pre-commit a test case for D110848
Jay Foad [Fri, 1 Oct 2021 18:26:22 +0000 (19:26 +0100)]
[TwoAddressInstruction] Pre-commit a test case for D110848

2 years ago[mlir] Don't allow dynamic extent tensor types for ConstShapeOp.
Adrian Kuegel [Tue, 5 Oct 2021 12:37:30 +0000 (14:37 +0200)]
[mlir] Don't allow dynamic extent tensor types for ConstShapeOp.

ConstShapeOp has a constant shape, so its type can always be static.
We still allow it to have ShapeType though.

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

2 years ago[AArch64][SME] Update DUP (predicate) instruction
Cullen Rhodes [Thu, 7 Oct 2021 08:29:51 +0000 (08:29 +0000)]
[AArch64][SME] Update DUP (predicate) instruction

Changes in architecture revision 00eac1:
  * Renamed to PSEL.
  * Copies whole source register.
  * Element type suffix removed from destination.
  * Element index no longer optional and '#' prefix has been removed.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-09

Depends on D111212.

Reviewed By: kmclaughlin

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

2 years ago[AArch64][SME] Update tile slice index offset
Cullen Rhodes [Thu, 7 Oct 2021 08:28:55 +0000 (08:28 +0000)]
[AArch64][SME] Update tile slice index offset

Changes in architecture revision 00eac1:
  * Tile slice index offset no longer prefixed with '#'.
  * The syntax for 128-bit (.Q) ZA tile slice accesses must now include
    an explicit zero index.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-09

Reviewed By: david-arm

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

2 years ago[VPlan] Replace hard-coded VPValue ids with patterns in tests.
Florian Hahn [Tue, 5 Oct 2021 19:42:00 +0000 (20:42 +0100)]
[VPlan] Replace hard-coded VPValue ids with patterns in tests.

This makes the tests a bit more robust with respect to small changes in
the value numbering.

2 years ago[libcxx][pretty printers] Correct locale for u16/u32 string tests
David Spickett [Tue, 5 Oct 2021 12:24:23 +0000 (13:24 +0100)]
[libcxx][pretty printers] Correct locale for u16/u32 string tests

When the locale is not some UTF-8 these tests fail.
(different results for python2 linked gdbs vs. python3
but same issue)

Setting the locale just for the test works around this.
By default Ubuntu comes with just C.UTF-8. I've chosen
to use en_US.UTF-8 instead given that my Mac doesn't have
the former and there's a slim chance this test might run there.

This also enables the u16string tests which are now passing.

Reviewed By: #libc, ldionne, saugustine

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

2 years ago[libcxx][CI] Install all locales used by the test suite
David Spickett [Wed, 6 Oct 2021 15:05:47 +0000 (16:05 +0100)]
[libcxx][CI] Install all locales used by the test suite

Reviewed By: #libc, ldionne

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

2 years ago[mlir][linalg] Add unsigned min/max/cast function to OpDSL.
Tobias Gysi [Thu, 7 Oct 2021 06:26:38 +0000 (06:26 +0000)]
[mlir][linalg] Add unsigned min/max/cast function to OpDSL.

Update OpDSL to support unsigned integers by adding unsigned min/max/cast signatures. Add tests in OpDSL and on the C++ side to verify the proper signed and unsigned operations are emitted.

The patch addresses an issue brought up in https://reviews.llvm.org/D111170.

Reviewed By: rsuderman

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

2 years ago[Clang][OpenMP] Fix windows buildbot failure for D105191
Saiyedul Islam [Thu, 7 Oct 2021 05:51:41 +0000 (05:51 +0000)]
[Clang][OpenMP] Fix windows buildbot failure for D105191

Fixes 4c4117089599cb5b6c6fa5635c28462ffd1bddf4.

2 years ago[GlobalISel] Silence gcc warning about unused variable
Mikael Holmen [Thu, 7 Oct 2021 05:18:04 +0000 (07:18 +0200)]
[GlobalISel] Silence gcc warning about unused variable

2 years ago[Clang][OpenMP] Add partial support for Static Device Libraries
Saiyedul Islam [Tue, 28 Sep 2021 14:26:54 +0000 (14:26 +0000)]
[Clang][OpenMP] Add partial support for Static Device Libraries

An archive containing device code object files can be passed to
clang command line for linking. For each given offload target
it creates a device specific archives which is either passed to llvm-link
if the target is amdgpu, or to clang-nvlink-wrapper if the target is
nvptx. -L/-l flags are used to specify these fat archives on the command
line. E.g.
  clang++ -fopenmp -fopenmp-targets=nvptx64 main.cpp -L. -lmylib

It currently doesn't support linking an archive directly, like:
  clang++ -fopenmp -fopenmp-targets=nvptx64 main.cpp libmylib.a

Linking with x86 offload also does not work.

Reviewed By: ye-luo

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

2 years ago[CFE][Codegen] Update auto-generated check lines for few GPU lit tests
hsmahesha [Thu, 7 Oct 2021 02:57:08 +0000 (08:27 +0530)]
[CFE][Codegen] Update auto-generated check lines for few GPU lit tests

which is essentially required as a pre-commit for https://reviews.llvm.org/D110257.

Reviewed By: yaxunl

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

2 years agoDon't register mem segments that aren't present in a corefile
Jason Molenda [Thu, 7 Oct 2021 03:04:49 +0000 (20:04 -0700)]
Don't register mem segments that aren't present in a corefile

A Mach-O corefile has an array of memory segments, representing
the memory of the process at the point of the capture.  Each segment
has a virtual address + size, and a file offset + size.  The file
size may be less than the virtual address size, indicating that
the memory was unavailable. When ProcessMachCore::DoLoadCore scans
this array of memory segments, it builds up a table to translate
virtual addresses to file offsets, for memory read requests.
This lookup table combines contiguous memory segments into a single
entry, to reduce the number of entries (some corefile writers will
emit a separate segement for each virtual meory page).

This contiguous check wasn't taking into account a segment that
isn't present in the corefile, e.g. filesize==0, and every contiguous
memory segment after that point would result in lldb reading the
wrong offset of the file because it didn't account for this.

I'd like to have an error message when someone tries to read memory from
one of these segments, instead of returning all zeroes, so this patch
intentionally leaves these out of the vmaddr -> fileoff table (and
avoids combining them with segments that actually do exist in the
corefile).

I'm a little unsure of writing a test for this one; I'd have to do
a yaml2obj of a corefile with the problem, or add an internal mode
to the Mach-O process save-core where it could write a filesize==0
segment while it was writing one.

rdar://83382487

2 years agoUpdate TODO noting that DriverKit should be added too
Jason Molenda [Thu, 7 Oct 2021 02:54:33 +0000 (19:54 -0700)]
Update TODO noting that DriverKit should be added too

When BridgeOS and DriverKit are added to llvm Triple.

2 years ago[MLIR] Add OrOp folding rule for constant one operand
Uday Bondhugula [Wed, 6 Oct 2021 04:39:56 +0000 (10:09 +0530)]
[MLIR] Add OrOp folding rule for constant one operand

Add folding rule for std.or op when an operand has all bits set.

or(x, <all bits set>) -> <all bits set>

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

2 years ago[IR][NFC] Rename getBaseObject to getAliaseeObject
Itay Bookstein [Thu, 7 Oct 2021 02:33:10 +0000 (19:33 -0700)]
[IR][NFC] Rename getBaseObject to getAliaseeObject

To better reflect the meaning of the now-disambiguated {GlobalValue,
GlobalAlias}::getBaseObject after breaking off GlobalIFunc::getResolverFunction
(D109792), the function is renamed to getAliaseeObject.

2 years ago[CUDA] remove unneeded includes from CUDA-related headers.
Artem Belevich [Thu, 7 Oct 2021 00:06:40 +0000 (17:06 -0700)]
[CUDA] remove unneeded includes from CUDA-related headers.

This should fix bot failures on PPC and windows.

2 years ago[MLIR] fix arith dialect build failure
Mogball [Wed, 6 Oct 2021 23:38:07 +0000 (23:38 +0000)]
[MLIR] fix arith dialect build failure

Missing function defs causes errors on some build configs.

2 years agoDebugInfo: Use clang's preferred names for integer types
David Blaikie [Fri, 24 Sep 2021 23:13:07 +0000 (16:13 -0700)]
DebugInfo: Use clang's preferred names for integer types

This reverts c7f16ab3e3f27d944db72908c9c1b1b7366f5515 / r109694 - which
suggested this was done to improve consistency with the gdb test suite.
Possible that at the time GCC did not canonicalize integer types, and so
matching types was important for cross-compiler validity, or that it was
only a case of over-constrained test cases that printed out/tested the
exact names of integer types.

In any case neither issue seems to exist today based on my limited
testing - both gdb and lldb canonicalize integer types (in a way that
happens to match Clang's preferred naming, incidentally) and so never
print the original text name produced in the DWARF by GCC or Clang.

This canonicalization appears to be in `integer_types_same_name_p` for
GDB and in `TypeSystemClang::GetBasicTypeEnumeration` for lldb.

(I tested this with one translation unit defining 3 variables - `long`,
`long (*)()`, and `int (*)()`, and another translation unit that had
main, and a function that took `long (*)()` as a parameter - then
compiled them with mismatched compilers (either GCC+Clang, or
Clang+(Clang with this patch applied)) and no matter the combination,
despite the debug info for one CU naming the type "long int" and the
other naming it "long", both debuggers printed out the name as "long"
and were able to correctly perform overload resolution and pass the
`long int (*)()` variable to the `long (*)()` function parameter)

Did find one hiccup, identified by the lldb test suite - that CodeView
was relying on these names to map them to builtin types in that format.
So added some handling for that in LLVM. (these could be split out into
separate patches, but seems small enough to not warrant it - will do
that if there ends up needing any reverti/revisiting)

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

2 years ago[GlobalDCE] In VFE, replace the whole 'sub' expression of unused relative-pointer...
Kuba Mracek [Wed, 6 Oct 2021 22:55:00 +0000 (15:55 -0700)]
[GlobalDCE] In VFE, replace the whole 'sub' expression of unused relative-pointer-based vtable slots

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

2 years agoReturn failure on failure in convertBlockSignature.
Stella Laurenzo [Wed, 6 Oct 2021 20:54:13 +0000 (13:54 -0700)]
Return failure on failure in convertBlockSignature.

This was causing a subsequent assert/crash when a type converter failed to convert a block argument.

Reviewed By: rriddle

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

2 years ago[gn build] Port ccfb0555f76b
LLVM GN Syncbot [Wed, 6 Oct 2021 22:24:38 +0000 (22:24 +0000)]
[gn build] Port ccfb0555f76b

2 years ago[CUDA] Implement experimental support for texture lookups.
Artem Belevich [Wed, 8 Sep 2021 00:04:07 +0000 (17:04 -0700)]
[CUDA] Implement experimental support for texture lookups.

The patch implements header-only support for testure lookups.

The patch has been tested on a source file with all possible combinations of
argument types supported by CUDA headers, compiled and verified that the
generated instructions and their parameters match the code generated by NVCC.
Unfortunately, compiling texture code requires CUDA headers and can't be tested
in clang itself.  The test will need to be added to the test-suite later.

While generated code compiles and seems to match NVCC, I do not have any code
that uses textures that I could test correctness of the implementation. Hence
the experimental status.

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

2 years agoMore size_t -> uint64_t fixes after 05392466
Arthur Eubanks [Wed, 6 Oct 2021 22:10:37 +0000 (15:10 -0700)]
More size_t -> uint64_t fixes after 05392466

Fixes some bots where the two differ.

2 years agoAdd missing diagnostic for use of _reserved name in extern "C"
Richard Smith [Wed, 6 Oct 2021 22:11:12 +0000 (15:11 -0700)]
Add missing diagnostic for use of _reserved name in extern "C"
declaration.

Names starting with an underscore are reserved at the global scope, so
cannot be used as the name of an extern "C" symbol in any scope because
such usages conflict with a name at global scope.

2 years agoPR50644: Do not warn on a declaration of `operator"" _foo`.
Richard Smith [Wed, 6 Oct 2021 21:11:32 +0000 (14:11 -0700)]
PR50644: Do not warn on a declaration of `operator"" _foo`.

Also do not warn on `#define _foo` or `#undef _foo`.

Only global scope names starting with _[a-z] are reserved, not the use
of such an identifier in any other context.

2 years agoPR50641: Properly handle AttributedStmts when checking for a valid
Richard Smith [Wed, 6 Oct 2021 20:12:20 +0000 (13:12 -0700)]
PR50641: Properly handle AttributedStmts when checking for a valid
constexpr function body.

2 years ago[SCEV] Search operand tree for scope bound when inferring flags from IR
Philip Reames [Wed, 6 Oct 2021 22:07:10 +0000 (15:07 -0700)]
[SCEV] Search operand tree for scope bound when inferring flags from IR

When checking to see if we can apply IR flags to a SCEV, we need to identify a bound on the defining scope of the SCEV to be produced.  We'd previously added support for a couple SCEVExpr types which trivially imply bounds, but hadn't handled types such as umax where the bounds come from the bounds of the operands.  This does the obvious thing, and recurses through operands searching for a tighter bound on the defining scope.

I'm honestly surprised by how little this seems to mater on existing tests, but it's worth doing for completeness sake alone.

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

2 years agoRevert "Reland "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build""
Leonard Chan [Wed, 6 Oct 2021 22:09:15 +0000 (15:09 -0700)]
Revert "Reland "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build""

This reverts commit c52d60ec3b9202eaa9e109be539f1d2a03fbad70.

The failing scudo test came up again.

2 years agoAdd a unit test for llvm-gcc producer strings and cleanup code. (NFC)
Adrian Prantl [Wed, 6 Oct 2021 21:44:32 +0000 (14:44 -0700)]
Add a unit test for llvm-gcc producer strings and cleanup code. (NFC)

2 years agoSimplify control flow (NFC)
Adrian Prantl [Wed, 6 Oct 2021 21:30:02 +0000 (14:30 -0700)]
Simplify control flow (NFC)

2 years agoUse llvm::VersionTuple to store DWARF producer info (NFC)
Adrian Prantl [Wed, 6 Oct 2021 20:00:42 +0000 (13:00 -0700)]
Use llvm::VersionTuple to store DWARF producer info (NFC)

This has the nice side-effect that it can actually store the quadruple version numbers that Apple's tools are using nowadays.

rdar://82982162

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

2 years ago[X86] Don't use popcnt for parity if only bits 7:0 of the input can be non-zero.
Craig Topper [Wed, 6 Oct 2021 19:16:49 +0000 (12:16 -0700)]
[X86] Don't use popcnt for parity if only bits 7:0 of the input can be non-zero.

Without popcnt we had a special case for using the parity flag from a single test i8 test instruction if only bits 7:0 could be non-zero. That special case is still useful when we have popcnt.

To reach this special case, we enable custom lowering of parity for i16/i32/i64 even when popcnt is enabled. The check for POPCNT being enabled is now after the special case in LowerPARITY.

Fixes PR52093

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

2 years agoFix assert of "Unable to find base lambda address" from
Jennifer Yu [Mon, 4 Oct 2021 23:54:47 +0000 (16:54 -0700)]
Fix assert of "Unable to find base lambda address" from
adjustMemberOfForLambdaCaptures.

The problem is happening when user passes lambda function with reference
type in the map clause.

The natural of the problem when processing generateInfoForCapture,
the BasePointer is generated with new load for a lambda variable with
reference type.  It is not expected in adjustMemberOfForLambdaCaptures.

One way to fix this is to skipping call to generateInfoForCapture for
map(to:lambda).  The map info will be generated later in the call to
generateDefaultMapInfo samiler as firsprivate clase.

This to fix https://bugs.llvm.org/show_bug.cgi?id=52071

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

2 years ago[clang][Fuchsia] Add -static-libgcc to TSAN tests
Leonard Chan [Wed, 6 Oct 2021 21:00:31 +0000 (14:00 -0700)]
[clang][Fuchsia] Add -static-libgcc to TSAN tests

This will ensure that tsan tests are built with the built libunwind.a
rather than the host libunwind.so.

2 years ago[flang] Catch mismatched parentheses in prescanner
peter klausler [Thu, 30 Sep 2021 22:33:19 +0000 (15:33 -0700)]
[flang] Catch mismatched parentheses in prescanner

Source lines with mismatched parentheses are hard cases for error
recovery in parsing, and the best error message (viz.,
"here's an unmatched parenthesis") can be emitted from the
prescanner.

Differential Revision: https://reviews.llvm.org/D111254#3046173

2 years agoReland "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build"
Leonard Chan [Wed, 6 Oct 2021 20:57:24 +0000 (13:57 -0700)]
Reland "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build"

This reverts commit 95f824ad7c2da1e8142dbade4e4e12f389f1eb78.

We should've addressed the remaining issues on our CI builders.

2 years ago[compiler-rt][memprof] Disambiguate checks for __tls_get_addr in output
Leonard Chan [Wed, 6 Oct 2021 20:53:26 +0000 (13:53 -0700)]
[compiler-rt][memprof] Disambiguate checks for __tls_get_addr in output

TestCases/stress_dtls.c was failing when we ran memprof tests for the first
time. The test checks that __tls_get_addr is not in the output for the last
run when it is possible for the interceptor __interceptor___tls_get_addr to
be in the output from stack dumps. The test actually intends to check that
the various __tls_get_addr reports don't get emitted when intercept_tls_get_addr=0.
This updates the test to also check for the following `:` and preceding `==`
which should ignore the __interceptor___tls_get_addr interceptor.

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

2 years agosize_t -> uint64_t after 05392466
Arthur Eubanks [Wed, 6 Oct 2021 20:50:42 +0000 (13:50 -0700)]
size_t -> uint64_t after 05392466

Fixes some bots where the two differ.

2 years ago[libc++] [test] s/ContiguousView/MoveOnlyView/g. NFCI.
Arthur O'Dwyer [Wed, 6 Oct 2021 20:40:08 +0000 (16:40 -0400)]
[libc++] [test] s/ContiguousView/MoveOnlyView/g. NFCI.

The unique (ha!) thing about this range type is that it's move-only.
Its contiguity is unsurprising (most of our test ranges are contiguous).
Discussed in D111231 but committed separately for clarity.

2 years ago[libc++] [test] Change a lot of free begin/end pairs to members. NFCI.
Arthur O'Dwyer [Tue, 5 Oct 2021 17:31:59 +0000 (13:31 -0400)]
[libc++] [test] Change a lot of free begin/end pairs to members. NFCI.

If you have a `begin() const` member, you don't need a `begin()` member
unless you want it to do something different (e.g. have a different return
type). So in general, //view// types don't need `begin()` non-const members.

Also, static_assert some things about the types in "types.h", so that we
don't accidentally break those properties under refactoring.

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

2 years ago[clang] Add option to clear AST memory before running LLVM passes
Arthur Eubanks [Tue, 14 Sep 2021 20:09:23 +0000 (13:09 -0700)]
[clang] Add option to clear AST memory before running LLVM passes

This is to save memory for Clang compiles.
Measuring building PassBuilder.cpp under /usr/bin/time, max rss goes from 0.93GB to 0.7GB.

This does not turn it by default yet.

I've turned on the option locally and run it over a good amount of files without any issues.

For more background, see
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068930.html.

Reviewed By: dblaikie

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

2 years agoReland [IR] Increase max alignment to 4GB
Arthur Eubanks [Fri, 24 Sep 2021 22:54:17 +0000 (15:54 -0700)]
Reland [IR] Increase max alignment to 4GB

Currently the max alignment representable is 1GB, see D108661.
Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.

This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits.
We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.

The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.

Updating clang's max allowed alignment will come in a future patch.

Reviewed By: hans

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

2 years ago[gn build] Port 67231650e6ef
LLVM GN Syncbot [Wed, 6 Oct 2021 20:22:05 +0000 (20:22 +0000)]
[gn build] Port 67231650e6ef

2 years ago[lldb] [ABI/X86] Split base x86 and i386 classes
Michał Górny [Wed, 6 Oct 2021 09:45:27 +0000 (11:45 +0200)]
[lldb] [ABI/X86] Split base x86 and i386 classes

Split the ABIX86 class into two classes: base ABIX86 class that is
common to 32-bit and 64-bit ABIs, and ABIX86_i386 class that is the base
for 32-bit ABIs.  This removes the confusing concept that ABIX86
initializes 64-bit ABIs but is only the base for 32-bit ABIs.

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

2 years ago[SCEV] Avoid unnecessary domination checks (NFC)
Nikita Popov [Tue, 5 Oct 2021 21:21:25 +0000 (23:21 +0200)]
[SCEV] Avoid unnecessary domination checks (NFC)

When determining the defining scope, avoid repeatedly querying
dominationg against the function entry instruction. This ends up
begin a very common case that we can handle more efficiently.

2 years ago[NFC][X86][LoopVectorize] Autogenerate check lines in a few tests for ease of updating
Roman Lebedev [Wed, 6 Oct 2021 19:51:27 +0000 (22:51 +0300)]
[NFC][X86][LoopVectorize] Autogenerate check lines in a few tests for ease of updating

For D111220

2 years ago[libc++] Use init_priority(100) when possible
Louis Dionne [Wed, 3 Feb 2021 21:25:06 +0000 (16:25 -0500)]
[libc++] Use init_priority(100) when possible

Priorities below 101 are reserved for the implementation, so that's what
we should be using here. That is unfortunately only supported on more
recent versions of Clang. See https://reviews.llvm.org/D31413 for details.

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

2 years ago[libc++] Simplify writing testing config files
Louis Dionne [Thu, 30 Sep 2021 17:23:39 +0000 (13:23 -0400)]
[libc++] Simplify writing testing config files

Reduce code duplication by sharing most of the test suite setup across
the different from-scratch configs.

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

2 years ago[gn build] (manually) port 77d5ccdc6f460
Nico Weber [Wed, 6 Oct 2021 19:41:35 +0000 (15:41 -0400)]
[gn build] (manually) port 77d5ccdc6f460

(similar to 64f623d4c37c6)

2 years ago[APInt] Fix isAllOnes and extractBits for zero width values.
Chris Lattner [Wed, 6 Oct 2021 16:53:50 +0000 (09:53 -0700)]
[APInt] Fix isAllOnes and extractBits for zero width values.

isAllOnes() should return true for zero bit values because
there are no zeros in it.

Thanks to Jay Foad for pointing this out.

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

2 years ago[MLIR] Split arith dialect from the std dialect
Mogball [Tue, 21 Sep 2021 20:54:07 +0000 (20:54 +0000)]
[MLIR] Split arith dialect from the std dialect

Create the Arithmetic dialect that contains basic integer and floating
point arithmetic operations. Ops that did not meet this criterion were
moved to the Math dialect.

First of two atomic patches to remove integer and floating point
operations from the standard dialect. Ops will be removed from the
standard dialect in a subsequent patch.

Reviewed By: ftynse, silvas

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

2 years ago[scev] minor style improvement [nfc]
Philip Reames [Wed, 6 Oct 2021 19:15:16 +0000 (12:15 -0700)]
[scev] minor style improvement [nfc]

2 years ago[tests] precommit test changes for D111191
Philip Reames [Wed, 6 Oct 2021 19:02:44 +0000 (12:02 -0700)]
[tests] precommit test changes for D111191

2 years ago[flang] Define IEEE_SCALB, IEEE_NEXT_AFTER, IEEE_NEXT_DOWN, IEEE_NEXT_UP
peter klausler [Fri, 1 Oct 2021 21:40:40 +0000 (14:40 -0700)]
[flang] Define IEEE_SCALB, IEEE_NEXT_AFTER, IEEE_NEXT_DOWN, IEEE_NEXT_UP

These functions were missing from the standard intrinsic module
IEEE_ARITHMETIC.  IEEE_SCALB is an alias for the standard intrinsic
function SCALE(), and the others are defined as new builtin intrinsic
functions.

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

2 years agoDisable SANITIZER_CHECK_DEADLOCKS on Darwin platforms.
Dan Liew [Wed, 6 Oct 2021 16:41:51 +0000 (09:41 -0700)]
Disable SANITIZER_CHECK_DEADLOCKS on Darwin platforms.

Although THREADLOCAL variables are supported on Darwin they cannot be
used very early on during process init (before dyld has set it up).

Unfortunately the checked lock is used before dyld has setup TLS leading
to an abort call (`_tlv_boostrap()` is never supposed to be called at
runtime).

To avoid this problem `SANITIZER_CHECK_DEADLOCKS` is now disabled on
Darwin platforms. This fixes running TSan tests (an possibly other
Sanitizers) when `COMPILER_RT_DEBUG=ON`.

For reference the crashing backtrace looks like this:

```
* thread #1, stop reason = signal SIGABRT
  * frame #0: 0x00000002044da0ae dyld`__abort_with_payload + 10
    frame #1: 0x00000002044f01af dyld`abort_with_payload_wrapper_internal + 80
    frame #2: 0x00000002044f01e1 dyld`abort_with_payload + 9
    frame #3: 0x000000010c989060 dyld_sim`abort_with_payload + 26
    frame #4: 0x000000010c94908b dyld_sim`dyld4::halt(char const*) + 375
    frame #5: 0x000000010c988f5c dyld_sim`abort + 16
    frame #6: 0x000000010c96104f dyld_sim`dyld4::APIs::_tlv_bootstrap() + 9
    frame #7: 0x000000010cd8d6d2 libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::CheckedMutex::LockImpl(this=<unavailable>, pc=<unavailable>) at sanitizer_mutex.cpp:218:58 [opt]
    frame #8: 0x000000010cd8a0f7 libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::Mutex::Lock() [inlined] __sanitizer::CheckedMutex::Lock(this=0x000000010d733c90) at sanitizer_mutex.h:124:5 [opt]
    frame #9: 0x000000010cd8a0ee libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::Mutex::Lock(this=0x000000010d733c90) at sanitizer_mutex.h:162:19 [opt]
    frame #10: 0x000000010cd8a0bf libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::GenericScopedLock<__sanitizer::Mutex>::GenericScopedLock(this=0x000000030c7479a8, mu=<unavailable>) at sanitizer_mutex.h:364:10 [opt]
    frame #11: 0x000000010cd89819 libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::GenericScopedLock<__sanitizer::Mutex>::GenericScopedLock(this=0x000000030c7479a8, mu=<unavailable>) at sanitizer_mutex.h:363:67 [opt]
    frame #12: 0x000000010cd8985b libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::LibIgnore::OnLibraryLoaded(this=0x000000010d72f480, name=0x0000000000000000) at sanitizer_libignore.cpp:39:8 [opt]
    frame #13: 0x000000010cda7aaa libclang_rt.tsan_iossim_dynamic.dylib`__tsan::InitializeLibIgnore() at tsan_interceptors_posix.cpp:219:16 [opt]
    frame #14: 0x000000010cdce0bb libclang_rt.tsan_iossim_dynamic.dylib`__tsan::Initialize(thr=0x0000000110141400) at tsan_rtl.cpp:403:3 [opt]
    frame #15: 0x000000010cda7b8e libclang_rt.tsan_iossim_dynamic.dylib`__tsan::ScopedInterceptor::ScopedInterceptor(__tsan::ThreadState*, char const*, unsigned long) [inlined] __tsan::LazyInitialize(thr=0x0000000110141400) at tsan_rtl.h:665:5 [opt]
    frame #16: 0x000000010cda7b86 libclang_rt.tsan_iossim_dynamic.dylib`__tsan::ScopedInterceptor::ScopedInterceptor(this=0x000000030c747af8, thr=0x0000000110141400, fname=<unavailable>, pc=4568918787) at tsan_interceptors_posix.cpp:247:3 [opt]
    frame #17: 0x000000010cda7bb9 libclang_rt.tsan_iossim_dynamic.dylib`__tsan::ScopedInterceptor::ScopedInterceptor(this=0x000000030c747af8, thr=<unavailable>, fname=<unavailable>, pc=<unavailable>) at tsan_interceptors_posix.cpp:246:59 [opt]
    frame #18: 0x000000010cdb72b7 libclang_rt.tsan_iossim_dynamic.dylib`::wrap_strlcpy(dst="\xd2", src="0xd1d398d1bb0a007b", size=20) at sanitizer_common_interceptors.inc:7386:3 [opt]
    frame #19: 0x0000000110542b03 libsystem_c.dylib`__guard_setup + 140
    frame #20: 0x00000001104f8ab4 libsystem_c.dylib`_libc_initializer + 65
    ...
```

rdar://83723445

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

2 years agoReturning poison from a function w/ noundef return attribute is UB
Philip Reames [Wed, 6 Oct 2021 18:50:51 +0000 (11:50 -0700)]
Returning poison from a function w/ noundef return attribute is UB

This does for readability of returns within said function as what we do for the caller side when reasoning about what might be poison.

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

2 years ago[UBSAN][PS4] For the PS4 target, emit the ud2 ocpode for ubsan traps.
Wolfgang Pieb [Tue, 5 Oct 2021 17:28:46 +0000 (10:28 -0700)]
[UBSAN][PS4] For the PS4 target, emit the ud2 ocpode for ubsan traps.

Reviewed By: probinson

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

2 years ago[mlir] Fix redundant return in the void method.
rdzhabarov [Wed, 6 Oct 2021 18:22:09 +0000 (18:22 +0000)]
[mlir] Fix redundant return in the void method.

clang-tidy, fix redundant return statement at the end of the void method.

Reviewed By: jpienaar

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

2 years ago[llvm-profgen] Support symbol list for accurate profile
wlei [Thu, 30 Sep 2021 02:15:37 +0000 (19:15 -0700)]
[llvm-profgen] Support symbol list for accurate profile

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

2 years agoRevert "Reland [IR] Increase max alignment to 4GB"
Arthur Eubanks [Wed, 6 Oct 2021 18:35:27 +0000 (11:35 -0700)]
Revert "Reland [IR] Increase max alignment to 4GB"

This reverts commit 8d64314ffea55f2ad94c1b489586daa8ce30f451.

2 years agoUpdate some types after D110451
Arthur Eubanks [Wed, 6 Oct 2021 18:27:21 +0000 (11:27 -0700)]
Update some types after D110451

To fix mismatched size_t vs uint64_t on some platforms.

2 years ago[PowerPC] Fix issue with lowering byval parameters.
Stefan Pintilie [Wed, 22 Sep 2021 16:44:55 +0000 (11:44 -0500)]
[PowerPC] Fix issue with lowering byval parameters.

Lowering of byval parameters with sizes that are not represented by a single
store require multiple stores to properly address the correct size of the
parameter.

Sizes that cannot be done with a single store are 3 bytes, 5 bytes, 6 bytes,
7 bytes. It is not correct to simply perform an 8 byte store and for these
elements because then the store would be larger than the element and alias
analysis would assume that this is undefined behaivour and return NoAlias
for them.

This patch adds the correct stores so that the size of the store is not larger
than the size of the element.

Reviewed By: nemanjai, #powerpc

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

2 years ago[libc++] Implement P1391 for string_view
Joe Loser [Wed, 6 Oct 2021 18:17:02 +0000 (14:17 -0400)]
[libc++] Implement P1391 for string_view

Implement P1391 (https://wg21.link/p1391) which allows
`std::string_view` to be constructible from any contiguous range of
characters.

Note that a different paper (http://wg21.link/P1989) handles the generic
range constructor for `std::string_view`.

Reviewed By: ldionne, Quuxplusone, Mordante, #libc

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

2 years ago[SCEV] Infer flags from add/gep in any block
Philip Reames [Wed, 6 Oct 2021 17:35:01 +0000 (10:35 -0700)]
[SCEV] Infer flags from add/gep in any block

This patch removes a compile time restriction from isSCEVExprNeverPoison. We've strengthened our ability to reason about flags on scopes other than addrecs, and this bailout prevents us from using it. The comment is also suspect as well in that we're in the middle of constructing a SCEV for I. As such, we're going to visit all operands *anyways*.

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

2 years ago[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_NE for generic smulo/umulo...
Simon Pilgrim [Wed, 6 Oct 2021 17:49:03 +0000 (18:49 +0100)]
[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_NE for generic smulo/umulo cost expansion

Match the predicate used in TargetLowering::expandMULO to detect overflow

2 years ago[CostModel][TTI] Fix ops used for generic smulo/umulo cost expansion
Simon Pilgrim [Wed, 6 Oct 2021 17:30:05 +0000 (18:30 +0100)]
[CostModel][TTI] Fix ops used for generic smulo/umulo cost expansion

Fix copy+pasta that was checking for smul_fix instead of smul_with_overflow to detected signed values.

The LShr is performed on the extended type as we use it to truncate+extract the upper/hi bits of the extended multiply.

More closely matches the default expansion from TargetLowering::expandMULO

2 years ago[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_ULT/UGT for generic uadd/usubo...
Simon Pilgrim [Wed, 6 Oct 2021 16:23:14 +0000 (17:23 +0100)]
[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_ULT/UGT for generic uadd/usubo cost expansion

Match the predicates used in TargetLowering::expandUADDSUBO

2 years ago[compiler-rt][test] Add shared_unwind requirement
Leonard Chan [Wed, 6 Oct 2021 18:09:29 +0000 (11:09 -0700)]
[compiler-rt][test] Add shared_unwind requirement

When using a static libunwind, the check_memcpy.c can fail because it checks
that tsan intercepted all memcpy/memmoves in the final binary. Though if the
static libunwind is not instrumented, then this will fail because it may contain
regular memcpy/memmoves.

This adds a new REQUIRES check for ensuring that this test won't run unless a
dynamic libunwind.so is provided.

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

2 years agoReland [IR] Increase max alignment to 4GB
Arthur Eubanks [Fri, 24 Sep 2021 22:54:17 +0000 (15:54 -0700)]
Reland [IR] Increase max alignment to 4GB

Currently the max alignment representable is 1GB, see D108661.
Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.

This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits.
We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.

The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.

Updating clang's max allowed alignment will come in a future patch.

Reviewed By: hans

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

2 years ago[X86] Add X86 and X64 prefixes to parity.ll to reduce duplicate check lines. NFC
Craig Topper [Wed, 6 Oct 2021 17:56:52 +0000 (10:56 -0700)]
[X86] Add X86 and X64 prefixes to parity.ll to reduce duplicate check lines. NFC

2 years ago[gn build] Port 10f16bc7b2bf
LLVM GN Syncbot [Wed, 6 Oct 2021 17:59:12 +0000 (17:59 +0000)]
[gn build] Port 10f16bc7b2bf

2 years agoRevert "[lldb] [ABI/X86] Split base x86 and i386 classes"
Stella Stamenova [Wed, 6 Oct 2021 17:56:45 +0000 (10:56 -0700)]
Revert "[lldb] [ABI/X86] Split base x86 and i386 classes"

This change broke the windows lldb bot.

This reverts commit a30a36f66aea459337999a000c7997b220b25227.

2 years ago[FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X
Kevin P. Neal [Wed, 6 Oct 2021 17:49:24 +0000 (13:49 -0400)]
[FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X

Currently the fadd optimizations in InstSimplify don't know how to do this
"X + -0.0 ==> X" fold when using the constrained intrinsics. This adds the
support.

This commit is derived from D106362 with some improvements from D107285.

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

2 years ago[Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and include...
Fangrui Song [Wed, 6 Oct 2021 17:49:25 +0000 (10:49 -0700)]
[Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and include/x86_64-linux-gnu/c++/v1 tests

2 years ago[sanitizer] Switch to StackDepotNode to 64bit hash
Vitaly Buka [Tue, 5 Oct 2021 20:49:31 +0000 (13:49 -0700)]
[sanitizer] Switch to StackDepotNode to 64bit hash

Now we can avoid scanning the stack on fast path.
The price is the false stack trace with probability of the hash collision.
This increase performance of lsan by 6% and pre-requirement for stack compression.

Depends on D111182.

Reviewed By: morehouse, dvyukov

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