platform/upstream/llvm.git
2 years ago[libc] Re-enable thrd_test.
Siva Chandra Reddy [Mon, 10 Jan 2022 05:51:30 +0000 (05:51 +0000)]
[libc] Re-enable thrd_test.

Other threads related tests have been using the API that is tested here
without any problems. The main reason for disabling the test has also been
fixed many months ago.

2 years ago[lldb] Skip TestVSCode_coreFile if no x86 target support
Dave Lee [Mon, 10 Jan 2022 06:01:02 +0000 (22:01 -0800)]
[lldb] Skip TestVSCode_coreFile if no x86 target support

2 years ago[lldb] Remove reproducer instrumentation
Jonas Devlieghere [Sat, 8 Jan 2022 00:26:40 +0000 (16:26 -0800)]
[lldb] Remove reproducer instrumentation

This patch removes most of the reproducer instrumentation. It keeps
around the LLDB_RECORD_* macros for logging. See [1] for more details.

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

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

2 years ago[lldb] Guard libstdc++ specific 'frame var' test
Dave Lee [Sun, 9 Jan 2022 23:01:53 +0000 (15:01 -0800)]
[lldb] Guard libstdc++ specific 'frame var' test

While working on D116788 (properly error out of `frame var`), this libstdc++
specific `frame var` invocation was found in the tests. This test is in the
generic directory, but has this one case that requires libstdc++. The fix here
is to put the one `expect()` inside of a condition that checks for libstdc++.

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

2 years ago[lldb] Check for arm64 in TestDisassembleRawData
Dave Lee [Mon, 10 Jan 2022 04:10:38 +0000 (20:10 -0800)]
[lldb] Check for arm64 in TestDisassembleRawData

This test checks for `aarch64` but the lit config could also contain `arm64`.
This change adds `arm64` to make the test pass in all cases.

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

2 years ago[lldb] Require x86 support for dwo-relative-path test
Dave Lee [Mon, 10 Jan 2022 05:29:39 +0000 (21:29 -0800)]
[lldb] Require x86 support for dwo-relative-path test

