platform/upstream/llvm.git
4 years agoRevert "Fix test failures after r371640"
Dmitri Gribenko [Fri, 13 Sep 2019 08:26:59 +0000 (08:26 +0000)]
Revert "Fix test failures after r371640"

This reverts commit r371645, because r371640 was reverted.

llvm-svn: 371824

4 years ago[lldb][NFC] Make ArgEntry::quote private and provide a getter
Raphael Isemann [Fri, 13 Sep 2019 08:26:00 +0000 (08:26 +0000)]
[lldb][NFC] Make ArgEntry::quote private and provide a getter

llvm-svn: 371823

4 years ago[compiler-rt] Add ubsan interface header.
Pierre Gousseau [Fri, 13 Sep 2019 08:22:58 +0000 (08:22 +0000)]
[compiler-rt] Add ubsan interface header.

This is to document __ubsan_default_options().

Reviewed By: vitalybuka

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

llvm-svn: 371822

4 years ago[Clang][ASTImporter] Added visibility check for FunctionTemplateDecl.
Balazs Keri [Fri, 13 Sep 2019 08:03:49 +0000 (08:03 +0000)]
[Clang][ASTImporter] Added visibility check for FunctionTemplateDecl.

Summary:
ASTImporter makes now difference between function templates with same
name in different translation units if these are not visible outside.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 371820

4 years ago[BasicBlockUtils] Add optional BBName argument, in line with BB:splitBasicBlock
Florian Hahn [Fri, 13 Sep 2019 08:03:32 +0000 (08:03 +0000)]
[BasicBlockUtils] Add optional BBName argument, in line with BB:splitBasicBlock

Reviewers: spatel, asbirlea, craig.topper

Reviewed By: asbirlea

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

llvm-svn: 371819

4 years ago[AArch64] MachineCombiner FMA matching. NFC.
Sjoerd Meijer [Fri, 13 Sep 2019 07:38:54 +0000 (07:38 +0000)]
[AArch64] MachineCombiner FMA matching. NFC.

Follow-up of rL371321 that added some more FP16 FMA patterns, and an attempt to
reduce the copy-pasting and make this more readable.

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

llvm-svn: 371818

4 years agoFor PR17164: split -fno-lax-vector-conversion into three different
Richard Smith [Fri, 13 Sep 2019 06:02:15 +0000 (06:02 +0000)]
For PR17164: split -fno-lax-vector-conversion into three different
levels:

 -- none: no lax vector conversions [new GCC default]
 -- integer: only conversions between integer vectors [old GCC default]
 -- all: all conversions between same-size vectors [Clang default]

For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)

Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.

This reinstates r371805, reverted in r371813, with an additional fix for
lldb.

llvm-svn: 371817

4 years agoFix interaction between r371813 and r371814.
Richard Smith [Fri, 13 Sep 2019 05:29:16 +0000 (05:29 +0000)]
Fix interaction between r371813 and r371814.

llvm-svn: 371816

4 years ago[TargetRegisterInfo] Remove SVT argument from getCommonSubClass.
Craig Topper [Fri, 13 Sep 2019 05:24:37 +0000 (05:24 +0000)]
[TargetRegisterInfo] Remove SVT argument from getCommonSubClass.

This was added to support fp128 on x86-64, but appears to be
unneeded now. This may be because the FR128 register class
added back then was merged with the VR128 register class later.

llvm-svn: 371815

4 years agoRemove reliance on lax vector conversions from altivec.h and its test.
Richard Smith [Fri, 13 Sep 2019 05:19:12 +0000 (05:19 +0000)]
Remove reliance on lax vector conversions from altivec.h and its test.

llvm-svn: 371814

4 years agoRevert "For PR17164: split -fno-lax-vector-conversion into three different"
Jonas Devlieghere [Fri, 13 Sep 2019 05:16:59 +0000 (05:16 +0000)]
Revert "For PR17164: split -fno-lax-vector-conversion into three different"

This breaks the LLDB build. I tried reaching out to Richard, but haven't
gotten a reply yet.

llvm-svn: 371813

4 years agoAMDGPU/GlobalISel: Fix assert on multi-return side effect intrinsics
Matt Arsenault [Fri, 13 Sep 2019 04:12:12 +0000 (04:12 +0000)]
AMDGPU/GlobalISel: Fix assert on multi-return side effect intrinsics

llvm.amdgcn.else hits this.

llvm-svn: 371812

4 years agoAMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP
Matt Arsenault [Fri, 13 Sep 2019 04:04:55 +0000 (04:04 +0000)]
AMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP

llvm-svn: 371811

4 years ago[RISCV] Support stack offset exceed 32-bit for RV64
Shiva Chen [Fri, 13 Sep 2019 04:03:32 +0000 (04:03 +0000)]
[RISCV] Support stack offset exceed 32-bit for RV64

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

llvm-svn: 371810

4 years agoRevert "[RISCV] Support stack offset exceed 32-bit for RV64"
Shiva Chen [Fri, 13 Sep 2019 04:03:24 +0000 (04:03 +0000)]
Revert "[RISCV] Support stack offset exceed 32-bit for RV64"

This reverts commit 1c340c62058d4115d21e5fa1ce3a0d094d28c792.

