platform/upstream/llvm.git
3 years ago[X86] .code16: temporarily set Mode32Bit when matching an instruction with the data32...
Fangrui Song [Tue, 6 Oct 2020 15:26:12 +0000 (08:26 -0700)]
[X86] .code16: temporarily set Mode32Bit when matching an instruction with the data32 prefix

PR47632

This allows MC to match `data32 ...` as one instruction instead of two (data32 without insn + insn).

The compatibility with GNU as improves: `data32 ljmp` will be matched as ljmpl.
`data32 lgdt 4(%eax)` will be matched as `lgdtl` (prefixes: 0x67 0x66, instead
of 0x66 0x67).

GNU as supports many other `data32 *w` as `*l`. We currently just hard code
`data32 callw` and `data32 ljmpw`.  Generalizing the suffix replacement is
tricky and requires a think about the "bwlq" appending suffix rules in MatchAndEmitATTInstruction.

Reviewed By: craig.topper

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

3 years ago[HIP] NFC Add comments to cmath functions
Aaron En Ye Shi [Tue, 6 Oct 2020 15:26:56 +0000 (15:26 +0000)]
[HIP] NFC Add comments to cmath functions

Add missing comments to cmath functions.

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

3 years ago[HIP] NFC properly reference Differential Revision
Aaron En Ye Shi [Tue, 6 Oct 2020 15:19:00 +0000 (15:19 +0000)]
[HIP] NFC properly reference Differential Revision

Committed [HIP] Restructure hip headers to add cmath
with typo in commit message. Should be Differential
Revision instead of Review. Using this to close the
diff.

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

3 years ago[SimplifyLibCalls] Optimize mempcpy_chk to mempcpy
Dávid Bolvanský [Mon, 5 Oct 2020 20:16:59 +0000 (22:16 +0200)]
[SimplifyLibCalls] Optimize mempcpy_chk to mempcpy

3 years ago[gn build] Port aa2b593f149
LLVM GN Syncbot [Tue, 6 Oct 2020 14:49:44 +0000 (14:49 +0000)]
[gn build] Port aa2b593f149

3 years ago[HIP] Restructure hip headers to add cmath
Aaron En Ye Shi [Thu, 1 Oct 2020 21:43:52 +0000 (21:43 +0000)]
[HIP] Restructure hip headers to add cmath

Separate __clang_hip_math.h header into __clang_hip_cmath.h
and __clang_hip_math.h. Improve the math function definition,
and add missing definitions or declarations. Add missing
overloads.

Reviewed By: tra, JonChesterfield

Differential Review: https://reviews.llvm.org/D88837

3 years ago[BPF][NewPM] Make BPFTargetMachine properly adjust NPM optimizer pipeline
Arthur Eubanks [Mon, 5 Oct 2020 22:17:12 +0000 (15:17 -0700)]
[BPF][NewPM] Make BPFTargetMachine properly adjust NPM optimizer pipeline

This involves porting BPFAbstractMemberAccess and BPFPreserveDIType to
NPM, then adding them BPFTargetMachine::registerPassBuilderCallbacks
(the NPM equivalent of adjustPassManager()).

Reviewed By: yonghong-song, asbirlea

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

3 years ago[test][InstCombine][NewPM] Fix InstCombine tests under NPM
Arthur Eubanks [Wed, 23 Sep 2020 22:11:40 +0000 (15:11 -0700)]
[test][InstCombine][NewPM] Fix InstCombine tests under NPM

Some of these depended on analyses being present that aren't provided
automatically in NPM.

early_dce_clobbers_callgraph.ll was previously inlining a noinline function?

cast-call-combine.ll relied on the legacy always-inline pass being a
CGSCC pass and getting rerun.

Reviewed By: asbirlea

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

3 years ago[test][NewPM] Make dead-uses.ll work under NPM
Arthur Eubanks [Tue, 22 Sep 2020 22:18:55 +0000 (15:18 -0700)]
[test][NewPM] Make dead-uses.ll work under NPM

This one is weird...

globals-aa needs to be already computed at licm, or else a function pass
can't run a module analysis and won't have access to globals-aa.
But the globals-aa result is impacted by instcombine in a way that
affects what the test is expecting. If globals-aa is computed before
instcombine, it is cached and globals-aa used in licm won't contain the
necessary info provided by instcombine.
Another catch is that if we don't invalidate AAManager, it will use the
cached AAManager that instcombine requested, which may not contain
globals-aa. So we have to invalidate<aa> so that licm can recompute
an AAManager with the globals-aa created by the require<globals-aa>.

This is essentially the problem described in https://reviews.llvm.org/D84259.

Reviewed By: asbirlea

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

3 years ago[Attributor][FIX] Move assertion to make it not trivially fail
Johannes Doerfert [Wed, 9 Sep 2020 21:08:20 +0000 (16:08 -0500)]
[Attributor][FIX] Move assertion to make it not trivially fail

The idea of this assertion was to check the simplified value before we
assign it, not after, which caused this to trivially fail all the time.

3 years ago[Attributor][FIX] Dead return values are not `noundef`
Johannes Doerfert [Wed, 9 Sep 2020 01:18:54 +0000 (20:18 -0500)]
[Attributor][FIX] Dead return values are not `noundef`

When we assume a return value is dead we might still visit return
instructions via `Attributor::checkForAllReturnedValuesAndReturnInsts(..)`.
When we do so the "returned value" is potentially simplified to `undef`
as it is the assumed "returned value". This is a problem if there was a
preexisting `noundef` attribute that will only be removed as we manifest
the `undef` return value. We should not use this combination to derive
`unreachable` though. Two test cases fixed.

3 years ago[Attributor][NFC] Ignore benign uses in AAMemoryBehaviorFloating
Johannes Doerfert [Mon, 7 Sep 2020 22:55:05 +0000 (17:55 -0500)]
[Attributor][NFC] Ignore benign uses in AAMemoryBehaviorFloating

In AAMemoryBehaviorFloating we used to track benign uses in a SetVector.
With this change we look through benign uses eagerly to reduce the
number of elements (=Uses) we look at during an update.

The test does actually not fail prior to this commit but I already wrote
it so I kept it.