2 years ago[RISCV] Isel (sra (sext_inreg X, i16), C) -> (srai (slli X, (XLen-16), (XLen-16)...
Craig Topper [Mon, 10 Jan 2022 03:55:13 +0000 (19:55 -0800)]
[RISCV] Isel (sra (sext_inreg X, i16), C) -> (srai (slli X, (XLen-16), (XLen-16) + C).

Similar for (sra (sext_inreg X, i8), C).

With Zbb, sext_inreg of i8 and i16 are legal for sext.b and sext.h.
This transform makes the Zbb codegen the same as without Zbb. The
shifts are more compressible. This also exposes an opportunity for
CSE with another slli in the i16 sdiv by constant codegen.

2 years ago[lld][ELF] Support adrp+ldr GOT optimization for AArch64
Alexander Shaposhnikov [Mon, 10 Jan 2022 05:20:37 +0000 (05:20 +0000)]
[lld][ELF] Support adrp+ldr GOT optimization for AArch64

This diff adds first bits to support relocation relaxations for AArch64
discussed on https://github.com/ARM-software/abi-aa/pull/106.
In particular, the case of

adrp x0, :got: symbol
ldr x0, [x0, :got_lo12: symbol]

is handled.

Test plan: make check-all

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

2 years ago[RISCV] Disable EEW=64 for index values when XLEN=32.
jacquesguan [Thu, 22 Jul 2021 03:40:31 +0000 (11:40 +0800)]
[RISCV] Disable EEW=64 for index values when XLEN=32.

Disable EEW=64 for vector index load/store when XLEN=32.

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

2 years agoControl-flow Enforcement Technology (CET), published by Intel, introduces
jinge90 [Mon, 10 Jan 2022 01:23:28 +0000 (09:23 +0800)]
Control-flow Enforcement Technology (CET), published by Intel, introduces
indirect branch tracking(IBT) feature aiming to ensure the target address
of an indirect jump/call is not tampered.
When IBT is enabled, each function or target of any indirect jump/call will start
with an 'endbr32/64' instruction otherwise the program will crash during execution.
To build an application with CET enabled. we need to ensure:

  1. build the source code with "-fcf-protection=full"
  2. all the libraries linked with .o files must be CET enabled too

This patch aims to enable CET for compiler-rt builtins library, we add an option
"COMPILER_RT_ENABLE_CET" whose default value is OFF to enable CET for compiler-rt
in building time and when this option is "ON", "-fcf-protection=full" is added to
BUILTINS_CFLAG and the "endbr32/64" will be placed in the beginning of each assembly
function. We also enabled CET for crtbegin, crtend object files in this patch.

Reviewed by: MaskRay, compnerd, manojgupta, efriedma
Differential Revision: https://reviews.llvm.org/D109811

Signed-off-by: jinge90 <ge.jin@intel.com>
2 years ago[Builtins] Add missing the macro 'y' description in comments
Jim Lin [Mon, 10 Jan 2022 01:43:20 +0000 (09:43 +0800)]
[Builtins] Add missing the macro 'y' description in comments

New type str 'y' added from D76077. But missed its description in
comments.

Reviewed By: stuij

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

2 years ago[RISCV] Fold (srl (and X, 0xffff), C)->(srli (slli X, (XLen-16), (XLen-16) + C) even...
Craig Topper [Mon, 10 Jan 2022 02:15:49 +0000 (18:15 -0800)]
[RISCV] Fold (srl (and X, 0xffff), C)->(srli (slli X, (XLen-16), (XLen-16) + C) even with Zbb/Zbp.

We can use zext.h with Zbb, but srli/slli may offer more opportunities
for compression.

2 years ago[yaml2obj][XCOFF] parsing auxiliary symbols.
Esme-Yi [Mon, 10 Jan 2022 02:38:49 +0000 (02:38 +0000)]
[yaml2obj][XCOFF] parsing auxiliary symbols.

Summary: The patch adds support for yaml2obj parsing auxiliary
symbols for XCOFF. Since the test cases of this patch are
interdependent with D113825 ([llvm-readobj][XCOFF] dump
auxiliary symbols), test cases of this patch will be committed
after D113825 is committed.

Reviewed By: jhenderson, DiggerLin

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

2 years ago[PowerPC] fast isel can lower intrinsics call on AIX.
Chen Zheng [Tue, 30 Nov 2021 08:34:05 +0000 (08:34 +0000)]
[PowerPC] fast isel can lower intrinsics call on AIX.

Reviewed By: qiucf

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

2 years ago[SelectionDAG] Add FP_TO_UINT_SAT/FP_TO_SINT_SAT to computeKnownBits/computeNumSignBits.
Craig Topper [Mon, 10 Jan 2022 01:28:04 +0000 (17:28 -0800)]
[SelectionDAG] Add FP_TO_UINT_SAT/FP_TO_SINT_SAT to computeKnownBits/computeNumSignBits.

These nodes should saturate to their saturating VT. We can use this
information to know the bits past the VT are all zeros or all sign bits.

I think we might only have test coverage for the unsigned case. I'll
verify and add tests.

Reviewed By: nikic

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

2 years ago[CodeGen] Rename emitCalleeSavedFrameMoves
Alexander Shaposhnikov [Mon, 10 Jan 2022 01:27:11 +0000 (01:27 +0000)]
[CodeGen] Rename emitCalleeSavedFrameMoves

This diff renames emitCalleeSavedFrameMoves to avoid conflicts with
non-virtual methods of derived classes having the same name but different semantics.
E.g. the class AArch64FrameLowering used to have (non-virtual) "emitCalleeSavedFrameMoves"
but it started to override TargetFrameLowering::emitCalleeSavedFrameMoves after
https://github.com/llvm/llvm-project/commit/c3e6555616 though its usage and semantics didn't change.
P.S. for x86 there was no conflict because the signature of
non-virtual X86FrameLowering::emitCalleeSavedFrameMoves is different

Test plan: make check-all

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

2 years agoApply clang-tidy fixes for performance-move-const-arg in ReductionNode.cpp (NFC)
Mehdi Amini [Sat, 8 Jan 2022 22:13:51 +0000 (22:13 +0000)]
Apply clang-tidy fixes for performance-move-const-arg in ReductionNode.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp...
Mehdi Amini [Sat, 8 Jan 2022 21:26:54 +0000 (21:26 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in ModuleBufferization.cpp...
Mehdi Amini [Sat, 8 Jan 2022 21:21:42 +0000 (21:21 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in ModuleBufferization.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-equals-default in IRCore.cpp (NFC)
Mehdi Amini [Sat, 8 Jan 2022 20:37:39 +0000 (20:37 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in IRCore.cpp (NFC)

2 years agoRevert "[lldb] Set result error state in 'frame variable'"
Dave Lee [Sun, 9 Jan 2022 22:12:47 +0000 (14:12 -0800)]
Revert "[lldb] Set result error state in 'frame variable'"

This reverts commit 2bcff220bf1e372e91491911fe0bb76c4c4bbef8.

2 years ago[ELF] Move gotIndex/pltIndex/globalDynIndex to SymbolAux
Fangrui Song [Sun, 9 Jan 2022 21:43:26 +0000 (13:43 -0800)]
[ELF] Move gotIndex/pltIndex/globalDynIndex to SymbolAux

to decrease sizeof(SymbolUnion) by 8 on ELF64 platforms.

Symbols needing such information are typically 1% or fewer (5134 out of 560520
when linking clang, 19898 out of 5550705 when linking chrome). Storing them
elsewhere can decrease memory usage and symbol initialization time.
There is a ~0.8% saving on max RSS when linking a large program.

Future direction:

* Move some of dynsymIndex/verdefIndex/versionId to SymbolAux
* Support mixed TLSDESC and TLS GD without increasing sizeof(SymbolUnion)

Reviewed By: peter.smith

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

2 years ago[lldb] Set result error state in 'frame variable'
Dave Lee [Fri, 7 Jan 2022 03:38:31 +0000 (19:38 -0800)]
[lldb] Set result error state in 'frame variable'

Ensure that errors in `frame variable` are reflected in result object.

The statistics for `frame variable` show invocations as being successful, even
when executing one of the error paths.

This change replaces `result.GetErrorStream()` with `result.AppendError()`,
which also sets the status to `eReturnStatusFailed`.

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

(cherry picked from commit 2c7d10c41278181e3e45c68f28b501cd95193a8a)

2 years ago[lldb][docs] Update references to SVN
Dave Lee [Sun, 9 Jan 2022 20:42:52 +0000 (12:42 -0800)]
[lldb][docs] Update references to SVN

2 years agoUse true/false instead of 1/0 (NFC)
Kazu Hirata [Sun, 9 Jan 2022 20:21:06 +0000 (12:21 -0800)]
Use true/false instead of 1/0 (NFC)

Identified by modernize-use-bool-literals.

2 years ago[lldb] Remove redundant member initialization (NFC)
Kazu Hirata [Sun, 9 Jan 2022 20:21:04 +0000 (12:21 -0800)]
[lldb] Remove redundant member initialization (NFC)

2 years agoFix bugprone argument comments.
Kazu Hirata [Sun, 9 Jan 2022 20:21:02 +0000 (12:21 -0800)]
Fix bugprone argument comments.

Identified by bugprone-argument-comment.

2 years ago[clang] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 9 Jan 2022 20:21:00 +0000 (12:21 -0800)]
[clang] Remove unused forward declarations (NFC)

2 years ago[lldb] Compute fully qualified command names in FindCommandsForApropos
Dave Lee [Sun, 2 Jan 2022 04:07:07 +0000 (20:07 -0800)]
[lldb] Compute fully qualified command names in FindCommandsForApropos

Fixes incomplete command names in `apropos` results.

The full command names given by `apropos` have come from command name string
literals given to `CommandObject` constructors. For most commands, this has
been accurate, but some commands have incorrect strings. This results in
`apropos` output that doesn't tell the user the full command name they might
want learn more about. These strings can be fixed.

There's a seperate issue that can't be fixed as easily: plugin commands. With
the way they're implemented, plugin commands have to exclude the root command
from their command name string. To illustrate, the `language objc` subcommand
has to set its command name string to "objc", which results in apropos printing
results as `objc ...` instead of `language objc ...`.

To fix both of these issues, this commit changes `FindCommandsForApropos` to
derive the fully qualified command name using the keys of subcommand maps.

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

(cherry picked from commit b3bfd595a548cd85b12e4e83729436cb73b26f29)

2 years ago[lldb] Remove ProcessStructReader from NSStringSummaryProvider (NFC)
Dave Lee [Thu, 30 Dec 2021 22:41:27 +0000 (14:41 -0800)]
[lldb] Remove ProcessStructReader from NSStringSummaryProvider (NFC)

Simplify getting the length of `NSPathStore2` strings.

`NSStringSummaryProvider` uses a single field from `NSPathStore2` instances,
its first ivar: `_lengthAndRefCount`. This change uses
`GetSyntheticChildAtOffset` to replace the use of `ProcessStructReader`, and
removes the hard coded `CompilerType` definition of `NSPathStore2`.

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

2 years ago[mlir][MemRef] NFC - Improve assertion error message
Nicolas Vasilache [Sun, 9 Jan 2022 19:17:28 +0000 (14:17 -0500)]
[mlir][MemRef] NFC - Improve assertion error message

2 years ago[Attributor][FIX] Remove assumption that doesn't have to hold
Johannes Doerfert [Sun, 9 Jan 2022 03:11:51 +0000 (21:11 -0600)]
[Attributor][FIX] Remove assumption that doesn't have to hold

There is no guarantee we strip all GEPOperators and the conservative
handling doesn't even require us to.

2 years ago[mlir][Bufferize] NFC - Introduce areCastCompatible assertions to catch misformed...
Nicolas Vasilache [Sun, 9 Jan 2022 16:51:58 +0000 (11:51 -0500)]
[mlir][Bufferize] NFC - Introduce areCastCompatible assertions to catch misformed CastOp early

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

2 years ago[SCEVExpander] Simplify cleanup, skip sorting by dominance.
Florian Hahn [Sun, 9 Jan 2022 18:38:41 +0000 (18:38 +0000)]
[SCEVExpander] Simplify cleanup, skip sorting by dominance.

There is no need to sort inserted instructions by dominance, as the
deletion loop still requires RAUW with undef before deleting. Removing
instructions in reverse insertion order should still insure that the
number of uselist updates is kept to a minimum.

2 years ago[AIX] Disable tests that fail because of no 64-bit XCOFF object file support
Jake Egan [Sun, 9 Jan 2022 17:20:38 +0000 (12:20 -0500)]
[AIX] Disable tests that fail because of no 64-bit XCOFF object file support

The modified tests fail because 64-bit XCOFF object files are not currently supported on AIX. This patch disables these tests on 64-bit AIX for now.

This patch is similar to D111887 except the failures on this patch are on a 64-bit build.

Reviewed By: shchenz, #powerpc

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

2 years ago[x86] exclude "X==0 ? Y :-1" from math/logic transform
Sanjay Patel [Sun, 9 Jan 2022 13:59:48 +0000 (08:59 -0500)]
[x86] exclude "X==0 ? Y :-1" from math/logic transform

This is the last step in a series to improve lowering
via "SBB" asm:
68defc0134
aab1f55e33
...and fixes #53006

2 years ago[SCEVExpander] Only check overflow if it is needed.
Florian Hahn [Thu, 6 Jan 2022 21:13:04 +0000 (21:13 +0000)]
[SCEVExpander] Only check overflow if it is needed.

9345ab3a4550 updated generateOverflowCheck to skip creating checks that
always evaluate to false. This in turn means that we only need to check
for overflows if the result of the multiplication is actually used.

Sink the Or for the overflow check into ComputeEndCheck, so it is only
created when there's an actual check.

2 years ago[InstCombine] (~A | B) & (A ^ B) -> ~A & B
Sanjay Patel [Sun, 9 Jan 2022 11:17:11 +0000 (06:17 -0500)]
[InstCombine] (~A | B) & (A ^ B) -> ~A & B

This is part of a set of 2-variable logic optimizations
suggested here:
https://lists.llvm.org/pipermail/llvm-dev/2021-December/154470.html

The 'not' op must not propagate undef elements of a vector,
so this patch creates a new 'full' not, but I am not counting
that as an extra-use restriction because it should get folded
with the existing value by CSE.

https://alive2.llvm.org/ce/z/7v65im

2 years ago[InstCombine] add tests for and(orn, xor); NFC
Sanjay Patel [Fri, 7 Jan 2022 19:40:55 +0000 (14:40 -0500)]
[InstCombine] add tests for and(orn, xor); NFC

2 years ago[x86] use SETCC_CARRY instead of SBB node for select lowering
Sanjay Patel [Fri, 7 Jan 2022 18:35:59 +0000 (13:35 -0500)]
[x86] use SETCC_CARRY instead of SBB node for select lowering

This is a suggested follow-up to D116765.
This removes a clear of the register operand, so it is better
for code size, but it does potentially create a false register
dependency on surrounding code. If that is a problem, it should
be solvable using dependency-breaking code that is used for
other instructions.

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

2 years ago[clang] Remove redundant member initialization (NFC)
Kazu Hirata [Sun, 9 Jan 2022 08:19:51 +0000 (00:19 -0800)]
[clang] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years ago[clang] Fix bugprone argument comments (NFC)
Kazu Hirata [Sun, 9 Jan 2022 08:19:49 +0000 (00:19 -0800)]
[clang] Fix bugprone argument comments (NFC)

Identified with bugprone-argument-comment.

2 years ago[clang] Use true/false instead of 1/0 (NFC)
Kazu Hirata [Sun, 9 Jan 2022 08:19:47 +0000 (00:19 -0800)]
[clang] Use true/false instead of 1/0 (NFC)

Identified with modernize-use-bool-literals.

2 years ago[libcxx][test] `_VSTD` doesn't belong in test code
Casey Carter [Wed, 29 Dec 2021 22:31:23 +0000 (14:31 -0800)]
[libcxx][test] `_VSTD` doesn't belong in test code

2 years ago[OpenMP][FIX] Emit debug declares only if debug info is available
Johannes Doerfert [Sat, 8 Jan 2022 19:53:39 +0000 (13:53 -0600)]
[OpenMP][FIX] Emit debug declares only if debug info is available

The `EmitDeclareOfAutoVariable` introduced in D114504 and D115510 has a
precondition that cannot be violated. It is unclear if we should call it
directly given the sparse usage in clang but for now we should at least
not crash if the debug info kind is too low.

Fixes #52938.

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

2 years ago[Attributor][FIX] Ensure order for multiple references into map
Johannes Doerfert [Sat, 8 Jan 2022 18:17:04 +0000 (12:17 -0600)]
[Attributor][FIX] Ensure order for multiple references into map

If we have multiple references into a map we need to ensure the ones
created late do not invalidate the ones created early. To do that we
need to make sure all but the first are not modifying the map, hence
for them the keys have to be present already.

Fixes #52875.

2 years ago[RISCV] Add i8/i16 fptosi/fptoui and fptosi_sat/fptoui_sat tests. NFC
Craig Topper [Sat, 8 Jan 2022 21:56:40 +0000 (13:56 -0800)]
[RISCV] Add i8/i16 fptosi/fptoui and fptosi_sat/fptoui_sat tests. NFC

Use signext/zeroext return attributes to show unnecessary ands or
shifts in the saturating tests.

2 years ago[fir] Correct and reenable test that was removed by MLIR.
Eric Schweitz [Fri, 7 Jan 2022 23:45:18 +0000 (15:45 -0800)]
[fir] Correct and reenable test that was removed by MLIR.

See https://github.com/llvm/llvm-project/issues/53064

The original test required a cast to be correct.
Correct the CHECK lines. Prune unused ones.

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

2 years ago[libc++] [test] Remove `UNSUPPORTED: stdlib=msvc` from lock.pass.cpp.
Arthur O'Dwyer [Thu, 6 Jan 2022 00:31:24 +0000 (19:31 -0500)]
[libc++] [test] Remove `UNSUPPORTED: stdlib=msvc` from lock.pass.cpp.

Casey Carter says, "We run std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
on every CI and it works fine with MSVC STL. I'm guessing this annotation predates
Billy's rewrite of std::lock in 2017-ish."

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

2 years ago[RISCV] Add nounwind to remove some cfi directives from test CHECKs. NFC
Craig Topper [Sat, 8 Jan 2022 20:38:43 +0000 (12:38 -0800)]
[RISCV] Add nounwind to remove some cfi directives from test CHECKs. NFC

2 years ago[LV] Improve check lines in existing tests.
Florian Hahn [Sat, 8 Jan 2022 20:46:31 +0000 (20:46 +0000)]
[LV] Improve check lines in existing tests.

Update the check lines in 2 existing tests to use patterns + variables
to match some IR to make them independent of value naming.

2 years ago[RISCV] Add nounwind to remove some cfi directives from test CHECKs. NFC
Craig Topper [Sat, 8 Jan 2022 20:27:46 +0000 (12:27 -0800)]
[RISCV] Add nounwind to remove some cfi directives from test CHECKs. NFC

2 years ago[docs] Fix documentation of -fno-strict-float-cast-overflow after D115804.
Craig Topper [Sat, 8 Jan 2022 19:10:05 +0000 (11:10 -0800)]
[docs] Fix documentation of -fno-strict-float-cast-overflow after D115804.

Previously this was documented as having the behavior of the
"target's native float-to-int conversion". After D115804, clang
uses saturating FP cast intrinsics which have the same behavior
on all targets.

Reviewed By: nikic

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

2 years agoFix clang-tidy readability-redundant-smartptr-get in MLIR ModuleTranslation.cpp ...
Mehdi Amini [Sat, 8 Jan 2022 20:06:50 +0000 (20:06 +0000)]
Fix clang-tidy readability-redundant-smartptr-get in MLIR ModuleTranslation.cpp (NFC)

2 years agoEnable readability-redundant-smartptr-get in MLIR local clang-tidy config
Mehdi Amini [Sat, 8 Jan 2022 19:23:16 +0000 (19:23 +0000)]
Enable readability-redundant-smartptr-get in MLIR local clang-tidy config

2 years ago[llvm] Remove redundant member initialization (NFC)
Kazu Hirata [Sat, 8 Jan 2022 19:56:44 +0000 (11:56 -0800)]
[llvm] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years agoRemove duplicate forward declarations (NFC)
Kazu Hirata [Sat, 8 Jan 2022 19:56:42 +0000 (11:56 -0800)]
Remove duplicate forward declarations (NFC)

2 years ago[clang] Remove unused forward declarations (NFC)
Kazu Hirata [Sat, 8 Jan 2022 19:56:40 +0000 (11:56 -0800)]
[clang] Remove unused forward declarations (NFC)

2 years ago[llvm] Fix bugprone argument comments (NFC)
Kazu Hirata [Sat, 8 Jan 2022 19:56:38 +0000 (11:56 -0800)]
[llvm] Fix bugprone argument comments (NFC)

Identified with bugprone-argument-comment.

2 years ago[instcombine] Key deref vs deref_or_null annotation of allocation sites off nonnull...
Philip Reames [Sat, 8 Jan 2022 18:29:09 +0000 (10:29 -0800)]
[instcombine] Key deref vs deref_or_null annotation of allocation sites off nonnull attribute

Goal is to remove use of isOpNewLike.  I looked at a couple approaches to this, and this turned out to be the cheapest one.  Just letting deref_or_null be generated causes a bunch of test diffs, and I couldn't convince myself there wasn't a real regression somewhere.  A generic instcombine to convert deref_or_null + nonnull to deref is annoying complicated since you have to mix facts from callsite and declaration while manipulating only existing call site attributes.  It just wasn't worth the code complexity.

Note that the change in new-delete-itanium.ll is a real regression.  If you have a callsite which overrides the builtin status of a nobuiltin declaration, *and* you don't put the apppriate attributes on that callsite, you may lose the deref fact.  I decided this didn't matter; if anyone disagrees, you can add this case to the generic non-null inference.

2 years ago[libc++] [ranges] Add namespace __cpo to ranges::{advance,next,prev}.
Arthur O'Dwyer [Tue, 4 Jan 2022 01:49:24 +0000 (20:49 -0500)]
[libc++] [ranges] Add namespace __cpo to ranges::{advance,next,prev}.

The reason for those nested namespaces is explained in D115315:

> AIUI, this keeps the CPO's own type from ADL'ing into the `std::ranges`
> namespace; e.g. `foobar(std::ranges::uninitialized_default_construct)`
> should not consider `std::ranges::foobar` a candidate, even if
> `std::ranges::foobar` is not a CPO itself. Also, of course, consistency
> (Chesterton's Fence, the economist's hundred-dollar bill): if it were
> safe to omit the namespace, we'd certainly want to do it everywhere,
> not just here.

This makes these three niebloids more consistent with the other Ranges
niebloids we've already implemented, such as the `ranges::begin` group
and the `ranges::uninitialized_default_construct` group.

FWIW, we still have three different indentation-and-comment styles
among these three groups.

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

2 years agoRevert "[lldb] Set result error state in 'frame variable'"
Dave Lee [Sat, 8 Jan 2022 17:35:13 +0000 (09:35 -0800)]
Revert "[lldb] Set result error state in 'frame variable'"

This reverts commit 2c7d10c41278181e3e45c68f28b501cd95193a8a.

2 years ago[lldb] Set result error state in 'frame variable'
Dave Lee [Fri, 7 Jan 2022 03:38:31 +0000 (19:38 -0800)]
[lldb] Set result error state in 'frame variable'

Ensure that errors in `frame variable` are reflected in result object.

The statistics for `frame variable` show invocations as being successful, even
when executing one of the error paths.

This change replaces `result.GetErrorStream()` with `result.AppendError()`,
which also sets the status to `eReturnStatusFailed`.

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

2 years ago[CGObjCMac] Use castAs<> instead of getAs<> to avoid dereference of nullptr inside...
Simon Pilgrim [Sat, 8 Jan 2022 16:18:46 +0000 (16:18 +0000)]
[CGObjCMac] Use castAs<> instead of getAs<> to avoid dereference of nullptr inside BuildRCBlockVarRecordLayout

This will assert the cast is correct instead of returning nullptr (UnionType is a subtype of RecordType so this should be clean).

2 years ago[LSR] Auto-generate check lines for test.
Florian Hahn [Sat, 8 Jan 2022 15:44:52 +0000 (15:44 +0000)]
[LSR] Auto-generate check lines for test.

Checking the full output provides more context and makes it easier to
review changes to the test in a follow-up patch.

2 years ago[LoopUnroll] Make test more robust by removing undef.
Florian Hahn [Sat, 8 Jan 2022 15:43:30 +0000 (15:43 +0000)]
[LoopUnroll] Make test more robust by removing undef.

Replace a uses of undef in the tests. The undef causes runtime checks
to be trivially fold/removeable, which does defeat the purpose of the test.

2 years ago[LV] Make tests more robust by removing undef.
Florian Hahn [Fri, 7 Jan 2022 22:06:22 +0000 (22:06 +0000)]
[LV] Make tests more robust by removing undef.

Replace some uses of undef in the tests. The undef causes runtime checks
to be trivially fold/removeable, which does defeat the purpose of the tests.

2 years ago[X86] LowerRotate - enable ROTL vXi16 rotate-by-splat-amount on pre-AVX targets
Simon Pilgrim [Sat, 8 Jan 2022 14:57:00 +0000 (14:57 +0000)]
[X86] LowerRotate - enable ROTL vXi16 rotate-by-splat-amount on pre-AVX targets

To enable this on all targets there's still a number of regressions due to getSplatValue/getTargetVShiftNode but these don't really affect pre-AVX targets.

2 years ago[DivergenceAnalysis] Simplify inRegion test based on whether the RegionLoop pointer...
Simon Pilgrim [Sat, 8 Jan 2022 14:30:10 +0000 (14:30 +0000)]
[DivergenceAnalysis] Simplify inRegion test based on whether the RegionLoop pointer is null or not

More closely matches the documentation

Requested by @nikic

2 years ago[CGExpr] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Simon Pilgrim [Sat, 8 Jan 2022 14:26:09 +0000 (14:26 +0000)]
[CGExpr] Use castAs<> instead of getAs<> to avoid dereference of nullptr

This will assert the cast is correct instead of returning nullptr

2 years ago[DivergenceAnalysis] Fix static analyzer warning about dereference of nullptr
Simon Pilgrim [Sat, 8 Jan 2022 13:57:33 +0000 (13:57 +0000)]
[DivergenceAnalysis] Fix static analyzer warning about dereference of nullptr

We're testing that the RegionLoop pointer is null in the first part of the check, so we need to check that its non-null before dereferencing it in a later part of the check.

2 years ago[OpenMPOpt] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC
Simon Pilgrim [Sat, 8 Jan 2022 13:47:35 +0000 (13:47 +0000)]
[OpenMPOpt] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC

2 years ago[X86][SSE] Add initial FSHL/FSHR vXi8 lowering support
Simon Pilgrim [Sat, 8 Jan 2022 12:19:25 +0000 (12:19 +0000)]
[X86][SSE] Add initial FSHL/FSHR vXi8 lowering support

This is very similar to the existing ROTL/ROTR support for scalar shifts in LowerRotate, I think as time goes on we should be able to share much of this code in helpers between Funnel Shift + Rotation lowering.

2 years agoMultiple fixes to affine loop tiling return status and checks
Uday Bondhugula [Mon, 27 Dec 2021 19:12:14 +0000 (00:42 +0530)]
Multiple fixes to affine loop tiling return status and checks

Fix crash in the presence of yield values. Multiple fixes to affine loop
tiling pre-condition checks and return status. Do not signal pass
failure on a failure to tile since the IR is still valid. Detect index
set computation failure in checkIfHyperrectangular and return failure.
Replace assertions with proper status return. Move checks to an
appropriate place earlier in the utility before mutation happens.

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

2 years ago[SCEVExpander] Skip creating <u 0 check, which is always false.
Florian Hahn [Sat, 8 Jan 2022 10:29:19 +0000 (10:29 +0000)]
[SCEVExpander] Skip creating <u 0 check, which is always false.

Unsigned compares of the form <u 0 are always false. Do not create such
a redundant check in generateOverflowCheck.

The patch introduces a new lambda to create the check, so we can
exit early conveniently and skip creating some instructions feeding the
check.

I am planning to sink a few additional instructions as follow-ups, but I
would prefer to do this separately, to keep the changes and diff
smaller.

Reviewed By: reames

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

2 years ago[MLIR][NFC] Move PresburgerSet to Presburger/ directory
Groverkss [Sat, 8 Jan 2022 10:08:30 +0000 (15:38 +0530)]
[MLIR][NFC] Move PresburgerSet to Presburger/ directory

This patch moves PresburgerSet to Presburger/ directory. This patch is purely
mechincal, it only moves and renames functionality and tests.

This patch is part of a series of patches to move presburger functionality to
Presburger/ directory.

Reviewed By: arjunp

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

2 years ago[GlobalISel] Use getPreferredShiftAmountTy in one more G_UBFX combine
Jay Foad [Fri, 7 Jan 2022 12:19:49 +0000 (12:19 +0000)]
[GlobalISel] Use getPreferredShiftAmountTy in one more G_UBFX combine

Change CombinerHelper::matchBitfieldExtractFromShrAnd to use
getPreferredShiftAmountTy for the shift-amount-like operands of G_UBFX
just like all the other G_[SU]BFX combines do. This better matches the
AMDGPU legality rules for these instructions.

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

2 years ago[GlobalISel] Fix legality checks for G_UBFX combines
Jay Foad [Fri, 7 Jan 2022 11:44:49 +0000 (11:44 +0000)]
[GlobalISel] Fix legality checks for G_UBFX combines

1. Fix CombinerHelper::matchBitfieldExtractFromAnd to check legality
   with the correct types for the G_UBFX that it builds.
2. Fix AMDGPUTargetLowering::isConstantUnsignedBitfieldExtractLegal to
   match the legality rules: result and first operand can be s32 or s64
   but the "shift amount" operands are always s32.
3. Add AMDGPU tests where the post-legalizer combiner would create
   illegal MIR without the above fixes.

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

2 years agoFix GDB printers test
Christian Sigg [Fri, 7 Jan 2022 21:44:41 +0000 (22:44 +0100)]
Fix GDB printers test

- Prevent symbols from being stripped so that it can run with 'RelWithDebInfo'.
- Adjust llvm-support CHECKs after code changes.
- Polish mlir-support CHECKs as suggested in https://reviews.llvm.org/D116646.

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

2 years ago[ORC-RT] Add missing headers from 1d82e19f37d.
Lang Hames [Sat, 8 Jan 2022 06:46:14 +0000 (17:46 +1100)]
[ORC-RT] Add missing headers from 1d82e19f37d.

This should fix the build failure at
https://lab.llvm.org/buildbot/#/builders/165/builds/12997

2 years ago[ORC-RT] Add debug logging macros.
Lang Hames [Wed, 22 Dec 2021 02:58:43 +0000 (13:58 +1100)]
[ORC-RT] Add debug logging macros.

Inspired by LLVM_DEBUG, but using environment variables rather than command line
options.

Code can use ORC_RT_DEBUG(...) (if ORC_RT_DEBUG_TYPE is set), or
ORC_RT_DEBUG_WITH_TYPE(<type>, ...) (if ORC_RT_DEBUG_TYPE is not set. E.g. in
headers).

Debug logging is enabled in the executor by setting the ORC_RT_DEBUG environment
variable. Debug logging can be restricted by type by setting the
ORC_RT_DEBUG_TYPES environment variable to a comma separated list of types,
e.g. ORC_RT_DEBUG_TYPES=macho_platform,sps.

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

2 years ago[ORC] Add missing header from 089acf25223.
Lang Hames [Sat, 8 Jan 2022 06:26:48 +0000 (17:26 +1100)]
[ORC] Add missing header from 089acf25223.

2 years ago[ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.
Lang Hames [Sat, 8 Jan 2022 01:08:06 +0000 (12:08 +1100)]
[ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.

These types performed identical roles. Merging them simplifies interoperability
between JITLink and ORC APIs (allowing us to address a few FIXMEs).

2 years ago[Target] use range-based for loops (NFC)
Kazu Hirata [Sat, 8 Jan 2022 05:20:36 +0000 (21:20 -0800)]
[Target] use range-based for loops (NFC)

2 years ago[clang-format][NFC] Fix a bug in getPreviousToken() in the parser
owenca [Sat, 8 Jan 2022 05:09:54 +0000 (21:09 -0800)]
[clang-format][NFC] Fix a bug in getPreviousToken() in the parser

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

2 years agoAdd first draft of the discourse migration guide.
Tanya Lattner [Sat, 8 Jan 2022 04:24:35 +0000 (20:24 -0800)]
Add first draft of the discourse migration guide.

2 years ago[RISCV] Add a command line option to control the LMUL used by TTI's getRegisterBitWidth.
Craig Topper [Sat, 8 Jan 2022 03:50:44 +0000 (19:50 -0800)]
[RISCV] Add a command line option to control the LMUL used by TTI's getRegisterBitWidth.

By default we return the width of an LMUL=1 register. We can enable
testing with larger LMUL values by returning a larger bit width.

This patch adds a RISCV specific option to provide a LMUL which will be
multiplied by the LMUL=1 bit width.

Reviewed By: kito-cheng

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

2 years ago[llvm] Remove unused forward declarations (NFC)
Kazu Hirata [Sat, 8 Jan 2022 04:00:34 +0000 (20:00 -0800)]
[llvm] Remove unused forward declarations (NFC)

2 years ago[RISCV] Set getMinVectorRegisterBitWidth to 16 if enable fixed length vector code...
Kito Cheng [Mon, 3 Jan 2022 07:32:49 +0000 (15:32 +0800)]
[RISCV] Set getMinVectorRegisterBitWidth to 16 if enable fixed length vector code gen for RVV

getMinVectorRegisterBitWidth means what vector types is supported in
this target, and actually RISC-V support all fixed length vector types with
vector length less than `getMinRVVVectorSizeInBits`, so set it to 16,
means 2 x i8, that is minimal fixed length vector size in theory.

That also fixed one issue, some testcase migth become non-vectorizable
when `-riscv-v-vector-bits-min` set to larger value, because the vector size is
smaller than `-riscv-v-vector-bits-min`.

For example, following code can vectorize by SLP with
`-riscv-v-vector-bits-min=128` or `-riscv-v-vector-bits-min=256`, but
can't vectorize `-riscv-v-vector-bits-min=512` or larger:

```
void foo(double *da) {
  da[0] = 0;
  da[1] = 1;
  da[2] = 2;
  da[3] = 3;
}
```

Reviewed By: craig.topper

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

2 years ago[NFC] Test commit.
Jun Zhang [Sat, 8 Jan 2022 02:36:09 +0000 (10:36 +0800)]
[NFC] Test commit.

This is just a test commit to check whether the permission I got is
correct or not.

2 years agoAvoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option...
Mehdi Amini [Sat, 8 Jan 2022 01:40:24 +0000 (01:40 +0000)]
Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set

a32300a changed it to create a ThreadPool eagerly so that it gets reused
across buffers, however it also made it so that we create a ThreadPool
early even if we're not gonna use it later because of the command line
option `--mlir-disable-threading` is provided.

Fix #53056

Reland 45adf608024 after build fixes

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

2 years agoRevert "Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading...
Mehdi Amini [Sat, 8 Jan 2022 02:23:30 +0000 (02:23 +0000)]
Revert "Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set"

This reverts commit 45adf608024655d3594993d041af9602da41780f.
Build is broken

2 years ago[gn build] (manually) port feeff8a37c35
Nico Weber [Sat, 8 Jan 2022 02:19:01 +0000 (21:19 -0500)]
[gn build] (manually) port feeff8a37c35

This reverts commit 3ca69283442183d71f13700d860f5912b631bcb0.
492de35df44 relanded in feeff8a37c35.
The reland only uses CMAKE_INSTALL_INCLUDEDIR and not CMAKE_INSTALL_BINDIR
in llvm-config, so this reland reflects that.

2 years ago[MLIR] Fix compilation with LLVM_ENABLE_THREADS=OFF
John Demme [Sat, 8 Jan 2022 01:56:57 +0000 (01:56 +0000)]
[MLIR] Fix compilation with LLVM_ENABLE_THREADS=OFF

Currently, compiles with LLVM_ENABLE_THREADS=OFF fail due to this symbol missing. Add it but assert as calling code is (and should be) checking that threading is enabled.

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

2 years agoAvoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option...
Mehdi Amini [Sat, 8 Jan 2022 01:40:24 +0000 (01:40 +0000)]
Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set

a32300a changed it to create a ThreadPool eagerly so that it gets reused
across buffers, however it also made it so that we create a ThreadPool
early even if we're not gonna use it later because of the command line
option `--mlir-disable-threading` is provided.

Fix #53056

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

2 years ago[libc++] Disable coverage with sanitize-coverage=0
Ben Wagner [Sat, 8 Jan 2022 01:34:05 +0000 (17:34 -0800)]
[libc++] Disable coverage with sanitize-coverage=0

When building libcxx, libcxxabi, and libunwind the build environment may
specify any number of sanitizers. For some build feature tests these
sanitizers must be disabled to prevent spurious linking errors. With
-fsanitize= this is straight forward with -fno-sanitize=all. With
-fsanitize-coverage= there is no -fno-sanitize-coverage=all, but there
is the equivalent undocumented but tested -fsanitize-coverage=0.

The current build rules fail to disable 'trace-pc-guard'. By disabling
all sanitize-coverage flags, including 'trace-pc-guard', possible
spurious linker errors are prevented. In particular, this allows libcxx,
libcxxabi, and libunwind to be built with HonggFuzz.

CMAKE_REQUIRED_FLAGS is extra compile flags when running CMake build
configuration steps (like check_cxx_compiler_flag). It does not affect
the compile flags for the actual build of the project (unless of course
these flags change whether or not a given source compiles and links or
not). So libcxx, libcxxabi, and libunwind will still be built with any
specified sanitize-coverage as before. The build configuration steps
(which are mostly checking to see if certain compiler flags are
available) will not try to compile and link "int main() { return 0;}"
(or other specified source) with sanitize-coverage (which can fail to
link at this stage in building, since the final compile flags required
are yet to be determined).

The change to LIBFUZZER_CFLAGS was done to keep it consistent with the
obvious intention of disabling all sanitize-coverage. This appears to
be intentional, preventing the fuzzer driver itself from showing up in
any coverage calculations.

Reviewed By: #libunwind, #libc, #libc_abi, ldionne, phosek

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

2 years ago[llvm] Remove redundant member initialization (NFC)
Kazu Hirata [Sat, 8 Jan 2022 01:45:09 +0000 (17:45 -0800)]
[llvm] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years ago[Darwin][Sanitizer] Lower Python requirement for iOS simulator testing
Julian Lettner [Sat, 8 Jan 2022 01:35:52 +0000 (17:35 -0800)]
[Darwin][Sanitizer] Lower Python requirement for iOS simulator testing

Lower Python requirements: 3.7 -> 3.6

Workaround introduced in: ebd8eee62a431a6744c3f187fcda58e5dea08499

2 years agoDon't pass uninitialized QueryKind
Vitaly Buka [Fri, 7 Jan 2022 18:30:50 +0000 (10:30 -0800)]
Don't pass uninitialized QueryKind

Even if findImplementors does not use
uninitialized parameter it's still UB and
it's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

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

2 years ago[Darwin] Apply workaround to make symbolication in iOS simulators work
Julian Lettner [Sat, 8 Jan 2022 00:47:37 +0000 (16:47 -0800)]
[Darwin] Apply workaround to make symbolication in iOS simulators work

Specify `ASAN_SYMBOLIZER_PATH` when running simulator tests.  This will
unblock simulator testing in GreenDragon (Apple's open source testing).