llvm-svn: 371809

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for amdgcn.else
Matt Arsenault [Fri, 13 Sep 2019 03:55:49 +0000 (03:55 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for amdgcn.else

llvm-svn: 371808

4 years agoAMDGPU/GlobalISel: Select 16-bit VALU bit ops
Matt Arsenault [Fri, 13 Sep 2019 03:55:43 +0000 (03:55 +0000)]
AMDGPU/GlobalISel: Select 16-bit VALU bit ops

llvm-svn: 371807

4 years ago[RISCV] Support stack offset exceed 32-bit for RV64
Shiva Chen [Fri, 13 Sep 2019 02:50:13 +0000 (02:50 +0000)]
[RISCV] Support stack offset exceed 32-bit for RV64

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

llvm-svn: 371806

4 years agoFor PR17164: split -fno-lax-vector-conversion into three different
Richard Smith [Fri, 13 Sep 2019 02:20:00 +0000 (02:20 +0000)]
For PR17164: split -fno-lax-vector-conversion into three different
levels:

 -- none: no lax vector conversions [new GCC default]
 -- integer: only conversions between integer vectors [old GCC default]
 -- all: all conversions between same-size vectors [Clang default]

For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)

Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.

llvm-svn: 371805

4 years ago[ELF] Delete a redundant assignment to SectionBase::assigned. NFC
Fangrui Song [Fri, 13 Sep 2019 02:18:04 +0000 (02:18 +0000)]
[ELF] Delete a redundant assignment to SectionBase::assigned. NFC

LinkerScript::discard marks a section dead. It is unnecessary to set the
`assigned` bit.

llvm-svn: 371804

4 years agoAMDGPU/GlobalISel: Legalize G_FFLOOR
Matt Arsenault [Fri, 13 Sep 2019 01:48:15 +0000 (01:48 +0000)]
AMDGPU/GlobalISel: Legalize G_FFLOOR

llvm-svn: 371803

4 years agoTemporarily revert r371640 "LiveIntervals: Split live intervals on multiple dead...
Tim Shen [Fri, 13 Sep 2019 01:34:25 +0000 (01:34 +0000)]
Temporarily revert r371640 "LiveIntervals: Split live intervals on multiple dead defs".

It reveals a miscompile on Hexagon. See PR43302 for details.

llvm-svn: 371802

4 years ago[ScopBuilder] Skip getting leader when merging statements to close holes.
Michael Kruse [Fri, 13 Sep 2019 01:04:38 +0000 (01:04 +0000)]
[ScopBuilder] Skip getting leader when merging statements to close holes.

Function joinOrderedInstructions merges instructions when a leader is encountered twice.
It also notices that leaders in SeenLeaders may lose their leadership in previous merging,
and tries to handle the case using following code:

    Instruction *PrevLeader = UnionFind.getLeaderValue(SeenLeaders.back());

However, this is wrong because it always gets leader for the last element of SeenLeaders,
and I believe it's wrong even we get leader for Prev here.  As a result, Statements in cases
like the one in patch aren't merged as expected.  After investigation, I believe it's
unnecessary to get leader instruction at all.  This is based on fact: Although leaders in
SeenLeaders could lose leadership, they only lose to others in SeenLeaders, in other words,
one existing leader will be chosen as new leader of merged equivalent statements.  We can
take advantage of this and simply check if current leader equals to Prev and break merging
if it does.

The patch also adds a new test.

Patch by bin.narwal <bin.narwal@gmail.com>

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

llvm-svn: 371801

4 years agoAMDGPU/GlobalISel: Legalize G_FMAD
Matt Arsenault [Fri, 13 Sep 2019 00:44:35 +0000 (00:44 +0000)]
AMDGPU/GlobalISel: Legalize G_FMAD

Unlike SelectionDAG, treat this as a normally legalizable operation.
In SelectionDAG this is supposed to only ever formed if it's legal,
but I've found that to be restricting. For AMDGPU this is contextually
legal depending on whether denormal flushing is allowed in the use
function.

Technically we currently treat the denormal mode as a subtarget
feature, so custom lowering could be avoided. However I consider this
to be a defect, and this should be contextually dependent on the
controllable rounding mode of the parent function.

llvm-svn: 371800

4 years agoRevert r371785.
Manoj Gupta [Fri, 13 Sep 2019 00:28:37 +0000 (00:28 +0000)]
Revert r371785.

r371785 is causing fails on clang-hexagon-elf buildbots.

llvm-svn: 371799

4 years agoAMDGPU/GlobalISel: Select G_CTPOP
Matt Arsenault [Fri, 13 Sep 2019 00:11:20 +0000 (00:11 +0000)]
AMDGPU/GlobalISel: Select G_CTPOP

llvm-svn: 371798

4 years agoDAG/GlobalISel: Correct type profile of bitcount ops
Matt Arsenault [Fri, 13 Sep 2019 00:11:14 +0000 (00:11 +0000)]
DAG/GlobalISel: Correct type profile of bitcount ops

The result integer does not need to be the same width as the input.
AMDGPU, NVPTX, and Hexagon all have patterns working around the types
matching. GlobalISel defines these as being different type indexes.

llvm-svn: 371797

4 years ago[Target] Move InferiorCall to Process
Alex Langford [Fri, 13 Sep 2019 00:02:05 +0000 (00:02 +0000)]
[Target] Move InferiorCall to Process

Summary:
InferiorCall is only ever used in Process, and it is not specific to
POSIX. By moving it to Process, we can remove all dependencies on plugins from
Process. Moving InferiorCall to Process seems to achieve this quite well.
Additionally, the name InferiorCall is a little vague now, so we rename
it something a bit more specific.

Reviewers: JDevlieghere, clayborg, compnerd, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 371796

4 years agoThe setUp/tearDown methods I added mssed up the test function; reorder.
Jason Molenda [Fri, 13 Sep 2019 00:01:49 +0000 (00:01 +0000)]
The setUp/tearDown methods I added mssed up the test function; reorder.

Thanks to Ted Woodward for catching this one.

llvm-svn: 371795

4 years ago[libclang] Fix UninstallAbortingLLVMFatalErrorHandler test
Jan Korous [Thu, 12 Sep 2019 23:51:48 +0000 (23:51 +0000)]
[libclang] Fix UninstallAbortingLLVMFatalErrorHandler test

llvm-svn: 371794

4 years agoAMDGPU: Add immarg to llvm.amdgcn.init.exec.from.input
Matt Arsenault [Thu, 12 Sep 2019 23:46:54 +0000 (23:46 +0000)]
AMDGPU: Add immarg to llvm.amdgcn.init.exec.from.input

As far as I can tell this has to be a constant.

llvm-svn: 371793

4 years agoLiveIntervals: Remove assertion
Matt Arsenault [Thu, 12 Sep 2019 23:46:51 +0000 (23:46 +0000)]
LiveIntervals: Remove assertion

This testcase is invalid, and caught by the verifier. For the verifier
to catch it, the live interval computation needs to complete. Remove
the assert so the verifier catches this, which is less confusing.

In this testcase there is an undefined use of a subregister, and lanes
which aren't used or defined. An equivalent testcase with the
super-register shrunk to have no untouched lanes already hit this
verifier error.

llvm-svn: 371792

4 years agoAMDGPU: Inline constant when materalizing FI with add on gfx9
Matt Arsenault [Thu, 12 Sep 2019 23:46:46 +0000 (23:46 +0000)]
AMDGPU: Inline constant when materalizing FI with add on gfx9

This was relying on the SGPR usable for the carry out clobber to also
be used for the input. There was no carry out on gfx9. With no carry
out clobber to worry about, so the literal can just be directly used
with a VOP2 add.

llvm-svn: 371791

4 years ago[Test] Restructure check lines to show differences between modes more clearly
Philip Reames [Thu, 12 Sep 2019 23:22:37 +0000 (23:22 +0000)]
[Test] Restructure check lines to show differences between modes more clearly

With the landing of the previous patch (in particular D66318) there are a lot fewer diffs now.  I added an experimental O0 line, and updated all the tests to group experimental and non-experimental O0/O3 together.

Skimming the remaining diffs, there's only a few which are obviously incorrect.  There's a large number which are questionable, so more todo.

llvm-svn: 371790

4 years agoRename nonvolatile_load/store to simple_load/store [NFC]
Philip Reames [Thu, 12 Sep 2019 23:03:39 +0000 (23:03 +0000)]
Rename nonvolatile_load/store to simple_load/store [NFC]

Implement the TODO from D66318.

llvm-svn: 371789

4 years ago[AArch64][GlobalISel] Support tail calling with swiftself parameters
Jessica Paquette [Thu, 12 Sep 2019 23:00:59 +0000 (23:00 +0000)]
[AArch64][GlobalISel] Support tail calling with swiftself parameters

Swiftself uses a callee-saved register. We can tail call when the register used
in the caller and callee is the same.

This behaviour is equivalent to that in `TargetLowering::parametersInCSRMatch`.

Update call-translator-tail-call.ll to verify that we can do this. When we
support inline assembly, we can write a check similar to the one in the
general swiftself.ll. For now, we need to verify that we get the correct COPY
instruction after call lowering.

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

llvm-svn: 371788

4 years ago[libclang] Expose abort()-ing LLVM fatal error handler
Jan Korous [Thu, 12 Sep 2019 22:55:55 +0000 (22:55 +0000)]
[libclang] Expose abort()-ing LLVM fatal error handler

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

llvm-svn: 371787

4 years ago[SDAG] Update generic code to conservatively check for isAtomic in addition to isVolatile
Philip Reames [Thu, 12 Sep 2019 22:49:17 +0000 (22:49 +0000)]
[SDAG] Update generic code to conservatively check for isAtomic in addition to isVolatile

This is the first sweep of generic code to add isAtomic bailouts where appropriate. The intention here is to have the switch from AtomicSDNode to LoadSDNode/StoreSDNode be close to NFC; that is, I'm not looking to allow additional optimizations at this time. That will come later.  See D66309 for context.

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

llvm-svn: 371786

4 years agoAdd -Wpoison-system-directories warning
Manoj Gupta [Thu, 12 Sep 2019 22:36:13 +0000 (22:36 +0000)]
Add -Wpoison-system-directories warning

When using clang as a cross-compiler, we should not use system
headers to do the compilation.
This CL adds support of a new warning flag -Wpoison-system-directories which
emits warnings if --sysroot is set and headers from common host system location
are used.
By default the warning is disabled.

The intention of the warning is to catch bad includes which are usually
generated by third party build system not targeting cross-compilation.
Such cases happen in Chrome OS when someone imports a new package or upgrade
one to a newer version from upstream.

Patch by: denik (Denis Nikitin)

llvm-svn: 371785

4 years ago[NFC] Sort source files in Utility/CMakeLists.txt
Jonas Devlieghere [Thu, 12 Sep 2019 22:34:59 +0000 (22:34 +0000)]
[NFC] Sort source files in Utility/CMakeLists.txt

llvm-svn: 371784

4 years ago[NFC] Fix file header filename to be Range.h
Greg Clayton [Thu, 12 Sep 2019 22:23:03 +0000 (22:23 +0000)]
[NFC] Fix file header filename to be Range.h

llvm-svn: 371783

4 years ago[Docs] Adds page for reference docs
DeForest Richards [Thu, 12 Sep 2019 22:17:04 +0000 (22:17 +0000)]
[Docs] Adds page for reference docs

Adds a Reference Documentation page for LLVM and API reference documentation.

llvm-svn: 371782

4 years ago[analyzer] Fix the 'analyzer-enabled-checkers.c' test on non-linux machines.
Artem Dergachev [Thu, 12 Sep 2019 22:11:15 +0000 (22:11 +0000)]
[analyzer] Fix the 'analyzer-enabled-checkers.c' test on non-linux machines.

'-Xclang -triple' doesn't seem to override the default target triple
as reliably as '--target'. This leads to test failing due to
platform-specific checks getting unexpectedly enabled.

llvm-svn: 371781

4 years ago[AArch64][GlobalISel] Support sibling calls with outgoing arguments
Jessica Paquette [Thu, 12 Sep 2019 22:10:36 +0000 (22:10 +0000)]
[AArch64][GlobalISel] Support sibling calls with outgoing arguments

This adds support for lowering sibling calls with outgoing arguments.

e.g

```
define void @foo(i32 %a)
```

Support is ported from AArch64ISelLowering's `isEligibleForTailCallOptimization`.
The only thing that is missing is a full port of
`TargetLowering::parametersInCSRMatch`. So, if we're using swiftself,
we'll never tail call.

- Rename `analyzeCallResult` to `analyzeArgInfo`, since the function is now used
  for both outgoing and incoming arguments
- Teach `OutgoingArgHandler` about tail calls. Tail calls use frame indices for
  stack arguments.
- Teach `lowerFormalArguments` to set the bytes in the caller's stack argument
  area. This is used later to check if the tail call's parameters will fit on
  the caller's stack.
- Add `areCalleeOutgoingArgsTailCallable` to perform the eligibility check on
  the callee's outgoing arguments.

For testing:

- Update call-translator-tail-call to verify that we can now tail call with
  outgoing arguments, use G_FRAME_INDEX for stack arguments, and respect the
  size of the caller's stack
- Remove GISel-specific check lines from speculation-hardening.ll, since GISel
  now tail calls like the other selectors
- Add a GISel test line to tailcall-string-rvo.ll since we can tail call in that
  test now
- Add a GISel test line to tailcall_misched_graph.ll since we tail call there
  now. Add specific check lines for GISel, since the debug output from the
  machine-scheduler differs with GlobalISel. The dependency still holds, but
  the output comes out in a different order.

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

llvm-svn: 371780

4 years ago[PowerPC] Remove the SPE4RC register class and instead add f32 to the GPRC register...
Craig Topper [Thu, 12 Sep 2019 22:07:35 +0000 (22:07 +0000)]
[PowerPC] Remove the SPE4RC register class and instead add f32 to the GPRC register class.

Summary:
Since the SPE4RC register class contains an identical set of registers
and an identical spill size to the GPRC class its slightly confusing
the tablegen emitter. It's preventing the GPRC_and_GPRC_NOR0 synthesized
register class from inheriting VTs and AltOrders from GPRC or GPRC_NOR0.
This is because SPE4C is found first in the super register class list
when inheriting these properties and it doesn't set the VTs or
AltOrders the same way as GPRC or GPRC_NOR0.

This patch replaces all uses of GPE4RC with GPRC and allows GPRC and
GPRC_NOR0 to contain f32.

The test changes here are because the AltOrders are being inherited
to GPRC_NOR0 now.

Found while trying to determine if getCommonSubClass needs to take
a VT argument. It was originally added to support fp128 on x86-64,
I've changed some things about that so that it might be needed
anymore. But a PowerPC test crashed without it and I think its
due to this subclass issue.

Reviewers: jhibbits, nemanjai, kbarton, hfinkel

Subscribers: wuzish, nemanjai, mehdi_amini, hiraditya, kbarton, MaskRay, dexonsmith, jsji, shchenz, steven.zhang, llvm-commits

Tags: #llvm

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

llvm-svn: 371779

4 years ago[COFF] Fix to not add archive name to buffer identifiers when they come
Amy Huang [Thu, 12 Sep 2019 22:04:56 +0000 (22:04 +0000)]
[COFF] Fix to not add archive name to buffer identifiers when they come
from thin archives.

Currently lld adds the archive name to MemoryBufferRef identifiers in order to
ensure they are unique. For thin archives, since the file name is already unique and we
want to keep the original path to the file, don't add the archive name.

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

llvm-svn: 371778

4 years agoRemove a duplicate test
Philip Reames [Thu, 12 Sep 2019 21:40:15 +0000 (21:40 +0000)]
Remove a duplicate test

Turns out I'd already added exactly the same test under the name non_unit_stride.

llvm-svn: 371777

4 years ago[SCEV] Add smin support to getRangeRef
Philip Reames [Thu, 12 Sep 2019 21:32:27 +0000 (21:32 +0000)]
[SCEV] Add smin support to getRangeRef

We were failing to compute trip counts (both exact and maximum) for any loop which involved a comparison against either an umin or smin. It looks like this simply got missed when we added smin/umin to SCEV.  (Note: umin was submitted separately earlier today.  Turned out two folks hit this at the same time.)

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

llvm-svn: 371776

4 years ago[DAGCombiner][X86] Pass the CmpOpVT to reduceSelectOfFPConstantLoads so X86 can exclu...
Craig Topper [Thu, 12 Sep 2019 21:30:18 +0000 (21:30 +0000)]
[DAGCombiner][X86] Pass the CmpOpVT to reduceSelectOfFPConstantLoads so X86 can exclude fp128 compares.

The X86 decision assumes the compare will produce a result in an XMM
register, but that can't happen for an fp128 compare since those
go to a libcall the returns an i32. Pass the VT so X86 can check
the type.

llvm-svn: 371775

4 years ago[ConstantFolding] Expand folding of some library functions
Evandro Menezes [Thu, 12 Sep 2019 21:23:22 +0000 (21:23 +0000)]
[ConstantFolding] Expand folding of some library functions

Expanding the folding of `nearbyint()`, `rint()` and `trunc()` to library
functions, in addition to the current support for intrinsics.

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

llvm-svn: 371774

4 years ago[ClangTidy] Adjust the name getCheckName to getCheckerName due to API change.
Tim Shen [Thu, 12 Sep 2019 21:18:44 +0000 (21:18 +0000)]
[ClangTidy] Adjust the name getCheckName to getCheckerName due to API change.

llvm-svn: 371773

4 years agoFix llvm-reduce tests so that they don't assume the source code is
Tim Shen [Thu, 12 Sep 2019 21:03:49 +0000 (21:03 +0000)]
Fix llvm-reduce tests so that they don't assume the source code is
writable.

Instead of copying over the original file permissions, just create
a new file and add the executable bit.

llvm-svn: 371772

4 years ago[SelectionDAGBuilder] Simplify loop in visitSelect back to how it was before r255558.
Craig Topper [Thu, 12 Sep 2019 21:00:32 +0000 (21:00 +0000)]
[SelectionDAGBuilder] Simplify loop in visitSelect back to how it was before r255558.

This code was changed to accomodate fp128 being softened to itself
during type legalization on x86-64. This was done in order to create
libcalls while having fp128 as a legal type. We're now doing the
libcall creation during LegalizeDAG and the type legalization changes
to enable the old behavior have been removed. So this change to
SelectionDAGBuilder is no longer needed.

llvm-svn: 371771

4 years ago[X86] Move negateFMAOpcode helper earlier to help future patch. NFCI.
Simon Pilgrim [Thu, 12 Sep 2019 20:39:56 +0000 (20:39 +0000)]
[X86] Move negateFMAOpcode helper earlier to help future patch. NFCI.

llvm-svn: 371770

4 years ago[LV] Update test case after r371768.
Florian Hahn [Thu, 12 Sep 2019 20:07:17 +0000 (20:07 +0000)]
[LV] Update test case after r371768.

llvm-svn: 371769

4 years ago[SCEV] Support SCEVUMinExpr in getRangeRef.
Florian Hahn [Thu, 12 Sep 2019 20:03:32 +0000 (20:03 +0000)]
[SCEV] Support SCEVUMinExpr in getRangeRef.

This patch adds support for SCEVUMinExpr to getRangeRef,
similar to the support for SCEVUMaxExpr.

Reviewers: sanjoy.google, efriedma, reames, nikic

Reviewed By: sanjoy.google

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

llvm-svn: 371768

4 years agoImprove code generation for thread_local variables:
Richard Smith [Thu, 12 Sep 2019 20:00:24 +0000 (20:00 +0000)]
Improve code generation for thread_local variables:

Summary:
 * Don't bother using a thread wrapper when the variable is known to
   have constant initialization.
 * Emit the thread wrapper as discardable-if-unused in TUs that don't
   contain a definition of the thread_local variable.
 * Don't emit the thread wrapper at all if the thread_local variable
   is unused and discardable; it will be emitted by all TUs that need
   it.

Reviewers: rjmccall, jdoerfert

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 371767

4 years ago[Clang][CodeGen] support alias attribute w/ gnu_inline
Nick Desaulniers [Thu, 12 Sep 2019 19:53:35 +0000 (19:53 +0000)]
[Clang][CodeGen] support alias attribute w/ gnu_inline

Summary:
r369705 did not consider the addition of gnu_inline on function
declarations of alias attributed functions. This resulted in a reported
regression in the clang-9-rc4 release from the Zig developers building
glibc, which was observable as a failed assertion:

llvm-project/clang/lib/AST/Decl.cpp:3336: bool
clang::FunctionDecl::isInlineDefinitionExternallyVisible() const:
Assertion `(doesThisDeclarationHaveABody() || willHaveBody()) && "Must
be a function definition"' failed.

Alias function declarations do not have bodies, so allow us to proceed
if we have the alias function attribute but no body/definition, and add
a test case.  The emitted symbols and their linkage matches GCC for the
added test case.

Link: https://bugs.llvm.org/show_bug.cgi?id=43268
Reviewers: aaron.ballman, rsmith, erichkeane, andrewrk

Reviewed By: andrewrk

Subscribers: cfe-commits, andrewrk, hans, srhines

Tags: #clang

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

llvm-svn: 371766

4 years ago[CFG] Add dumps for CFGElement and CFGElementRef
Kristof Umann [Thu, 12 Sep 2019 19:52:34 +0000 (19:52 +0000)]
[CFG] Add dumps for CFGElement and CFGElementRef

Seems like we never had these, so here we go! I also did some refactoring as I
was chasing a bug unrelated to this revision.

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

llvm-svn: 371765

4 years agollvm-reduce: For now, mark these tests as requiring a shell
David Blaikie [Thu, 12 Sep 2019 19:50:54 +0000 (19:50 +0000)]
llvm-reduce: For now, mark these tests as requiring a shell

(since they execute shell scripts/that's the only entry point at the
moment)

llvm-svn: 371764

4 years ago[libc++] Mark issue 2587 resolved by issue 2567
Zoe Carver [Thu, 12 Sep 2019 19:50:06 +0000 (19:50 +0000)]
[libc++] Mark issue 2587 resolved by issue 2567

Updates status. NFC.

llvm-svn: 371763

4 years agoPrecommit tests for D67514
Philip Reames [Thu, 12 Sep 2019 19:34:27 +0000 (19:34 +0000)]
Precommit tests for D67514

llvm-svn: 371762

4 years agoAMDGPU: Fix bug in r371671 on some builds.
Austin Kerbow [Thu, 12 Sep 2019 19:12:21 +0000 (19:12 +0000)]
AMDGPU: Fix bug in r371671 on some builds.

llvm-svn: 371761

4 years ago[analyzer][NFC] Fix inconsistent references to checkers as "checks"
Kristof Umann [Thu, 12 Sep 2019 19:09:24 +0000 (19:09 +0000)]
[analyzer][NFC] Fix inconsistent references to checkers as "checks"

Traditionally, clang-tidy uses the term check, and the analyzer uses checker,
but in the very early years, this wasn't the case, and code originating from the
early 2010's still incorrectly refer to checkers as checks.

This patch attempts to hunt down most of these, aiming to refer to checkers as
checkers, but preserve references to callback functions (like checkPreCall) as
checks.

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

llvm-svn: 371760

4 years agoNFC, add missing cl::cat option category to clang-scan-deps options to ensure they...
Alex Lorenz [Thu, 12 Sep 2019 19:00:32 +0000 (19:00 +0000)]
NFC, add missing cl::cat option category to clang-scan-deps options to ensure they show up in -help

llvm-svn: 371759

4 years agoAdd getauxval() compat for NetBSD
Kamil Rytarowski [Thu, 12 Sep 2019 18:57:58 +0000 (18:57 +0000)]
Add getauxval() compat for NetBSD

Summary:
getauxval() is not available on NetBSD and there is no a direct equivalent.

Add a function that implements the same semantics with NetBSD internals.

Reorder the GetPageSize() functions to prefer the sysctl approach for NetBSD.
It no longer makes a difference which approach is better. Avoid changing
conditional code path.

Reviewers: vitalybuka, dvyukov, mgorny, joerg

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

llvm-svn: 371758

4 years agoSplit many_tls_keys.cpp into two tests
Kamil Rytarowski [Thu, 12 Sep 2019 18:55:18 +0000 (18:55 +0000)]
Split many_tls_keys.cpp into two tests

Summary:
many_tls_keys_pthread.cpp for TSD
many_tls_keys_thread.cpp for TLS

The TSD test is unsupported on NetBSD as it assumes TLS used internally.
TSD on NetBSD does not use TLS.

Reviewers: joerg, vitalybuka, mgorny, dvyukov, kcc

Reviewed By: vitalybuka

Subscribers: jfb, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

llvm-svn: 371757

4 years ago[analyzer] Don't run the analyzer for -analyzer-list-enabled-checkers
Kristof Umann [Thu, 12 Sep 2019 18:53:48 +0000 (18:53 +0000)]
[analyzer] Don't run the analyzer for -analyzer-list-enabled-checkers

Short and sweet. Whenever I use -analyzer-list-enabled-checkers, I'm only
interested about the configuration, not about the analysis.

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

llvm-svn: 371756

4 years agollvm-reduce: Remove unused plugin support/requirements
David Blaikie [Thu, 12 Sep 2019 18:52:31 +0000 (18:52 +0000)]
llvm-reduce: Remove unused plugin support/requirements

llvm-svn: 371755

4 years agoUse host's executable suffix for clang when cross-compiling compiler-rt
Reid Kleckner [Thu, 12 Sep 2019 18:44:47 +0000 (18:44 +0000)]
Use host's executable suffix for clang when cross-compiling compiler-rt

When cross-compiling compiler-rt as part of LLVM e. g. for Linux on
a Windows host and using the just-built clang as cross-compiler, we set
the -DBUILTINS_CMAKE_ARGS="-DCMAKE_SYSTEM_NAME=Linux" flag in top-level
cmake invocation, which causes CMAKE_EXECUTABLE_SUFFIX to be an empty
string in the nested cmake invocation for building builtins.

But the compiler for compiling test cases is meant to be run on host,
therefore it may have the '.exe' suffix.

Handle this by asking cmake about the host system.

Patch by Sergej Jaskiewicz <jaskiewiczs@icloud.com>

Reviewed By: rnk

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

llvm-svn: 371754

4 years ago[MS] Warn when shadowing template parameters under -fms-compatibility
Reid Kleckner [Thu, 12 Sep 2019 18:26:34 +0000 (18:26 +0000)]
[MS] Warn when shadowing template parameters under -fms-compatibility

Summary:
C++ does not allow shadowing template parameters, but previously we
allowed it under -fms-extensions. Now this behavior is controlled by
-fms-compatibility, and we emit a -Wmicrosoft-template warning when it
happens.

Fixes PR43265

Reviewers: thakis, hans

Subscribers: amccarth, rsmith, STL_MSFT, cfe-commits

Tags: #clang

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

llvm-svn: 371753

4 years ago[LICM/AST] Check if the AliasAny set is removed from the tracker.
Alina Sbirlea [Thu, 12 Sep 2019 18:09:47 +0000 (18:09 +0000)]
[LICM/AST] Check if the AliasAny set is removed from the tracker.

Summary:
Resolves PR38513.
Credit to @bjope for debugging this.

Reviewers: hfinkel, uabelho, bjope

Subscribers: sanjoy.google, bjope, llvm-commits

Tags: #llvm

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

llvm-svn: 371752

4 years ago[clang-scan-deps] remove dots and dots dots from the reported file dependency paths
Alex Lorenz [Thu, 12 Sep 2019 18:03:24 +0000 (18:03 +0000)]
[clang-scan-deps] remove dots and dots dots from the reported file dependency paths

This resolves differences observed on LLVM + Clang when running the comparison between canonical
dependencies (full preprocessing, no file manager reused), and dependencies obtained
when the file manager was reused between the full preprocessing invocations.

llvm-svn: 371751

4 years ago[InstCombine] add tests for fptrunc; NFC
Sanjay Patel [Thu, 12 Sep 2019 18:00:11 +0000 (18:00 +0000)]
[InstCombine] add tests for fptrunc; NFC

llvm-svn: 371750

4 years agoDon't warn about selectany on implicitly inline variables
Reid Kleckner [Thu, 12 Sep 2019 17:55:48 +0000 (17:55 +0000)]
Don't warn about selectany on implicitly inline variables

Summary:
This avoids a -Wignored-attribute warning on the code pattern Microsoft
recommends for integral const static data members defined in headers
here:
https://docs.microsoft.com/en-us/cpp/build/reference/microsoft-extensions-to-c-and-cpp?view=vs-2019

The attribute is redundant, but it is necessary when compiling in C++14
modes with /Za, which disables MSVC's extension that treats such
variables as implicitly inline.

Fixes PR43270

Reviewers: epastor, thakis, hans

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 371749

4 years ago[MemorySSA] Pass (for update) MSSAU when hoisting instructions.
Alina Sbirlea [Thu, 12 Sep 2019 17:12:51 +0000 (17:12 +0000)]
[MemorySSA] Pass (for update) MSSAU when hoisting instructions.

Summary: Pass MSSAU to makeLoopInvariant in order to properly update MSSA.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, uabelho, llvm-commits

Tags: #llvm

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

llvm-svn: 371748

4 years agoPrecommit tests for generalization of load dereferenceability in loop
Philip Reames [Thu, 12 Sep 2019 17:09:01 +0000 (17:09 +0000)]
Precommit tests for generalization of load dereferenceability in loop

llvm-svn: 371747

4 years ago[InstCombine] reduce test noise and regenerate CHECK lines; NFC
Sanjay Patel [Thu, 12 Sep 2019 17:07:01 +0000 (17:07 +0000)]
[InstCombine] reduce test noise and regenerate CHECK lines; NFC

llvm-svn: 371746

4 years ago[LV] Support invariant addresses in speculation logic
Philip Reames [Thu, 12 Sep 2019 16:49:10 +0000 (16:49 +0000)]
[LV] Support invariant addresses in speculation logic

Implement a TODO from rL371452, and handle loop invariant addresses in predicated blocks. If we can prove that the load is safe to speculate into the header, then we can avoid using a masked.load in favour of a normal load.

This is mostly about vectorization robustness. In the common case, it's generally expected that LICM/LoadStorePromotion would have eliminated such loads entirely.

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

llvm-svn: 371745

4 years ago[ELF] ICF: change a dyn_cast<InputSection> to cast
Fangrui Song [Thu, 12 Sep 2019 16:46:19 +0000 (16:46 +0000)]
[ELF] ICF: change a dyn_cast<InputSection> to cast

ICF is performed after EhInputSections and MergeInputSections were
eliminated from inputSections. Every element of inputSections is an
InputSection.

llvm-svn: 371744

4 years ago[CGP] Ensure sinking multiple instructions does not invalidate dominance checks
David Green [Thu, 12 Sep 2019 16:00:07 +0000 (16:00 +0000)]
[CGP] Ensure sinking multiple instructions does not invalidate dominance checks

In MVE, as of rL371218, we are attempting to sink chains of instructions such as:
  %l1 = insertelement <8 x i8> undef, i8 %l0, i32 0
  %broadcast.splat26 = shufflevector <8 x i8> %l1, <8 x i8> undef, <8 x i32> zeroinitializer
In certain situations though, we can end up breaking the dominance relations of
instructions. This happens when we sink the instruction into a loop, but cannot
remove the originals. The Use is updated, which might in fact be a Use from the
second instruction to the first.

This attempts to fix that by reversing the order of instruction that are sunk,
and ensuring that we update the uses on new instructions if they have already
been sunk, not the old ones.

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

llvm-svn: 371743

4 years ago[Alignment] Move OffsetToAlignment to Alignment.h
Guillaume Chatelet [Thu, 12 Sep 2019 15:20:36 +0000 (15:20 +0000)]
[Alignment] Move OffsetToAlignment to Alignment.h

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, JDevlieghere, alexshap, rupprecht, jhenderson

Subscribers: sdardis, nemanjai, hiraditya, kbarton, jakehehrlich, jrtc27, MaskRay, atanasyan, jsji, seiya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 371742

4 years agotest-release.sh: Don't use chrpath on Solaris
Rainer Orth [Thu, 12 Sep 2019 14:50:32 +0000 (14:50 +0000)]
test-release.sh: Don't use chrpath on Solaris

When trying to run test-release.sh on Solaris 11.4 for 9.0.0 rc4, I failed initially
because Solaris lacks chrpath.  This patch accounts for that and allowed the run to
continue.

Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

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

llvm-svn: 371741

4 years ago[docs][llvm-strip] Remove unnecessary whitespace for consistency
James Henderson [Thu, 12 Sep 2019 14:24:04 +0000 (14:24 +0000)]
[docs][llvm-strip] Remove unnecessary whitespace for consistency

llvm-svn: 371739

4 years ago[lldb][NFC] Simplify makefiles also for breakpoint tests
Raphael Isemann [Thu, 12 Sep 2019 14:21:59 +0000 (14:21 +0000)]
[lldb][NFC] Simplify makefiles also for breakpoint tests

These tests were temporarily missing when the big Makefile
simplification patch landed, so this just applies the same change
to these tests.

llvm-svn: 371738

4 years ago[InstCombine][InstSimplify] Move constant-folding tests in result-of-usub-is-non...
Roman Lebedev [Thu, 12 Sep 2019 14:12:31 +0000 (14:12 +0000)]
[InstCombine][InstSimplify] Move constant-folding tests in result-of-usub-is-non-zero-and-no-overflow.ll

llvm-svn: 371737

4 years ago[NFC][InstCombine][InstSimplify] Add test for "add-of-negative is non-zero and no...
Roman Lebedev [Thu, 12 Sep 2019 14:12:20 +0000 (14:12 +0000)]
[NFC][InstCombine][InstSimplify] Add test for "add-of-negative is non-zero and no overflow" (PR43259)

https://rise4fun.com/Alive/ska
https://rise4fun.com/Alive/9iX

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

llvm-svn: 371736

4 years ago[ConstProp] allow folding for fma that produces NaN
Sanjay Patel [Thu, 12 Sep 2019 14:10:50 +0000 (14:10 +0000)]
[ConstProp] allow folding for fma that produces NaN

Folding for fma/fmuladd was added here:
rL202914
...and as seen in existing/unchanged tests, that works to propagate NaN
if it's already an input, but we should fold an fma() that creates NaN too.

From IEEE-754-2008 7.2 "Invalid Operation", there are 2 clauses that apply
to fma, so I added tests for those patterns:

  c) fusedMultiplyAdd: fusedMultiplyAdd(0, ∞, c) or fusedMultiplyAdd(∞, 0, c)
     unless c is a quiet NaN; if c is a quiet NaN then it is implementation
     defined whether the invalid operation exception is signaled
  d) addition or subtraction or fusedMultiplyAdd: magnitude subtraction of
     infinities, such as: addition(+∞, −∞)

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

llvm-svn: 371735

4 years ago[lldb] Remove duplicated breakpoint tests
Raphael Isemann [Thu, 12 Sep 2019 14:07:16 +0000 (14:07 +0000)]
[lldb] Remove duplicated breakpoint tests

After reverting the deletion of the functionalities/breakpoint tests,
we now have some tests twice in the test/ folder which breaks dotest:

* commands/breakpoint/basic
* functionalities/breakpoint/breakpoint_command

After looking over these tests, I think it makes sense to only
keep the original functionalities/ folder. The commands/breakpoint/basic
test are not exclusively testing the breakpoint command itself, so
they shouldn't be in commands/ in the first place. Note that these
folders have identical contents (beside small adjustments regarding
the Makefile which landed after the restructuring).

llvm-svn: 371734

4 years ago[clang] [unittest] Import LLVMTestingSupport if necessary
Michal Gorny [Thu, 12 Sep 2019 13:06:12 +0000 (13:06 +0000)]
[clang] [unittest] Import LLVMTestingSupport if necessary

Add LLVMTestingSupport directory from LLVM_MAIN_SRC_DIR when building
clang stand-alone and LLVMTestingSupport library is not present.  This
is needed to fix stand-alone builds without clang-tools-extra.

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

llvm-svn: 371733

4 years agolld-link: Fix tests that do not run on macOS after r371729.
Nico Weber [Thu, 12 Sep 2019 12:35:34 +0000 (12:35 +0000)]
lld-link: Fix tests that do not run on macOS after r371729.

llvm-svn: 371732

4 years agoRemoved some questionable default arguments from setters
Dmitri Gribenko [Thu, 12 Sep 2019 12:16:43 +0000 (12:16 +0000)]
Removed some questionable default arguments from setters

Summary:
They can be confusing -- what does it mean to call a setter without a
value? Also, some setters, like `setPrintTemplateTree` had `false` as
the default value!

The callers are largely not using these default arguments anyway.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 371731

4 years ago[MIPS GlobalISel] Select indirect branch
Petar Avramovic [Thu, 12 Sep 2019 11:44:36 +0000 (11:44 +0000)]
[MIPS GlobalISel] Select indirect branch

Select G_BRINDIRECT for MIPS32.

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

llvm-svn: 371730

4 years agolld-link: Make /linkrepro: take a filename, not a directory.
Nico Weber [Thu, 12 Sep 2019 11:44:13 +0000 (11:44 +0000)]
lld-link: Make /linkrepro: take a filename, not a directory.

This makes lld-link behave like ld.lld. I don't see a reason for
the two drivers to have different behavior here.

While here, also make lld-link add a version.txt to the tar, like
ld.lld does.

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

llvm-svn: 371729

4 years ago[MIPS GlobalISel] Lower G_DYN_STACKALLOC
Petar Avramovic [Thu, 12 Sep 2019 11:39:50 +0000 (11:39 +0000)]
[MIPS GlobalISel] Lower G_DYN_STACKALLOC

IRTranslator creates G_DYN_STACKALLOC instruction during expansion of
alloca when argument that tells number of elements to allocate on stack
is a virtual register. Use default lowering for MIPS32.

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

llvm-svn: 371728

4 years ago[MIPS GlobalISel] Select G_IMPLICIT_DEF
Petar Avramovic [Thu, 12 Sep 2019 11:32:38 +0000 (11:32 +0000)]
[MIPS GlobalISel] Select G_IMPLICIT_DEF

G_IMPLICIT_DEF is used for both integer and floating point implicit-def.
Handle G_IMPLICIT_DEF as ambiguous opcode in MipsRegisterBankInfo.
Select G_IMPLICIT_DEF for MIPS32.

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

llvm-svn: 371727

4 years agoSwitch "windows" to "system-windows" in some XFAILs
Jeremy Morse [Thu, 12 Sep 2019 11:19:12 +0000 (11:19 +0000)]
Switch "windows" to "system-windows" in some XFAILs

The test failure mode appears to be due to the host machine rather than the
target. The PS4 buildbots are windows-hosted targeting x86_64-scei-ps4,
and are currently reporting these as unexpected failures:

  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/28114

llvm-svn: 371726

4 years ago[DAGCombine] visitFDIV - Use isCheaperToUseNegatedFPOps helper for (fdiv (fneg X...
Simon Pilgrim [Thu, 12 Sep 2019 11:03:09 +0000 (11:03 +0000)]
[DAGCombine] visitFDIV - Use isCheaperToUseNegatedFPOps helper for (fdiv (fneg X), (fneg Y)) -> (fdiv X, Y). NFCI.

Minor cleanup to use equivalent helper code.

llvm-svn: 371724

4 years agoRemoved dead code from DiagnosticBuilder
Dmitri Gribenko [Thu, 12 Sep 2019 10:39:53 +0000 (10:39 +0000)]
Removed dead code from DiagnosticBuilder

llvm-svn: 371723

4 years agoAArch64: support arm64_32, an ILP32 slice for watchOS.
Tim Northover [Thu, 12 Sep 2019 10:22:23 +0000 (10:22 +0000)]
AArch64: support arm64_32, an ILP32 slice for watchOS.

This is the main CodeGen patch to support the arm64_32 watchOS ABI in LLVM.
FastISel is mostly disabled for now since it would generate incorrect code for
ILP32.

llvm-svn: 371722