3 years agoAdd ability to turn off -fpch-instantiate-templates in clang-cl
Shivanshu Goyal [Tue, 6 Oct 2020 14:12:48 +0000 (16:12 +0200)]
Add ability to turn off -fpch-instantiate-templates in clang-cl

A lot of our code building with clang-cl.exe using Clang 11 was failing with
the following 2 type of errors:

1. explicit specialization of 'foo' after instantiation
2. no matching function for call to 'bar'

Note that we also use -fdelayed-template-parsing in our builds.

I tried pretty hard to get a small repro for these failures, but couldn't. So
there is some subtle edge case in the -fpch-instantiate-templates feature
introduced by this change: https://reviews.llvm.org/D69585

When I tried turning this off using -fno-pch-instantiate-templates, builds
would silently fail with the same error without any indication that
-fno-pch-instantiate-templates was being ignored by the compiler. Then I
realized this "no" option wasn't actually working when I ran Clang under a
debugger.

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

3 years agoSilence -Wunused-variable in NDEBUG mode
Dmitri Gribenko [Tue, 6 Oct 2020 14:02:17 +0000 (16:02 +0200)]
Silence -Wunused-variable in NDEBUG mode

3 years agoRevert "[c++17] Implement P0145R3 during constant evaluation."
Dmitri Gribenko [Tue, 6 Oct 2020 13:28:19 +0000 (15:28 +0200)]
Revert "[c++17] Implement P0145R3 during constant evaluation."

This reverts commit ded79be63555f4e5bfdb0db27ef22b71fe568474. It causes
a crash (I sent the crash reproducer directly to the author).

3 years ago[InstCombine] canRewriteGEPAsOffset - don't dereference a dyn_cast<>. NFCI.
Simon Pilgrim [Tue, 6 Oct 2020 12:52:25 +0000 (13:52 +0100)]
[InstCombine] canRewriteGEPAsOffset - don't dereference a dyn_cast<>. NFCI.

We know V is a IntToPtrInst or PtrToIntInst type so we know its a CastInst - so use cast<> directly.

Prevents clang static analyzer warning that we could deference a null pointer.

3 years ago[InstCombine] FoldShiftByConstant - consistently use ConstantExpr in logicalshift...
Simon Pilgrim [Tue, 6 Oct 2020 12:44:17 +0000 (13:44 +0100)]
[InstCombine] FoldShiftByConstant - consistently use ConstantExpr in logicalshift(trunc(shift(x,c1)),c2) fold. NFCI.

This still only gets used for scalar types but now always uses ConstantExpr in preparation for vector support - it was using APInt methods in some places.

3 years ago[clangd] Add basic keyword-name-validation in rename.
Haojian Wu [Tue, 6 Oct 2020 13:46:40 +0000 (15:46 +0200)]
[clangd] Add basic keyword-name-validation in rename.

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

3 years ago[ARM] Fold select_cc(vecreduce_[u|s][min|max], x) into VMINV or VMAXV
Sam Tebbs [Wed, 23 Sep 2020 10:43:27 +0000 (11:43 +0100)]
[ARM] Fold select_cc(vecreduce_[u|s][min|max], x) into VMINV or VMAXV

    This folds a select_cc or select(set_cc) of a max or min vector reduction with a scalar value into a VMAXV or VMINV.

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

3 years ago[AMDGPU][MC] Added detection of unsupported instructions
Dmitry Preobrazhensky [Tue, 6 Oct 2020 12:30:20 +0000 (15:30 +0300)]
[AMDGPU][MC] Added detection of unsupported instructions

Implemented identification of unsupported instructions; improved errors reporting.

See bug 42590.

Reviewers: rampitec

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

3 years ago[mlir][Linalg] Extend buffer allocation to support Linalg init tensors
Nicolas Vasilache [Tue, 6 Oct 2020 11:40:52 +0000 (11:40 +0000)]
[mlir][Linalg] Extend buffer allocation to support Linalg init tensors

This revision adds init_tensors support to buffer allocation for Linalg on tensors.
Currently makes the assumption that the init_tensors fold onto the first output tensors.

This assumption is not currently enforced or cast in stone and requires experimenting with tiling linalg on tensors for ops **without reductions**.

Still this allows progress towards the end-to-end goal.

3 years agoConvert diagnostics about multi-character literals from extension to warning
Chuyang Chen [Tue, 6 Oct 2020 12:45:26 +0000 (08:45 -0400)]
Convert diagnostics about multi-character literals from extension to warning

This addresses PR46797.

3 years ago[SystemZAsmParser] Treat VR128 separately in ParseDirectiveInsn().
Jonas Paulsson [Tue, 6 Oct 2020 11:20:15 +0000 (13:20 +0200)]
[SystemZAsmParser] Treat VR128 separately in ParseDirectiveInsn().

This patch makes the parser
  - reject higher vector registers (>=16) in operands where they should not
    be accepted.
  - accept higher integers (>=16) in vector register operands.

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D88888

3 years ago[lldb] [Platform] Move common ::DebugProcess() to PlatformPOSIX
Michał Górny [Mon, 5 Oct 2020 21:07:00 +0000 (23:07 +0200)]
[lldb] [Platform] Move common ::DebugProcess() to PlatformPOSIX

Move common ::DebugProcess() implementation shared by Linux and NetBSD
(and to be shared by FreeBSD shortly) into PlatformPOSIX, and move
the old base implementation used only by Darwin to PlatformDarwin.

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

3 years ago[InstCombine] FoldShiftByConstant - use PatternMatch for logicalshift(trunc(shift...
Simon Pilgrim [Tue, 6 Oct 2020 12:12:47 +0000 (13:12 +0100)]
[InstCombine] FoldShiftByConstant - use PatternMatch for logicalshift(trunc(shift(x,c1)),c2) fold. NFCI.

3 years ago[InstCombine] FoldShiftByConstant - remove unnecessary cast<>. NFC.
Simon Pilgrim [Tue, 6 Oct 2020 11:50:04 +0000 (12:50 +0100)]
[InstCombine] FoldShiftByConstant - remove unnecessary cast<>. NFC.

Op1 is already a Constant*

3 years ago[llvm-objcopy][NFC] fix style issues reported by clang-format.
Alexey Lapshin [Tue, 6 Oct 2020 11:55:45 +0000 (14:55 +0300)]
[llvm-objcopy][NFC] fix style issues reported by clang-format.

3 years ago[gn build] Port d6c9dc3c17e
LLVM GN Syncbot [Tue, 6 Oct 2020 12:02:07 +0000 (12:02 +0000)]
[gn build] Port d6c9dc3c17e

3 years ago[clang-tidy] Remove obsolete checker google-runtime-references
Adam Balogh [Tue, 6 Oct 2020 07:25:58 +0000 (09:25 +0200)]
[clang-tidy] Remove obsolete checker google-runtime-references

The rules which is the base of this checker is removed from the
//Google C++ Style Guide// in May:
[[ https://github.com/google/styleguide/pull/553 | Update C++ styleguide ]].
Now this checker became obsolete.

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

3 years ago[llvm-objcopy][MachO] Add support for universal binaries
Alexander Shaposhnikov [Tue, 6 Oct 2020 10:41:19 +0000 (03:41 -0700)]
[llvm-objcopy][MachO] Add support for universal binaries

This diff adds support for universal binaries to llvm-objcopy.
This is a recommit of 32c8435ef70031 with the asan issue fixed.

Test plan: make check-all

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

3 years ago[Statepoints] Change statepoint machine instr format to better suit VReg lowering.
Denis Antrushin [Fri, 4 Sep 2020 17:45:41 +0000 (00:45 +0700)]
[Statepoints] Change statepoint machine instr format to better suit VReg lowering.

Current Statepoint MI format is this:

   STATEPOINT
   <id>, <num patch bytes >, <num call arguments>, <call target>,
   [call arguments...],
   <StackMaps::ConstantOp>, <calling convention>,
   <StackMaps::ConstantOp>, <statepoint flags>,
   <StackMaps::ConstantOp>, <num deopt args>, [deopt args...],
   <gc base/derived pairs...> <gc allocas...>

Note that GC pointers are listed in pairs <base,derived>.
This causes base pointers to appear many times (at least twice) in
instruction, which is bad for us when VReg lowering is ON.
The problem is that machine operand tiedness is 1-1 relation, so
it might look like this:

  %vr2 = STATEPOINT ... %vr1, %vr1(tied-def0)

Since only one instance of %vr1 is tied, that may lead to incorrect
codegen (see PR46917 for more details), so we have to always spill
base pointers. This mostly defeats new VReg lowering scheme.

This patch changes statepoint instruction format so that every
gc pointer appears only once in operand list. That way they all can
be tied. Additional set of operands is added to preserve base-derived
relation required to build stackmap.
New statepoint has following format:

  STATEPOINT
  <id>, <num patch bytes>, <num call arguments>, <call target>,
  [call arguments...],
  <StackMaps::ConstantOp>, <calling convention>,
  <StackMaps::ConstantOp>, <statepoint flags>,
  <StackMaps::ConstantOp>, <num deopt args>, [deopt args...],
  <StackMaps::ConstantOp>, <num gc pointers>, [gc pointers...],
  <StackMaps::ConstantOp>, <num gc allocas>,  [gc allocas...]
  <StackMaps::ConstantOp>, <num entries in gc map>, [base/derived indices...]

Changes are:
  - every gc pointer is listed only once in a flat length-prefixed list;
  - alloca list is prefixed with its length too;
  - following alloca list is length-prefixed list of base-derived
    indices of pointers from gc pointer list. Note that indices are
    logical (number of pointer), not absolute (index of machine operand).

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

3 years ago[libcxx][lit] Add support for custom ssh/scp flags in ssh.py
Alex Richardson [Tue, 6 Oct 2020 10:38:52 +0000 (11:38 +0100)]
[libcxx][lit] Add support for custom ssh/scp flags in ssh.py

In our CHERI Jenkins CI we need to pass `-F <custom_config_file>` to each
ssh/scp command to set various arguments such as the localhost port, usage
of controlmaster, etc. to speed up connections to our emulated QEMU systems.

For our specific use-case I could have also added a single --ssh-config-file
argument that can be used for both the scp and ssh commands, but being able
to pass arbitrary extra flags for both commands seems more flexible.

Reviewed By: #libc, ldionne

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

3 years ago[AArch64] Correct parameter type for unsigned Neon scalar shift intrinsics
David Spickett [Mon, 21 Sep 2020 10:29:06 +0000 (11:29 +0100)]
[AArch64] Correct parameter type for unsigned Neon scalar shift intrinsics

In the following intrinsics the shift amount
(parameter 2) should be signed.

vqshlb_u8 vqshlh_u16  vqshls_u32  vqshld_u64
vqrshlb_u8 vqrshlh_u16 vqrshls_u32 vqrshld_u64
vshld_u64
vrshld_u64

See https://developer.arm.com/documentation/ihi0073/latest

Reviewed By: efriedma

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

3 years ago[clangd] Add `score` extension to workspace/symbol response.
Sam McCall [Mon, 5 Oct 2020 19:41:35 +0000 (21:41 +0200)]
[clangd] Add `score` extension to workspace/symbol response.

The protocol doesn't really incorporate ranking.
As with code completion, most clients respect what the server sends, but
VSCode re-ranks items, with predictable results.
See https://github.com/clangd/vscode-clangd/issues/81

There's no filterText field so we may be unable to construct a good workaround.
But expose the score so we may be able to do this on the client in future.

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

3 years ago[SVE] Lower fixed length vector fneg and fsqrt operations.
Paul Walker [Thu, 1 Oct 2020 17:08:33 +0000 (18:08 +0100)]
[SVE] Lower fixed length vector fneg and fsqrt operations.

Also updates sve-fp.ll to use fneg directly.

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

3 years ago[SVE] Lower fixed length vector floating point rounding operations.
Paul Walker [Thu, 1 Oct 2020 15:37:55 +0000 (16:37 +0100)]
[SVE] Lower fixed length vector floating point rounding operations.

Adds lowering for:
  llvm.ceil
  llvm.floor
  llvm.nearbyint
  llvm.rint
  llvm.round
  llvm.trunc

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

3 years ago[OpenMP][RTL] Remove dead code
Pushpinder Singh [Mon, 5 Oct 2020 12:59:26 +0000 (08:59 -0400)]
[OpenMP][RTL] Remove dead code

RequiresDataSharing was always 0, resulting dead code in device runtime library.

Reviewed By: jdoerfert, JonChesterfield

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

3 years ago[mlir] Add file to implement bufferization for shape ops.
Tres Popp [Tue, 22 Sep 2020 10:23:43 +0000 (12:23 +0200)]
[mlir] Add file to implement bufferization for shape ops.

This adds a shape-bufferize pass and implements the pattern for
shape.assuming.

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

3 years agoRevert "[llvm-objcopy][MachO] Add support for universal binaries"
Dmitri Gribenko [Tue, 6 Oct 2020 09:29:24 +0000 (11:29 +0200)]
Revert "[llvm-objcopy][MachO] Add support for universal binaries"

This reverts commit 32c8435ef70031d7bd3dce48e41bdce65747e123. It fails
ASan, details in https://reviews.llvm.org/D88400.

3 years agoRevert "[llvm-objcopy][MachO] Add missing std::move."
Dmitri Gribenko [Tue, 6 Oct 2020 09:28:55 +0000 (11:28 +0200)]
Revert "[llvm-objcopy][MachO] Add missing std::move."

This reverts commit 6e25586990b93e2c9eaaa4f473b6720ccd646c46. It depends
on 32c8435ef70031d7bd3dce48e41bdce65747e123, which I'm reverting due to
ASan failures. Details in https://reviews.llvm.org/D88400.

3 years ago[VPlan] Add vplan native path vectorization test case for inner loop reduction
Mauri Mustonen [Tue, 6 Oct 2020 09:11:20 +0000 (10:11 +0100)]
[VPlan] Add vplan native path vectorization test case for inner loop reduction

Regarding this bug I posted earlier: https://bugs.llvm.org/show_bug.cgi?id=47035

After reading through LLVM source code and getting familiar with VPlan I was able to vectorize the code using by enabling VPlan native path. After talking with @fhahn he suggested that I contribute this as a test case. So here it is. I tried to follow the available guides how to do this best I could. I modified IR code by hand to have more clear variable names instead of numbers.

One thing what I'd like to get input from someone is that is current CHECK lines sufficient enough to verify that the inner loop has been vectorized properly?

Reviewed By: fhahn

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

3 years ago[llvm-readobj/elf][test] - Stop using precompiled binaries in mips-got.test
Georgii Rymar [Wed, 30 Sep 2020 13:23:01 +0000 (16:23 +0300)]
[llvm-readobj/elf][test] - Stop using precompiled binaries in mips-got.test

This removed 2 last precompiled binaries from the mips-got.test.
YAML descriptions are used instead.

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

3 years ago[clangd] Verify the diagnostic code in include-fixer diagnostic tests, NFC.
Haojian Wu [Mon, 5 Oct 2020 12:02:59 +0000 (14:02 +0200)]
[clangd] Verify the diagnostic code in include-fixer diagnostic tests, NFC.

Make it easier to spot which diagnostics in the include-fixer list are tested.

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

3 years ago[AMDGPU] Fix gcc warnings
Sebastian Neubauer [Tue, 6 Oct 2020 08:45:31 +0000 (10:45 +0200)]
[AMDGPU] Fix gcc warnings

uint8_t types are implicitly promoted to int, leading to a
unsigned-signed comparison.

Thanks for the heads-up @uabelho.

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

3 years ago[MLIR][SPIRVToLLVM] Conversion for composite extract and insert
George Mitenkov [Tue, 6 Oct 2020 08:20:10 +0000 (11:20 +0300)]
[MLIR][SPIRVToLLVM] Conversion for composite extract and insert

A pattern to convert `spv.CompositeInsert` and `spv.CompositeExtract`.
In LLVM, there are 2 ops that correspond to each instruction depending
on the container type. If the container type is a vector type, then
the result of conversion is `llvm.insertelement` or `llvm.extractelement`.
If the container type is an aggregate type (i.e. struct, array), the
result of conversion is `llvm.insertvalue` or `llvm.extractvalue`.

Reviewed By: mravishankar

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

3 years ago[clangd] Fix an inconsistent ReasonToReject enum usage, NFC.
Haojian Wu [Tue, 6 Oct 2020 08:17:47 +0000 (10:17 +0200)]
[clangd] Fix an inconsistent ReasonToReject enum usage, NFC.

3 years ago[mlir][Linalg] Reintroduced missing verification check
Nicolas Vasilache [Tue, 6 Oct 2020 07:59:02 +0000 (07:59 +0000)]
[mlir][Linalg] Reintroduced missing verification check

A verification check on the number of indexing maps seems to have dropped inadvertently. Also update the relevant roundtrip tests.

3 years ago[flang][NFC] Remove redundant `;`
Andrzej Warzynski [Tue, 6 Oct 2020 07:45:53 +0000 (08:45 +0100)]
[flang][NFC] Remove redundant `;`

Sadly this has been causing gcc-10 builds to fail.

3 years ago[LLDB] Add QEMU testing environment setup guide for SVE testing
Muhammad Omair Javaid [Tue, 6 Oct 2020 07:27:27 +0000 (12:27 +0500)]
[LLDB] Add QEMU testing environment setup guide for SVE testing

This patch adds a HowTo document to lldb docs which gives instruction for
setting up a virtual environment based on QEMU emulator for LLDB testing.

Instruction in this document are tested on Arm and AArch64 targets but
can easily be duplicated for other targets supported by QEMU.

This helps test LLDB in absence for modern AArch64 features not released
in publicly available hardware till date.

Reviewed By: labath

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

3 years ago[lldb] Symlink the Clang resource directory to the LLDB build directory in standalone...
Raphael Isemann [Tue, 6 Oct 2020 07:27:24 +0000 (09:27 +0200)]
[lldb] Symlink the Clang resource directory to the LLDB build directory in standalone builds

When doing a standalone build (i.e., building just LLDB against an existing
LLVM/Clang installation), LLDB is currently unable to find any Clang resource
directory that contains all the builtin headers we need to parse real source
code. This causes several tests that actually parse source code on disk within
the expression parser to fail (most notably nearly all the import-std-module
tests).

The reason why LLDB can't find the resource directory is that we search based on
the path of the LLDB shared library path. We assumed that the Clang resource
directory is in the same prefix and has the same relative path to the LLDB
shared library (e.g., `../clang/10.0.0/include`). However for a standalone build
where the existing Clang can be anywhere on the disk, so we can't just rely on
the hardcoded relative paths to the LLDB shared library.

It seems we can either solve this by copying the resource directory to the LLDB
installation, symlinking it there or we pass the path to the Clang installation
to the code that is trying to find the resource directory. When building the
LLDB framework we currently copy the resource directory over to the framework
folder (this is why the import-std-module are not failing on the Green Dragon
standalone bot).

This patch symlinks the resource directory of Clang into the LLDB build
directory. The reason for that is simply that this is only needed when running
LLDB from the build directory. Once LLDB and Clang/LLVM are installed the
already existing logic can find the Clang resource directory by searching
relative to the LLDB shared library.

Reviewed By: kastiglione, JDevlieghere

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

3 years ago[SVE][CodeGen] Fix DAGCombiner::ForwardStoreValueToDirectLoad for scalable vectors
David Sherwood [Thu, 3 Sep 2020 07:28:57 +0000 (08:28 +0100)]
[SVE][CodeGen] Fix DAGCombiner::ForwardStoreValueToDirectLoad for scalable vectors

In DAGCombiner::ForwardStoreValueToDirectLoad I have fixed up some
implicit casts from TypeSize -> uint64_t and replaced calls to
getVectorNumElements() with getVectorElementCount(). There are some
simple cases of forwarding that we can definitely support for
scalable vectors, i.e. when the store and load are both scalable
vectors and have the same size. I have added tests for the new
code paths here:

  CodeGen/AArch64/sve-forward-st-to-ld.ll

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

3 years ago[AST][RecoveryExpr] Support dependent binary operator in C for error recovery.
Haojian Wu [Tue, 6 Oct 2020 06:51:49 +0000 (08:51 +0200)]
[AST][RecoveryExpr] Support dependent binary operator in C for error recovery.

see the whole context in:  https://reviews.llvm.org/D85025

Reviewed By: sammccall

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

3 years ago[AttributeFuncs][FIX] Update new tests (D87304, D87306) after sret changes
Johannes Doerfert [Tue, 6 Oct 2020 04:53:41 +0000 (23:53 -0500)]
[AttributeFuncs][FIX] Update new tests (D87304, D87306) after sret changes

Hopefully the last of these, apologies for the noise.

3 years agoRevert "[SCEV] Prove implicaitons via AddRec start"
Max Kazantsev [Tue, 6 Oct 2020 04:18:13 +0000 (11:18 +0700)]
Revert "[SCEV] Prove implicaitons via AddRec start"

This reverts commit 69acdfe075fa8eb18781f88f4d0cd1ea40fa6e48.

Need to investigate reported miscompiles.

3 years ago[AttributeFuncs][FIX] Update new tests (D87304) after sret changes
Johannes Doerfert [Tue, 6 Oct 2020 04:35:49 +0000 (23:35 -0500)]
[AttributeFuncs][FIX] Update new tests (D87304) after sret changes

3 years ago[JITLink][ELF] Handle BSS sections, improve some error messages.
Lang Hames [Tue, 6 Oct 2020 04:28:07 +0000 (21:28 -0700)]
[JITLink][ELF] Handle BSS sections, improve some error messages.

This patch enables basic BSS section handling, and improves a couple of error
messages in the ELF section parsing code.

Patch by Christian Schafmeister. Thanks Christian!

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

3 years ago[AttributeFuncs] Consider `noundef` in `typeIncompatible`
Johannes Doerfert [Tue, 8 Sep 2020 15:13:11 +0000 (10:13 -0500)]
[AttributeFuncs] Consider `noundef` in `typeIncompatible`

Drop `noundef` for return values that are replaced by void and make it
illegal to put `noundef` on a void value.

Reviewed By: fhahn

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

3 years ago[AttributeFuncs] Consider `align` in `typeIncompatible`
Johannes Doerfert [Tue, 8 Sep 2020 15:10:36 +0000 (10:10 -0500)]
[AttributeFuncs] Consider `align` in `typeIncompatible`

Alignment attributes need to be dropped for non-pointer values.
This also introduces a check into the verifier to ensure you don't use
`align` on anything but a pointer. Test needed to be adjusted
accordingly.

Reviewed By: fhahn

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

3 years ago[GVN LoadPRE] Extend the scope of optimization by using context to prove safety of...
Serguei Katkov [Fri, 2 Oct 2020 03:40:52 +0000 (10:40 +0700)]
[GVN LoadPRE] Extend the scope of optimization by using context to prove safety of speculation

Use context to prove that load can be safely executed at a point where load is being hoisted.

Postpone the decision about safety of speculative load execution till the moment we know
where we hoist load and check safety at that context.

Reviewers: nikic, fhahn, mkazantsev, lebedev.ri, efriedma, reames
Reviewed By: reames, mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D88725

3 years ago[dotest] Simplify logic to find the Python path
Jonas Devlieghere [Mon, 5 Oct 2020 23:35:23 +0000 (16:35 -0700)]
[dotest] Simplify logic to find the Python path

Simplify the logic of parsing the lldb -P output to find the python
path. This removes the special handling for the LLDB.framework case and
instead of pattern matching known errors focus on finding a directory
path that contains an __init__.py.

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

3 years ago[c++17] Implement P0145R3 during constant evaluation.
Richard Smith [Tue, 6 Oct 2020 00:52:23 +0000 (17:52 -0700)]
[c++17] Implement P0145R3 during constant evaluation.

Ensure that we evaluate assignment and compound-assignment
right-to-left, and array subscripting left-to-right.

Fixes PR47724.

3 years agoMake OpenMP tests less brittle in the face of changes in constant
Richard Smith [Tue, 6 Oct 2020 01:39:33 +0000 (18:39 -0700)]
Make OpenMP tests less brittle in the face of changes in constant
evaluation diagnostics.

3 years ago[NewPM] Set -enable-npm-optnone to true by default
Arthur Eubanks [Thu, 17 Sep 2020 23:01:30 +0000 (16:01 -0700)]
[NewPM] Set -enable-npm-optnone to true by default

This makes the NPM skip not required passes on functions marked optnone.

If this causes a pass that should be required but has not been marked
required to be skipped, add
`static bool isRequired() { return true; }`
to the pass class. AlwaysInlinerPass is an example.

clang/test/CodeGen/O0-no-skipped-passes.c is useful for checking that
no passes are skipped under -O0.

The -enable-npm-optnone option will be removed once this has been stable
for long enough without issues.

Reviewed By: ychen, asbirlea

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

3 years ago[MLInliner] Factor out logging
Mircea Trofin [Sat, 3 Oct 2020 03:28:49 +0000 (20:28 -0700)]
[MLInliner] Factor out logging

Factored out the logging facility, to allow its reuse outside the
inliner.

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

3 years ago[AMDGPU] SIInsertSkips: Refactor early exit block creation
Carl Ritson [Tue, 6 Oct 2020 00:44:50 +0000 (09:44 +0900)]
[AMDGPU] SIInsertSkips: Refactor early exit block creation

Refactor exit block creation to a single call ensureEarlyExitBlock.
Add support for generating an early exit block which clears the
exec mask, but only add this instruction when required.
These changes are to facilitate adding more forms of early
termination for PS shaders in the near future.

Reviewed By: nhaehnle

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

3 years agoFix reordering of instructions during VirtRegRewriter unbundling
Carl Ritson [Tue, 6 Oct 2020 00:31:30 +0000 (09:31 +0900)]
Fix reordering of instructions during VirtRegRewriter unbundling

When unbundling COPY bundles in VirtRegRewriter the start of the
bundle is not correctly referenced in the unbundling loop.

The effect of this is that unbundled instructions are sometimes
inserted out-of-order, particular in cases where multiple
reordering have been applied to avoid clobbering dependencies.
The resulting instruction sequence clobbers dependencies.

Reviewed By: foad

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

3 years ago[RISCV] Fix broken test
Evandro Menezes [Tue, 6 Oct 2020 00:20:59 +0000 (19:20 -0500)]
[RISCV] Fix broken test

Fix test for the SiFive E76 core.

This patch fixes the issue introduced by the commit 5d6d8a2769.

3 years ago[NFC][regalloc] Separate iteration from AllocationOrder
Mircea Trofin [Thu, 24 Sep 2020 04:58:45 +0000 (21:58 -0700)]
[NFC][regalloc] Separate iteration from AllocationOrder

This separates the two concerns - encapsulation of traversal order; and
iteration.

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

3 years ago[libc++] Improve tests for std::quoted
Louis Dionne [Mon, 5 Oct 2020 22:50:37 +0000 (18:50 -0400)]
[libc++] Improve tests for std::quoted

Instead of using ad-hoc mechanisms to disable the tests in C++ < 14, use
UNSUPPORTED markup.

3 years agoFix raciness in the StopHook check for "has the target run".
Jim Ingham [Fri, 2 Oct 2020 19:43:24 +0000 (12:43 -0700)]
Fix raciness in the StopHook check for "has the target run".

This was looking at the privateState, but it's possible that
the actual process has started up and then stopped again by the
time we get to the check, which would lead us to get out of running
the stop hooks too early.

Instead we need to track the intention of the stop hooks directly.

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

3 years agoShow register names in DWARF unwind info.
Greg Clayton [Sat, 3 Oct 2020 01:05:10 +0000 (18:05 -0700)]
Show register names in DWARF unwind info.

Register context information was already being passed into the DWARFDebugFrame code that dumps unwind information but it wasn't being used. This change adds the ability to dump registers names of a valid MC register context was passed in and if it knows about the register. Updated the tests to use the newly returned register names.

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

3 years ago[OpenMP][Archer][Tests] NFC: fix spurious test failure
Joachim Protze [Mon, 5 Oct 2020 22:06:40 +0000 (00:06 +0200)]
[OpenMP][Archer][Tests] NFC: fix spurious test failure

The test disables suppression and therefore sometimes triggers a know false
positive in the openmp runtime. The test should only verify that the env
var is handles as expected.

3 years ago[libcxx][dsl] Fix mutable default argument warning
Alex Richardson [Mon, 5 Oct 2020 21:54:22 +0000 (22:54 +0100)]
[libcxx][dsl] Fix mutable default argument warning

This is flagged by PyCharm and can cause subtle bugs. While changing this
also re-sort the imports and add missing ones.

Reviewed By: #libc, ldionne

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

3 years ago[X86] Remove X86ISD::LCMPXCHG8_SAVE_EBX_DAG and LCMPXCHG8B_SAVE_EBX pseudo instruction
Craig Topper [Mon, 5 Oct 2020 22:03:07 +0000 (15:03 -0700)]
[X86] Remove X86ISD::LCMPXCHG8_SAVE_EBX_DAG and LCMPXCHG8B_SAVE_EBX pseudo instruction

This and its friend X86ISD::LCMPXCHG8_SAVE_RBX_DAG are used if we need to avoid clobbering the frame pointer in EBX/RBX. EBX/RBX are only used a frame pointer in 64-bit mode. In 64-bit mode we don't use CMPXCHG8B since we have a GR64 cmpxchg available. So we don't need special handling for LCMPXCHG8B.

Split from D88808

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

3 years ago[SelectionDAG] Make sure FMF are propagated when getSetcc canonicalizes FP constants...
Craig Topper [Mon, 5 Oct 2020 21:27:14 +0000 (14:27 -0700)]
[SelectionDAG] Make sure FMF are propagated when getSetcc canonicalizes FP constants to RHS.

getNode handling for ISD:SETCC calls FoldSETCC which can canonicalize
FP constants to the RHS. When this happens we should create the node
with the FMF that was requested. By using FlagInserter when can ensure
any calls to getNode/getSetcc during canonicalization will also get the flags.

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

3 years agoCleanup CodeGen/CallingConvLower.cpp
Fangrui Song [Mon, 5 Oct 2020 21:47:46 +0000 (14:47 -0700)]
Cleanup CodeGen/CallingConvLower.cpp

Patch by pi1024e (email unavailable)

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

3 years agoRevert "Outline non returning functions unless a longjmp"
Vedant Kumar [Mon, 5 Oct 2020 20:41:12 +0000 (13:41 -0700)]
Revert "Outline non returning functions unless a longjmp"

This reverts commit 20797989ea190f2ef22d13c5a7a0535fe9afa58b.

This patch (https://reviews.llvm.org/D69257) cannot complete a stage2
build due to the change:

```
CI->getCalledFunction()->getName().contains("longjmp")
```

There are several concrete issues here:

  - The callee may not be a function, so `getCalledFunction` can assert.
  - The called value may not have a name, so `getName` can assert.
  - There's no distinction made between "my_longjmp_test_helper" and the
    actual longjmp libcall.

At a higher level, there's a serious layering problem here. The
splitting pass makes policy decisions in a general way (e.g. based on
attributes or profile data). Special-casing certain names breaks the
layering. It subverts the work of library maintainers (who may now need
to opt-out of unexpected optimization behavior for any affected
functions) and can lead to inconsistent optimization behavior (as not
all llvm passes special-case ".*longjmp.*" in the same way).

The patch may need significant revision to address these issues.

But the immediate issue is that this crashes while compiling llvm's unit
tests in a stage2 build (due to the `getName` problem).

3 years ago[SVE] Add legalisation tests to sve-fixed-length-int-reduce.ll
Cameron McInally [Mon, 5 Oct 2020 21:05:14 +0000 (16:05 -0500)]
[SVE] Add legalisation tests to sve-fixed-length-int-reduce.ll

3 years ago[MLIR][SPIRV] Extend _reference_of to support SpecConstantCompositeOp.
ergawy [Mon, 5 Oct 2020 20:39:39 +0000 (16:39 -0400)]
[MLIR][SPIRV] Extend _reference_of to support SpecConstantCompositeOp.

Adds support for SPIR-V composite speciailization constants to spv._reference_of.

Reviewed By: antiagainst

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

3 years ago[InstCombine] Revert rL226781 "Teach InstCombine to canonicalize loads which are...
Roman Lebedev [Mon, 5 Oct 2020 19:35:59 +0000 (22:35 +0300)]
[InstCombine] Revert rL226781 "Teach InstCombine to canonicalize loads which are only ever stored to always use a legal integer type if one is available." (PR47592)

(it was introduced in https://lists.llvm.org/pipermail/llvm-dev/2015-January/080956.html)

This canonicalization seems dubious.

Most importantly, while it does not create `inttoptr` casts by itself,
it may cause them to appear later, see e.g. D88788.

I think it's pretty obvious that it is an undesirable outcome,
by now we've established that seemingly no-op `inttoptr`/`ptrtoint` casts
are not no-op, and are no longer eager to look past them.
Which e.g. means that given
```
%a = load i32
%b = inttoptr %a
%c = inttoptr %a
```
we likely won't be able to tell that `%b` and `%c` is the same thing.

As we can see in D88789 / D88788 / D88806 / D75505,
we can't really teach SCEV about this (not without the https://bugs.llvm.org/show_bug.cgi?id=47592 at least)
And we can't recover the situation post-inlining in instcombine.

So it really does look like this fold is actively breaking
otherwise-good IR, in a way that is not recoverable.
And that means, this fold isn't helpful in exposing the passes
that are otherwise unaware of these patterns it produces.

Thusly, i propose to simply not perform such a canonicalization.
The original motivational RFC does not state what larger problem
that canonicalization was trying to solve, so i'm not sure
how this plays out in the larger picture.

On vanilla llvm test-suite + RawSpeed, this results in
increase of asm instructions and final object size by ~+0.05%
decreases final count of bitcasts by -4.79% (-28990),
ptrtoint casts by -15.41% (-3423),
and of inttoptr casts by -25.59% (-6919, *sic*).
Overall, there's -0.04% less IR blocks, -0.39% instructions.

See https://bugs.llvm.org/show_bug.cgi?id=47592

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

3 years ago[flang] Correct kP scaling on F output
peter klausler [Wed, 30 Sep 2020 20:04:44 +0000 (13:04 -0700)]
[flang] Correct kP scaling on F output

The sign of the scaling factor was misinterpreted for output
as meaning what it does for input.  To be correct, they
should cancel each other out.

print '(1P,F4.3)', 1. ! printed 0.1 but should print 10.0

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

3 years ago[RISCV] Add SiFive cores to the CPU option
Evandro Menezes [Fri, 2 Oct 2020 21:44:32 +0000 (16:44 -0500)]
[RISCV] Add SiFive cores to the CPU option

Add the SiFive cores E76 and U74 using the SiFive 7 series microarchitecture.

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

3 years ago[RISCV] Use the extensions in the canonical order (NFC)
Evandro Menezes [Fri, 2 Oct 2020 21:26:49 +0000 (16:26 -0500)]
[RISCV] Use the extensions in the canonical order (NFC)

Fix a mistake in the ordering.

3 years ago[libc++] Use __has_include instead of complex logic in thread.cpp
Louis Dionne [Mon, 5 Oct 2020 20:39:33 +0000 (16:39 -0400)]
[libc++] Use __has_include instead of complex logic in thread.cpp

We might end up including more headers than strictly necessary this way,
but it's much simpler and it makes it easier to port thread.cpp to systems
not handled by the existing conditionals.

3 years ago[libc++] NFC: Rename variant helpers to avoid name clashes
Louis Dionne [Mon, 5 Oct 2020 20:30:23 +0000 (16:30 -0400)]
[libc++] NFC: Rename variant helpers to avoid name clashes

Some system headers define __constructor and __destructor macros (for
Clang attributes constructor and destructor). While this is badly
behaved, it is easy for libc++ to work around this issue.

3 years ago[libc++] NFC: Remove unused <iostream> include in atomic.cpp
Louis Dionne [Mon, 5 Oct 2020 20:24:41 +0000 (16:24 -0400)]
[libc++] NFC: Remove unused <iostream> include in atomic.cpp

3 years agoRevert "[SLC] Optimize mempcpy_chk to mempcpy"
Dávid Bolvanský [Mon, 5 Oct 2020 20:27:14 +0000 (22:27 +0200)]
Revert "[SLC] Optimize mempcpy_chk to mempcpy"

This reverts commit 3f1fd59de3002e3d5a4eca98cd49c45755ab0110.

3 years ago[SLC] Optimize mempcpy_chk to mempcpy
Dávid Bolvanský [Mon, 5 Oct 2020 20:16:59 +0000 (22:16 +0200)]
[SLC] Optimize mempcpy_chk to mempcpy

As reported in PR46735:

void* f(void *d, const void *s, size_t l)
{
    return __builtin___mempcpy_chk(d, s, l, __builtin_object_size(d, 0));
}

This can be optimized to `return mempcpy(d, s, l);`.

Reviewed By: efriedma

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

3 years ago[libc++] Fix several debug mode tests
Louis Dionne [Fri, 2 Oct 2020 19:50:55 +0000 (15:50 -0400)]
[libc++] Fix several debug mode tests

These tests were only being run when _LIBCPP_DEBUG was defined, which
isn't the case by default when we run the test suite. In other words,
all these debug mode tests were never being run. This commit makes sure
they are run, and in some cases, extracts them into a file under test/libcxx
to separate them from the Standard tests.

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

3 years ago[flang] Make binary->decimal conversion buffer sizes accurate
peter klausler [Thu, 1 Oct 2020 18:19:38 +0000 (11:19 -0700)]
[flang] Make binary->decimal conversion buffer sizes accurate

The binary values that produce the most significant decimal
digits in an exact conversion are those with the least normal
biased exponent (1) and all fractional bits set, not the
least-valued subnormals.  So the binary->decimal conversion
buffer sizes were a little short, and could cause a overrun crash.

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

3 years ago[LLD] [MinGW] Support setting the subsystem version via the subsystem argument
Martin Storsjö [Sun, 4 Oct 2020 14:59:33 +0000 (17:59 +0300)]
[LLD] [MinGW] Support setting the subsystem version via the subsystem argument

If a version is specified both with --{major,minor}-subsystem-version and
with --subsystem <name>:<version>, the one specified last (that actually
sets a version) takes precedance in GNU ld; thus doing the same here.

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

3 years ago[LLD] [MinGW] Simplify handling of os/subsystem version
Martin Storsjö [Sun, 4 Oct 2020 08:52:36 +0000 (11:52 +0300)]
[LLD] [MinGW] Simplify handling of os/subsystem version

As they can be set independently after D88802, we can get rid of a bit
of extra code - simplifying the logic here before adding more
complication to it later.

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

3 years ago[LLD] [COFF] Add a private option for setting the os version separately from subsyste...
Martin Storsjö [Sat, 3 Oct 2020 22:29:45 +0000 (01:29 +0300)]
[LLD] [COFF] Add a private option for setting the os version separately from subsystem version

The MinGW driver has separate options for OS and subsystem version.
Having this available in lld-link allows the MinGW driver to both match
GNU ld better and simplifies the code for merging two (potentially
mismatching) arguments into one.

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

3 years ago[LLD] [COFF] Fix parsing version numbers with leading zeros
Martin Storsjö [Sat, 3 Oct 2020 22:19:41 +0000 (01:19 +0300)]
[LLD] [COFF] Fix parsing version numbers with leading zeros

Parse the components as decimal, instead of decuding the base from
the string. This avoids ambiguity if the second number contains leading
zeros, which previously were parsed as indicating an octal number.

MS link.exe doesn't support hexadecimal numbers in the version numbers,
neither in /version nor in /subsystem.

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

3 years ago[CUDA] Don't call __cudaRegisterVariable on C++17 inline variables
Fangrui Song [Sat, 3 Oct 2020 21:50:20 +0000 (14:50 -0700)]
[CUDA] Don't call __cudaRegisterVariable on C++17 inline variables

D17779: host-side shadow variables of external declarations of device-side
global variables have internal linkage and are referenced by
`__cuda_register_globals`.

nvcc from CUDA 11 does not allow `__device__ inline` or `__device__ constexpr`
(C++17 inline variables) but clang has incorrectly supported them for a while:

```
error: A __device__ variable cannot be marked constexpr
error: An inline __device__/__constant__/__managed__ variable must have internal linkage when the program is compiled in whole program mode (-rdc=false)
```

If such a variable (which has a comdat group) is discarded (a copy from another
translation unit is prevailing and selected), accessing the variable from
outside the section group (`__cuda_register_globals`) is a violation of the ELF
specification and will be rejected by linkers:

> A symbol table entry with STB_LOCAL binding that is defined relative to one of a group's sections, and that is contained in a symbol table section that is not part of the group, must be discarded if the group members are discarded. References to this symbol table entry from outside the group are not allowed.

As a workaround, don't register such inline variables for now.
(If we register the variables in all TUs, we will keep multiple instances of the shadow and break the C++ semantics for inline variables).
We should reject such variables in Sema but our internal users need some time to migrate.

Reviewed By: tra

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

3 years ago[NFC][GCOV] Fix build: there's `llvm::stable_partition()` wrapper
Roman Lebedev [Mon, 5 Oct 2020 19:52:32 +0000 (22:52 +0300)]
[NFC][GCOV] Fix build: there's `llvm::stable_partition()` wrapper

3 years ago[CodeGen][MachineSched] Fixup function name typo. NFC
Jon Roelofs [Mon, 5 Oct 2020 19:43:50 +0000 (12:43 -0700)]
[CodeGen][MachineSched] Fixup function name typo. NFC

3 years ago[lldb/test] Catch invalid calls to expect()
Dave Lee [Sun, 4 Oct 2020 05:51:43 +0000 (22:51 -0700)]
[lldb/test] Catch invalid calls to expect()

Add preconditions to `TestBase.expect()` that catch semantically invalid calls
that happen to succeed anyway. This also fixes the broken callsites caught by
these checks.

This prevents the following incorrect calls:

1. `self.expect("lldb command", "some substr")`
2. `self.expect("lldb command", "assert message", "some substr")`

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

3 years ago[gcov] Fix non-determinism (DenseMap iteration order) of checksum computation
Fangrui Song [Mon, 5 Oct 2020 19:39:19 +0000 (12:39 -0700)]
[gcov] Fix non-determinism (DenseMap iteration order) of checksum computation

... by using MapVector. The issue was caused by 63182c2ac0b643a60d397274e8a31166fc7243fa.

Also use stable_partition instead of partition to get stable results
across different STL implementations.

3 years ago[InstCombine] Handle GEP inbounds in select op replacement (PR47730)
Nikita Popov [Mon, 5 Oct 2020 19:13:02 +0000 (21:13 +0200)]
[InstCombine] Handle GEP inbounds in select op replacement (PR47730)

When retrying the "simplify with operand replaced" select
optimization without poison flags, also handle inbounds on GEPs.

Of course, this particular example would also be safe to transform
while keeping inbounds, but the underlying machinery does not
know this (yet).