platform/upstream/llvm.git
6 years ago[X86][SandyBridge] SBWriteResPair +5cy Memory Folds
Simon Pilgrim [Fri, 6 Apr 2018 11:00:51 +0000 (11:00 +0000)]
[X86][SandyBridge] SBWriteResPair +5cy Memory Folds

As mentioned on D44647, this patch increases the default memory latency to +5cy , which more closely matches what most custom cases are doing for reg-mem instructions.

I've bumped LoadLatency, ReadAfterLd and WriteLoad values to 5cy to be consistent.

As Sandy Bridge is currently our default generic model, this affects a lot of scheduling tests...

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

llvm-svn: 329388

6 years agoTweak an assert message in the verifier
Hans Wennborg [Fri, 6 Apr 2018 10:20:19 +0000 (10:20 +0000)]
Tweak an assert message in the verifier

llvm-svn: 329387

6 years ago[X86][SkylakeServer] Merge 2 InstRW entries to the same sched group. NFCI.
Simon Pilgrim [Fri, 6 Apr 2018 10:16:36 +0000 (10:16 +0000)]
[X86][SkylakeServer] Merge 2 InstRW entries to the same sched group. NFCI.

llvm-svn: 329386

6 years agoEntryExitInstrumenter: Handle musttail calls
Hans Wennborg [Fri, 6 Apr 2018 10:14:09 +0000 (10:14 +0000)]
EntryExitInstrumenter: Handle musttail calls

Inserting instrumentation between a musttail call and ret instruction
would create invalid IR. Instead, treat musttail calls as function
exits.

llvm-svn: 329385

6 years ago[ELF] Don't write to the source directory in test.
Benjamin Kramer [Fri, 6 Apr 2018 10:05:47 +0000 (10:05 +0000)]
[ELF] Don't write to the source directory in test.

llvm-svn: 329384

6 years ago[NFC] Add missing end of line symbols
Max Kazantsev [Fri, 6 Apr 2018 09:47:06 +0000 (09:47 +0000)]
[NFC] Add missing end of line symbols

llvm-svn: 329383

6 years ago[MIR] Add support for MachineFrameInfo::LocalFrameSize
Francis Visoiu Mistrih [Fri, 6 Apr 2018 08:56:25 +0000 (08:56 +0000)]
[MIR] Add support for MachineFrameInfo::LocalFrameSize

MFI.LocalFrameSize was not serialized.

It is usually set from LocalStackSlotAllocation, so if that pass doesn't
run it is impossible do deduce it from the stack objects. Until now, this
information was lost.

llvm-svn: 329382

6 years ago[debug_loc] Fix typo in DWARFExpression constructor
Pavel Labath [Fri, 6 Apr 2018 08:49:57 +0000 (08:49 +0000)]
[debug_loc] Fix typo in DWARFExpression constructor

Summary:
The positions of the DwarfVersion and AddressSize arguments were
reversed, which caused parsing for dwarf opcodes which contained
address-size-dependent operands (such as DW_OP_addr). Amusingly enough,
none of the address-size asserts fired, as dwarf version was always 4,
which is a valid address size.

I ran into this when constructing weird inputs for the DWARF verifier. I
I add a test case as hand-written dwarf -- I am not sure how to trigger
this differently, as having a DW_OP_addr inside a location list is a
fairly non-standard thing to do.

Fixing this error exposed a bug in the debug_loc.dwo parser, which was
always being constructed with an address size of 0. I fix that as well
by following the pattern in the non-dwo parser of picking up the address
size from the first compile unit (which is technically not correct, but
probably good enough in practice).

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 329381

6 years ago[clangd] move comment to the right place. NFC
Sam McCall [Fri, 6 Apr 2018 07:48:21 +0000 (07:48 +0000)]
[clangd] move comment to the right place. NFC

llvm-svn: 329380

6 years ago[NFC] Loosen restriction on preheader to fix buildbot
Max Kazantsev [Fri, 6 Apr 2018 07:23:45 +0000 (07:23 +0000)]
[NFC] Loosen restriction on preheader to fix buildbot

llvm-svn: 329379

6 years ago[XRay][clang] Only run driver test for Linux and FreeBSD
Dean Michael Berris [Fri, 6 Apr 2018 06:09:57 +0000 (06:09 +0000)]
[XRay][clang] Only run driver test for Linux and FreeBSD

This is a follow-up to D45354, which we should have only been running on
Linux and FreeBSD for specific targets.

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

llvm-svn: 329378

6 years ago[PowerPC] allow D-form VSX load/store when accessing FrameIndex without offset
Hiroshi Inoue [Fri, 6 Apr 2018 05:41:16 +0000 (05:41 +0000)]
[PowerPC] allow D-form VSX load/store when accessing FrameIndex without offset

VSX D-form load/store instructions of POWER9 require the offset be a multiple of 16 and a helper`isOffsetMultipleOf` is used to check this.
So far, the helper handles FrameIndex + offset case, but not handling FrameIndex without offset case. Due to this, we are missing opportunities to exploit D-form instructions when accessing an object or array allocated on stack.
For example, x-form store (stxvx) is used for int a[4] = {0}; instead of d-form store (stxv). For larger arrays, D-form instruction is not used when accessing the first 16-byte. Using D-form instructions reduces register pressure as well as instructions.

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

llvm-svn: 329377

6 years ago[XRay][clang] Add a flag to enable/disable linking XRay deps explicitly
Dean Michael Berris [Fri, 6 Apr 2018 05:28:54 +0000 (05:28 +0000)]
[XRay][clang] Add a flag to enable/disable linking XRay deps explicitly

Summary:
This change introduces `-fxray-link-deps` and `-fnoxray-link-deps`. The
`-fnoxray-link-deps` allows for directly controlling which specific XRay
runtime to link. The default is for clang to link the XRay runtime that
is shipped with the compiler (if there are any), but users may want to
explicitly add the XRay dependencies from other locations or other
means.

Reviewers: eizan, echristo, chandlerc

Reviewed By: eizan

Subscribers: cfe-commits

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

llvm-svn: 329376

6 years agoMark <span> as "In progress"
Marshall Clow [Fri, 6 Apr 2018 04:43:27 +0000 (04:43 +0000)]
Mark <span> as "In progress"

llvm-svn: 329375

6 years ago[debugserver] Fix LC_BUILD_VERSION load command handling.
Frederic Riss [Fri, 6 Apr 2018 04:28:12 +0000 (04:28 +0000)]
[debugserver] Fix LC_BUILD_VERSION load command handling.

Summary:
In one of the 2 places the LC_BUILD_VERSION load command is handled, there
is a bug preventing us from actually handling them (the address where to
read the load command was not updated). This patch factors reading the
deployment target load commands into a helper and adds testing for the 2
code paths calling the helper.

The testing is a little bit complicated because the only times those load
commands matter is when debugging a simulator process. I added a new
decorator to check that a specific SDK is available. The actual testing was
fairly easy once I knew how to run a simulated process.

Reviewers: jasonmolenda, labath

Subscribers: lldb-commits

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

llvm-svn: 329374

6 years ago[LLVM-C] Fill Out LLVMCallConv
Robert Widmann [Fri, 6 Apr 2018 04:02:39 +0000 (04:02 +0000)]
[LLVM-C] Fill Out LLVMCallConv

Summary: Bring LLVMCallConv up to date with latest [[ http://llvm.org/doxygen/CallingConv_8h_source.html | CallConv ]]

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 329373

6 years ago[XRay][clang] Consolidate runtime and link-time flag processing (NFC)
Dean Michael Berris [Fri, 6 Apr 2018 03:53:04 +0000 (03:53 +0000)]
[XRay][clang] Consolidate runtime and link-time flag processing (NFC)

Summary:
This change fixes http://llvm.org/PR36985 to define a single place in
CommonArgs.{h,cpp} where XRay runtime flags and link-time dependencies
are processed for all toolchains that support XRay instrumentation. This
is a refactoring of the same functionality spread across multiple
toolchain definitions.

Reviewers: echristo, devnexen, eizan

Reviewed By: eizan

Subscribers: emaste, cfe-commits

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

llvm-svn: 329372

6 years agoChange which file we print when a symbol cannot be ordered.
Rafael Espindola [Fri, 6 Apr 2018 03:36:19 +0000 (03:36 +0000)]
Change which file we print when a symbol cannot be ordered.

Currently there are a few odd things about the warning about symbols
that cannot be ordered. This patch fixes:

* When there is an undefined symbol that resolves to a shared file, we
  were printing the location of the undefined reference.

* If there are multiple comdats, we were reporting them all.

llvm-svn: 329371

6 years agoCOFF: Create output sections early. NFCI.
Peter Collingbourne [Fri, 6 Apr 2018 03:25:49 +0000 (03:25 +0000)]
COFF: Create output sections early. NFCI.

With this, all output sections are created in one place. This will make
it simpler to implement merging of builtin sections.

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

llvm-svn: 329370

6 years ago[LLVM-C] Audit Inline Assembly APIs for Consistency
Robert Widmann [Fri, 6 Apr 2018 02:31:29 +0000 (02:31 +0000)]
[LLVM-C] Audit Inline Assembly APIs for Consistency

Summary:
- Add a missing getter for module-level inline assembly
- Add a missing append function for module-level inline assembly
- Deprecate LLVMSetModuleInlineAsm and replace it with LLVMSetModuleInlineAsm2 which takes an explicit length parameter
- Deprecate LLVMConstInlineAsm and replace it with LLVMGetInlineAsm, a function that allows passing a dialect and is not mis-classified as a constant operation

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 329369

6 years agoUpdate method names in documentation.
Rafael Espindola [Fri, 6 Apr 2018 01:21:48 +0000 (01:21 +0000)]
Update method names in documentation.

They were renamed in r328848.

llvm-svn: 329368

6 years agoDon't ignore addend when a SHF_MERGE section is dead.
Rafael Espindola [Fri, 6 Apr 2018 01:10:33 +0000 (01:10 +0000)]
Don't ignore addend when a SHF_MERGE section is dead.

This is similar to r329219, but for the entire section. Like r329219 I
don't expect this to have any real impact, it is just more consistent
and simpler.

llvm-svn: 329367

6 years agoCMake option to allow enabling experimental new pass manager by default
Petr Hosek [Fri, 6 Apr 2018 00:53:00 +0000 (00:53 +0000)]
CMake option to allow enabling experimental new pass manager by default

This CMake flag allows setting the default value for the
-f[no]-experimental-new-pass-manager flag.

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

llvm-svn: 329366

6 years agoFix lld-x86_64-darwin13 build fails.
Manoj Gupta [Thu, 5 Apr 2018 23:23:29 +0000 (23:23 +0000)]
Fix lld-x86_64-darwin13 build fails.

Use double braces in std::array initialization
to keep Darwin builders happy.

llvm-svn: 329363

6 years ago[InstCombine] FP: Z - (X - Y) --> Z + (Y - X)
Sanjay Patel [Thu, 5 Apr 2018 23:21:15 +0000 (23:21 +0000)]
[InstCombine] FP: Z - (X - Y) --> Z + (Y - X)

This restores what was lost with rL73243 but without
re-introducing the bug that was present in the old code.

Note that we already have these transforms if the ops are
marked 'fast' (and I assume that's happening somewhere in
the code added with rL170471), but we clearly don't need
all of 'fast' for these transforms.

llvm-svn: 329362

6 years agoFix test added in r329301 to work properly with Windows paths.
Douglas Yung [Thu, 5 Apr 2018 22:58:14 +0000 (22:58 +0000)]
Fix test added in r329301 to work properly with Windows paths.

llvm-svn: 329361

6 years ago[InstCombine] add FP tests for Z - (X - Y); NFC
Sanjay Patel [Thu, 5 Apr 2018 22:56:54 +0000 (22:56 +0000)]
[InstCombine] add FP tests for Z - (X - Y); NFC

A fold for this pattern was removed at rL73243 to fix PR4374:
https://bugs.llvm.org/show_bug.cgi?id=4374
...and apparently there were no tests that went with that fold.

llvm-svn: 329360

6 years agoAttempt to fix Mips breakages.
Manoj Gupta [Thu, 5 Apr 2018 22:47:25 +0000 (22:47 +0000)]
Attempt to fix Mips breakages.

Summary:
Replace ArrayRefs by actual std::array objects so that there are
no dangling references.

Reviewers: rsmith, gkistanova

Subscribers: sdardis, arichardson, llvm-commits

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

llvm-svn: 329359

6 years ago[dotest] --skip-category should append and not override.
Davide Italiano [Thu, 5 Apr 2018 22:46:39 +0000 (22:46 +0000)]
[dotest] --skip-category should append and not override.

<rdar://problem/38566150>

llvm-svn: 329358

6 years ago[Sema] Revert r329346 because of memory sanitizer failures.
Eugene Zelenko [Thu, 5 Apr 2018 22:15:42 +0000 (22:15 +0000)]
[Sema] Revert r329346 because of memory sanitizer failures.

llvm-svn: 329357

6 years agoX86 Tests: Add a case for combining sdiv by a splatted pow2 negative. NFC.
Zvi Rackover [Thu, 5 Apr 2018 21:57:20 +0000 (21:57 +0000)]
X86 Tests: Add a case for combining sdiv by a splatted pow2 negative. NFC.

Noticed test was missing while working on D42479.

llvm-svn: 329356

6 years ago[RuntimeDyld][PowerPC] Add a test case for r329335.
Lang Hames [Thu, 5 Apr 2018 21:56:55 +0000 (21:56 +0000)]
[RuntimeDyld][PowerPC] Add a test case for r329335.

Checks that calls to different sections go to the function's global entry point,
rather than the local one.

llvm-svn: 329355

6 years ago[X86] Separate CDQ and CDQE in the scheduler model.
Craig Topper [Thu, 5 Apr 2018 21:56:19 +0000 (21:56 +0000)]
[X86] Separate CDQ and CDQE in the scheduler model.

According to Agner's data, CDQE is closer to CWDE.

llvm-svn: 329354

6 years ago[IR] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Thu, 5 Apr 2018 21:52:24 +0000 (21:52 +0000)]
[IR] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to
llvm::sort.  Refer D44363 for a list of all the required patches.

llvm-svn: 329353

6 years agoAdd a couple more tests for DR372.
Richard Smith [Thu, 5 Apr 2018 21:49:20 +0000 (21:49 +0000)]
Add a couple more tests for DR372.

llvm-svn: 329352

6 years ago[X86] Add MOVZPQILo2PQIrr to the Sandy Bridge scheduler model
Craig Topper [Thu, 5 Apr 2018 21:40:32 +0000 (21:40 +0000)]
[X86] Add MOVZPQILo2PQIrr to the Sandy Bridge scheduler model

llvm-svn: 329351

6 years ago[InstCombine] nsz: -(X - Y) --> Y - X
Sanjay Patel [Thu, 5 Apr 2018 21:37:17 +0000 (21:37 +0000)]
[InstCombine] nsz: -(X - Y) --> Y - X

This restores part of the fold that was removed with rL73243 (PR4374).

llvm-svn: 329350

6 years ago[InstCombine][NFC] Regenerate select-of-bittest.ll with instnamer pass
Roman Lebedev [Thu, 5 Apr 2018 21:34:59 +0000 (21:34 +0000)]
[InstCombine][NFC] Regenerate select-of-bittest.ll with instnamer pass

As requested by spatel in https://reviews.llvm.org/D45329

llvm-svn: 329349

6 years ago[InstCombine] [NFC] Add more tests for getting rid of select of bittest (D45108,...
Roman Lebedev [Thu, 5 Apr 2018 21:34:53 +0000 (21:34 +0000)]
[InstCombine] [NFC] Add more tests for getting rid of select of bittest (D45108, PR36950 / PR17564)

Summary:
More tests for D45108:
* One use tests
* allow shift to be a variable, too

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 329348

6 years ago[X86] Add LEAVE instruction to the scheduler models using the same data as LEAVE64...
Craig Topper [Thu, 5 Apr 2018 21:16:26 +0000 (21:16 +0000)]
[X86] Add LEAVE instruction to the scheduler models using the same data as LEAVE64. Make LEAVE/LEAVE64 more correct on Sandy Bridge.

This is the 32-bit mode version of LEAVE64. It should be at least somewhat similar to LEAVE64.

The Sandy Bridge version was missing a load port use.

llvm-svn: 329347

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 5 Apr 2018 21:09:03 +0000 (21:09 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 329346

6 years ago[DWARF v5][NFC]: Refactor DebugRnglists to prepare for the support of the DW_AT_ranges
Wolfgang Pieb [Thu, 5 Apr 2018 21:01:49 +0000 (21:01 +0000)]
[DWARF v5][NFC]: Refactor DebugRnglists to prepare for the support of the DW_AT_ranges
 attribute in conjunction with .debug_rnglists.

Reviewers: JDevlieghere

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

llvm-svn: 329345

6 years ago[X86][SSE] Add floating point add/mul fast-math vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 21:01:21 +0000 (21:01 +0000)]
[X86][SSE] Add floating point add/mul fast-math vector.reduce tests

Strict versions aren't working at all (PR36732) and the accumulators aren't supported (PR36734)

llvm-svn: 329344

6 years ago[X86][SSE] Add floating point min/max vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 20:54:55 +0000 (20:54 +0000)]
[X86][SSE] Add floating point min/max vector.reduce tests

llvm-svn: 329343

6 years agoPR36992: do not store beyond the dsize of a class object unless we know
Richard Smith [Thu, 5 Apr 2018 20:52:58 +0000 (20:52 +0000)]
PR36992: do not store beyond the dsize of a class object unless we know
the tail padding is not reused.

We track on the AggValueSlot (and through a couple of other
initialization actions) whether we're dealing with an object that might
share its tail padding with some other object, so that we can avoid
emitting stores into the tail padding if that's the case. We still
widen stores into tail padding when we can do so.

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

llvm-svn: 329342

6 years agoAMDGPU/Metadata: Always report a fixed number of hidden arguments
Konstantin Zhuravlyov [Thu, 5 Apr 2018 20:46:04 +0000 (20:46 +0000)]
AMDGPU/Metadata: Always report a fixed number of hidden arguments

Currently it is 6. If the "feature" was not used, report dummy
hidden argument. Otherwise it does not match the kernarg size
reported in the kernel header.

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

llvm-svn: 329341

6 years ago[cmake] Remove duplicate command line options from build
Aaron Smith [Thu, 5 Apr 2018 20:27:50 +0000 (20:27 +0000)]
[cmake] Remove duplicate command line options from build

CMAKE_CXX_FLAGS and CMAKE_C_FLAGS are added twice to the command line.
This causes the command line options to be doubled which works until
it doesn't as not all options can be specified twice.

For example,

clang-cl foo.c /GS- /GS- -mllvm -small-loop-cost=1 -mllvm -small-loop-cost=1
clang (LLVM option parsing): for the -small-loop-cost option: may only occur zero or one times!

llvm-svn: 329340

6 years ago[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.
Craig Topper [Thu, 5 Apr 2018 20:04:06 +0000 (20:04 +0000)]
[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.

We were forcing the latency of these instructions to 5 cycles, but every other scheduler model had them as 1 cycle. I'm sure I didn't get everything, but this gets a big portion.

llvm-svn: 329339

6 years ago[llvm-cov] Prevent llvm-cov from hanging when a symblink doesn't exist.
Max Moroz [Thu, 5 Apr 2018 19:43:24 +0000 (19:43 +0000)]
[llvm-cov] Prevent llvm-cov from hanging when a symblink doesn't exist.

Summary:
Previous code hangs indefinitely when trying to iterate through a
symbol link file that points to an non-exist directory. This change
fixes the bug to make the addCollectedPath function exit ealier and
print out correct warning messages.

Patch by Yuke Liao (@liaoyuke).

Reviewers: Dor1s, vsk

Reviewed By: vsk

Subscribers: bruno, mgrang, llvm-commits

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

llvm-svn: 329338

6 years ago[WebAssembly] Remove StackPointerGlobal member variable from the driver.
Rui Ueyama [Thu, 5 Apr 2018 19:37:48 +0000 (19:37 +0000)]
[WebAssembly] Remove StackPointerGlobal member variable from the driver.

Since InputGlobal makes a copy of a given object, we can use a temporary
object allocated on the stack here.

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

llvm-svn: 329337

6 years ago[WebAssembly] Remove another trivial accessor.
Rui Ueyama [Thu, 5 Apr 2018 19:37:31 +0000 (19:37 +0000)]
[WebAssembly] Remove another trivial accessor.

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

llvm-svn: 329336

6 years ago[RuntimeDyld][PowerPC] Use global entry points for calls between sections.
Lang Hames [Thu, 5 Apr 2018 19:37:05 +0000 (19:37 +0000)]
[RuntimeDyld][PowerPC] Use global entry points for calls between sections.

Functions in different objects may use different TOCs, so calls between such
functions should use the global entry point of the callee which updates the
TOC pointer.

This should fix a bug that the Numba developers encountered (see
https://github.com/numba/numba/issues/2451).

Patch by Olexa Bilaniuk. Thanks Olexa!

No RuntimeDyld checker test case yet as I am not familiar enough with how
RuntimeDyldELF fixes up call-sites, but I do not want to hold up landing
this. I will continue to work on it and see if I can rope some powerpc
experts in.

llvm-svn: 329335

6 years ago[Bitcode] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Thu, 5 Apr 2018 19:27:04 +0000 (19:27 +0000)]
[Bitcode] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: pcc, mehdi_amini, dexonsmith

Reviewed By: dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 329334

6 years ago[ELF] Add CHECK to test/ELF/undef-start.s
Fangrui Song [Thu, 5 Apr 2018 19:20:33 +0000 (19:20 +0000)]
[ELF] Add CHECK to test/ELF/undef-start.s

llvm-svn: 329333

6 years agoDR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
Richard Smith [Thu, 5 Apr 2018 18:55:37 +0000 (18:55 +0000)]
DR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
layout" rules.

The new rules say that a standard-layout struct has its first non-static
data member and all base classes at offset 0, and consider a class to
not be standard-layout if that would result in multiple subobjects of a
single type having the same address.

We track "is C++11 standard-layout class" separately from "is
standard-layout class" so that the ABIs that need this information can
still use it.

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

llvm-svn: 329332

6 years ago[InstCombine] Properly change GEP type when reassociating loop invariant GEP chains
Daniel Neilson [Thu, 5 Apr 2018 18:51:45 +0000 (18:51 +0000)]
[InstCombine] Properly change GEP type when reassociating loop invariant GEP chains

Summary:
This is a fix to PR37005.

Essentially, rL328539 ([InstCombine] reassociate loop invariant GEP chains to enable LICM) contains a bug
whereby it will convert:
%src = getelementptr inbounds i8, i8* %base, <2 x i64> %val
%res = getelementptr inbounds i8, <2 x i8*> %src, i64 %val2
into:
%src = getelementptr inbounds i8, i8* %base, i64 %val2
%res = getelementptr inbounds i8, <2 x i8*> %src, <2 x i64> %val

By swapping the index operands if the GEPs are in a loop, and %val is loop variant while %val2
is loop invariant.

This fix recreates new GEP instructions if the index operand swap would result in the type
of %src changing from vector to scalar, or vice versa.

Reviewers: sebpop, spatel

Reviewed By: sebpop

Subscribers: llvm-commits

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

llvm-svn: 329331

6 years ago[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.
Craig Topper [Thu, 5 Apr 2018 18:38:45 +0000 (18:38 +0000)]
[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.

Mostly vector load, store, and move instructions.

llvm-svn: 329330

6 years ago[ARM] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Thu, 5 Apr 2018 18:31:50 +0000 (18:31 +0000)]
[ARM] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: t.p.northover, RKSimon, MatzeB, bkramer

Reviewed By: bkramer

Subscribers: javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 329329

6 years agoSilence msvc warning on isl. NFC.
Michael Kruse [Thu, 5 Apr 2018 18:30:44 +0000 (18:30 +0000)]
Silence msvc warning on isl. NFC.

The warning is:

    isl_union_map.c(2041): warning C4221: nonstandard extension used: 'filter_user': cannot be initialized using address of automatic variable 'data'

for the following code (and others)

struct isl_un_op_drop_user_data data = { &isl_set_is_wrapping };
struct isl_un_op_control control = {
.filter = &un_op_filter_drop_user,
.filter_user = &data,
.fn_map = &isl_set_wrapped_domain_map,
};

llvm-svn: 329328

6 years ago[X86] Disassembler support for having an ADSIZE prefix affect instructions with 0xf2...
Craig Topper [Thu, 5 Apr 2018 18:20:14 +0000 (18:20 +0000)]
[X86] Disassembler support for having an ADSIZE prefix affect instructions with 0xf2 and 0xf3 prefixes.

Needed to support umonitor from D45253.

llvm-svn: 329327

6 years ago[llvm-pdbutil] Display types from MSVC precompiled header object files.
Zachary Turner [Thu, 5 Apr 2018 18:18:12 +0000 (18:18 +0000)]
[llvm-pdbutil] Display types from MSVC precompiled header object files.

These appear in a .debug$P section, which is exactly the same in
format as a .debug$T section.  So we shouldn't ignore these when
dumping types.

llvm-svn: 329326

6 years agollvm-exegesis: Fix unittests include dirs when llvm is a part of another project
Konstantin Zhuravlyov [Thu, 5 Apr 2018 18:16:02 +0000 (18:16 +0000)]
llvm-exegesis: Fix unittests include dirs when llvm is a part of another project

When llvm is a part of another project (i.e. opencl),
CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR are pointing to
the parent project, which lead to build failures.

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

llvm-svn: 329325

6 years agoRemove the temporary availability checking workaround for
Alex Lorenz [Thu, 5 Apr 2018 18:12:06 +0000 (18:12 +0000)]
Remove the temporary availability checking workaround for
the nested declarations in @interface.

rdar://28825862

llvm-svn: 329324

6 years agoFix typo in comment -fmath-errno=0 -> -fno-math-errno
Sam Clegg [Thu, 5 Apr 2018 17:44:08 +0000 (17:44 +0000)]
Fix typo in comment -fmath-errno=0 -> -fno-math-errno

The former is not a valid clang argument

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

llvm-svn: 329323

6 years ago[InstCombine] add test for fneg+fsub with nsz; NFC
Sanjay Patel [Thu, 5 Apr 2018 17:40:51 +0000 (17:40 +0000)]
[InstCombine] add test for fneg+fsub with nsz; NFC

There used to be a fold that would handle this case more generally,
but it was removed at rL73243 to fix PR4374:
https://bugs.llvm.org/show_bug.cgi?id=4374

llvm-svn: 329322

6 years ago[X86][SSE] Add integer add/mul vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 17:37:35 +0000 (17:37 +0000)]
[X86][SSE] Add integer add/mul vector.reduce tests

llvm-svn: 329321

6 years ago[X86][SSE] Add integer and/or/xor vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 17:29:51 +0000 (17:29 +0000)]
[X86][SSE] Add integer and/or/xor vector.reduce tests

llvm-svn: 329320

6 years ago[X86][SSE] Add integer min/max vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 17:25:40 +0000 (17:25 +0000)]
[X86][SSE] Add integer min/max vector.reduce tests

llvm-svn: 329319

6 years agoAnother fix for r329293: Unbreak the windows bots
Philip Pfaffe [Thu, 5 Apr 2018 17:20:45 +0000 (17:20 +0000)]
Another fix for r329293: Unbreak the windows bots

Only build the unittest if plugins are enabled. Link components into the
TestPlugin on windows and cygwin.

llvm-svn: 329318

6 years agoMake "Size" column in the map file one characters shorter.
Rui Ueyama [Thu, 5 Apr 2018 17:20:18 +0000 (17:20 +0000)]
Make "Size" column in the map file one characters shorter.

Previously, "size" column is 9 characters long which is too long
at least for 32-bit (because at maximum it needs 8 columns). This
patch make it one column shorter than before. That's also a reasonable
default for 64-bit.

llvm-svn: 329317

6 years ago[InstCombine] use pattern matchers for fsub --> fadd folds
Sanjay Patel [Thu, 5 Apr 2018 17:06:45 +0000 (17:06 +0000)]
[InstCombine] use pattern matchers for fsub --> fadd folds

This allows folding for vectors with undef elements.

llvm-svn: 329316

6 years ago[WebAssembly] Allow for the creation of user-defined custom sections
Sam Clegg [Thu, 5 Apr 2018 17:01:39 +0000 (17:01 +0000)]
[WebAssembly] Allow for the creation of user-defined custom sections

This patch adds a way for users to create their own custom sections to
be added to wasm files. At the LLVM IR layer, they are defined through
the "wasm.custom_sections" named metadata. The expected use case for
this is bindings generators such as wasm-bindgen.

Patch by Dan Gohman

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

llvm-svn: 329315

6 years agoOne more windows build fix
Pavel Labath [Thu, 5 Apr 2018 16:59:36 +0000 (16:59 +0000)]
One more windows build fix

llvm-svn: 329314

6 years ago[InstCombine] add tests for fsub --> fadd; NFC
Sanjay Patel [Thu, 5 Apr 2018 16:51:09 +0000 (16:51 +0000)]
[InstCombine] add tests for fsub --> fadd; NFC

llvm-svn: 329313

6 years agoFix column size in the map file.
Rui Ueyama [Thu, 5 Apr 2018 16:45:37 +0000 (16:45 +0000)]
Fix column size in the map file.

Size can be narrow, but LMA should be the same width as VMA.

llvm-svn: 329312

6 years ago[documentation][llvm-mca] Update the documentation.
Andrea Di Biagio [Thu, 5 Apr 2018 16:42:32 +0000 (16:42 +0000)]
[documentation][llvm-mca] Update the documentation.

Scheduling models can now describe processor register files and retire control
units. This updates the existing documentation and the README file.

llvm-svn: 329311

6 years ago[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which...
Craig Topper [Thu, 5 Apr 2018 16:32:48 +0000 (16:32 +0000)]
[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which uses WriteShuffle256.

llvm-svn: 329310

6 years agoFix windows build after r329296
Pavel Labath [Thu, 5 Apr 2018 16:23:54 +0000 (16:23 +0000)]
Fix windows build after r329296

Add a couple of #include <csignal>s.

llvm-svn: 329309

6 years agoFix r329293: Add a missing CMake dependency
Philip Pfaffe [Thu, 5 Apr 2018 15:58:27 +0000 (15:58 +0000)]
Fix r329293:  Add a missing CMake dependency

The unittest plugin indirectly includes Attributes.gen, so make sure its
target depends on the appropriate tablegen target.

llvm-svn: 329308

6 years agoInitialize OutputOff to zero.
Rafael Espindola [Thu, 5 Apr 2018 15:56:04 +0000 (15:56 +0000)]
Initialize OutputOff to zero.

We have a dedicated Live bit, so we don't need a special value and we
were not accounting for in at least one place.

llvm-svn: 329307

6 years agoFix the buildbots after r329304.
Andrea Di Biagio [Thu, 5 Apr 2018 15:53:31 +0000 (15:53 +0000)]
Fix the buildbots after r329304.

llvm-svn: 329306

6 years agoCleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit
Greg Clayton [Thu, 5 Apr 2018 15:52:39 +0000 (15:52 +0000)]
Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

Many things that were in DWARFCompileUnit actually need to be in DWARFUnit. This patch moves all DWARFUnit specific things over into DWARFUnit and fixes the layering. This is in preparation for adding DWARFTypeUnit for the .debug_types patch.

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

llvm-svn: 329305

6 years ago[MC][Tablegen] Allow models to describe the retire control unit for llvm-mca.
Andrea Di Biagio [Thu, 5 Apr 2018 15:41:41 +0000 (15:41 +0000)]
[MC][Tablegen] Allow models to describe the retire control unit for llvm-mca.

This patch adds the ability to describe properties of the hardware retire
control unit.

Tablegen class RetireControlUnit has been added for this purpose (see
TargetSchedule.td).

A RetireControlUnit specifies the size of the reorder buffer, as well as the
maximum number of opcodes that can be retired every cycle.

A zero (or negative) value for the reorder buffer size means: "the size is
unknown". If the size is unknown, then llvm-mca defaults it to the value of
field SchedMachineModel::MicroOpBufferSize.  A zero or negative number of
opcodes retired per cycle means: "there is no restriction on the number of
instructions that can be retired every cycle".

Models can optionally specify an instance of RetireControlUnit. There can only
be up-to one RetireControlUnit definition per scheduling model.

Information related to the RCU (RetireControlUnit) is stored in (two new fields
of) MCExtraProcessorInfo.  llvm-mca loads that information when it initializes
the DispatchUnit / RetireControlUnit (see Dispatch.h/Dispatch.cpp).

This patch fixes PR36661.

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

llvm-svn: 329304

6 years ago[PatternMatch] define m_FNeg using m_FSub
Sanjay Patel [Thu, 5 Apr 2018 15:36:55 +0000 (15:36 +0000)]
[PatternMatch] define m_FNeg using m_FSub

Using cstfp_pred_ty in the definition allows us to match vectors with undef elements.

This replicates the change for m_Not from D44076 / rL326823 and continues
towards making all pattern matchers allow undef elements in vectors.

llvm-svn: 329303

6 years agoRemove namespace comment at end of class. NFC.
Michael Kruse [Thu, 5 Apr 2018 15:32:06 +0000 (15:32 +0000)]
Remove namespace comment at end of class. NFC.

The
}; // namespace polly
comment was put at the closing brace of the FunctionToScopPassAdaptor class.
Since no namespace ends here, the comment is misplaced.

Reported-by: Lukas Böhm <lukas.boehm93@gmail.com>
llvm-svn: 329302

6 years ago[ASTImporter] Fix for importing unnamed structs
Aleksei Sidorin [Thu, 5 Apr 2018 15:31:49 +0000 (15:31 +0000)]
[ASTImporter] Fix for importing unnamed structs

Patch by Peter Szecsi!

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

llvm-svn: 329301

6 years agoDisable -fmerge-all-constants as default.
Manoj Gupta [Thu, 5 Apr 2018 15:29:52 +0000 (15:29 +0000)]
Disable -fmerge-all-constants as default.

Summary:
"-fmerge-all-constants" is a non-conforming optimization and should not
be the default. It is also causing miscompiles when building Linux
Kernel (https://lkml.org/lkml/2018/3/20/872).

Fixes PR18538.

Reviewers: rjmccall, rsmith, chandlerc

Reviewed By: rsmith, chandlerc

Subscribers: srhines, cfe-commits

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

llvm-svn: 329300

6 years ago[PowerPC] fix assertion failure due to missing instruction in P9InstrResources.td
Hiroshi Inoue [Thu, 5 Apr 2018 15:27:06 +0000 (15:27 +0000)]
[PowerPC] fix assertion failure due to missing instruction in P9InstrResources.td

This patch adds L(W|H|B)ZXTLS_32 instructions introduced by https://reviews.llvm.org/rL327635 in P9InstrResources.td.

llvm-svn: 329299

6 years ago[clang-format] Support lightweight Objective-C generics
Ben Hamilton [Thu, 5 Apr 2018 15:26:25 +0000 (15:26 +0000)]
[clang-format] Support lightweight Objective-C generics

Summary:
Previously, `clang-format` didn't understand lightweight
Objective-C generics, which have the form:

```
@interface Foo <KeyType,
                ValueTypeWithConstraint : Foo,
AnotherValueTypeWithGenericConstraint: Bar<Baz>, ... > ...
```

The lightweight generic specifier list appears before the base
class, if present, but because it starts with < like the protocol
specifier list, `UnwrappedLineParser` was getting confused and
failed to parse interfaces with both generics and protocol lists:

```
@interface Foo <KeyType> : NSObject <NSCopying>
```

Since the parsed line would be incomplete, the format result
would be very confused (e.g., https://bugs.llvm.org/show_bug.cgi?id=24381).

This fixes the issue by explicitly parsing the ObjC lightweight
generic conformance list, so the line is fully parsed.

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

Test Plan: New tests added. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 329298

6 years ago[clang-format] Ensure ObjC selectors with 0 args are annotated correctly
Ben Hamilton [Thu, 5 Apr 2018 15:26:23 +0000 (15:26 +0000)]
[clang-format] Ensure ObjC selectors with 0 args are annotated correctly

Summary:
Previously, clang-format would incorrectly annotate 0-argument
Objective-C selector names as TT_TrailingAnnotation:

```
% echo "-(void)foo;" > /tmp/test.m
% ./bin/clang-format -debug /tmp/test.m
Language: Objective-C
----
Line(0, FSC=0): minus[T=68, OC=0] l_paren[T=68, OC=1] void[T=68, OC=2]
r_paren[T=68, OC=6] identifier[T=68, OC=7] semi[T=68, OC=10]
Line(0, FSC=0): eof[T=68, OC=0]
Run 0...
AnnotatedTokens(L=0):
 M=0 C=0 T=ObjCMethodSpecifier S=1 B=0 BK=0 P=0 Name=minus L=1 PPK=2
 FakeLParens= FakeRParens=0 Text='-'
 M=0 C=1 T=Unknown S=1 B=0 BK=0 P=33 Name=l_paren L=3 PPK=2
 FakeLParens= FakeRParens=0 Text='('
 M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=void L=7 PPK=2 FakeLParens=
 FakeRParens=0 Text='void'
 M=0 C=0 T=CastRParen S=0 B=0 BK=0 P=43 Name=r_paren L=8 PPK=2
 FakeLParens= FakeRParens=0 Text=')'
 M=0 C=1 T=TrailingAnnotation S=0 B=0 BK=0 P=120 Name=identifier L=11
 PPK=2 FakeLParens= FakeRParens=0 Text='foo'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=23 Name=semi L=12 PPK=2 FakeLParens=
 FakeRParens=0 Text=';'
```

This caused us to incorrectly indent 0-argument wrapped selectors
when Style.IndentWrappedFunctionNames was false, as we thought
the 0-argument ObjC selector name was actually a trailing
annotation (which is always indented).

This diff fixes the issue and adds tests.

Test Plan: New tests added. Confirmed tests failed before diff.
  After diff, tests passed. Ran tests with:
  % make -j12 FormatTests &&
  ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper, jolesiak

Subscribers: klimek, cfe-commits

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

llvm-svn: 329297

6 years agoRemove unused NativeProcessProtocol.h include from Platform.h
Pavel Labath [Thu, 5 Apr 2018 15:17:51 +0000 (15:17 +0000)]
Remove unused NativeProcessProtocol.h include from Platform.h

After removing it, I got a couple of compile errors because we were
missing some symbols (SIGKILL and such), as their definitions were not
transitively included anymore. I fix this by including csignal from
PosixApi.h, as it's windows version provides a stub definitions of these
symbols. This should make the result of #including PosixApi.h more
consistent across platforms (although in the long run, we should just
get rid of this header).

llvm-svn: 329296

6 years agoFix error in QEnableErrorStrings gdb-remote docs
Pavel Labath [Thu, 5 Apr 2018 15:17:43 +0000 (15:17 +0000)]
Fix error in QEnableErrorStrings gdb-remote docs

this probably happened because we changed the name of the packet
mid-review.

llvm-svn: 329295

6 years ago[InstCombine] add vector and vector undef tests for FP folds; NFC
Sanjay Patel [Thu, 5 Apr 2018 15:07:35 +0000 (15:07 +0000)]
[InstCombine] add vector and vector undef tests for FP folds; NFC

llvm-svn: 329294

6 years agoRe-land r329273: [Plugins] Add a slim plugin API to work together with the new PM
Philip Pfaffe [Thu, 5 Apr 2018 15:04:13 +0000 (15:04 +0000)]
Re-land r329273: [Plugins] Add a slim plugin API to work together with the new PM

Fix unittest: Do not link LLVM into the test plugin.
Additionally, remove an unrelated change that slipped in in r329273.

llvm-svn: 329293

6 years ago[clang-tidy] Remove google-runtime-member-string-references
Benjamin Kramer [Thu, 5 Apr 2018 14:51:01 +0000 (14:51 +0000)]
[clang-tidy] Remove google-runtime-member-string-references

This is triggering on a pattern that's both too broad (const
std::string& members can be used safely) and too narrow (std::string is
not the only class with this problem). It has a very low true positive
rate, just remove it until we find a better solution for dangling string
references.

llvm-svn: 329292

6 years agor600: Update datalayout after LLVM r328656
Jan Vesely [Thu, 5 Apr 2018 14:47:57 +0000 (14:47 +0000)]
r600: Update datalayout after LLVM r328656

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 329291

6 years agoamdgcn: Update datalayout after LLVM r328656
Jan Vesely [Thu, 5 Apr 2018 14:47:44 +0000 (14:47 +0000)]
amdgcn: Update datalayout after LLVM r328656

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 329290

6 years ago[ObjC] Make C++ triviality type traits available to non-trivial C
Akira Hatanaka [Thu, 5 Apr 2018 14:39:57 +0000 (14:39 +0000)]
[ObjC] Make C++ triviality type traits available to non-trivial C
structs.

r326307 and r327870 made changes that allowed using non-trivial C
structs with fields qualified with __strong or __weak. This commit makes
the following C++ triviality type traits available to non-trivial C
structs:

__has_trivial_assign
__has_trivial_move_assign
__has_trivial_copy
__has_trivial_move_constructor
__has_trivial_constructor
__has_trivial_destructor

This reapplies r328680. This commit fixes a bug where the copy/move
__has_trivial_* traits would return false when a volatile type was being
passed. Thanks to Richard Smith for pointing out the mistake.

rdar://problem/33599681

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

llvm-svn: 329289

6 years ago[Testing/Support]: Better matching of Error failure states
Pavel Labath [Thu, 5 Apr 2018 14:32:10 +0000 (14:32 +0000)]
[Testing/Support]: Better matching of Error failure states

Summary:
The existing Failed() matcher only allowed asserting that the operation
failed, but it was not possible to verify any details of the returned
error.

This patch adds two new matchers, which make this possible:
- Failed<InfoT>() verifies that the operation failed with a single error
  of a given type.
- Failed<InfoT>(M) additionally check that the contained error info
  object is matched by the nested matcher M.

To make these work, I've changed the implementation of the ErrorHolder
class. Now, instead of just storing the string representation of the
Error, it fetches the ErrorInfo objects and stores then as a list of
shared pointers. This way, ErrorHolder remains copyable, while still
retaining the full information contained in the Error object.

In case the Error object contains two or more errors, the new matchers
will fail to match, instead of trying to match all (or any) of the
individual ErrorInfo objects. This seemed to be the most sensible
behavior for when one wants to match exact error details, but I could be
convinced otherwise...

Reviewers: zturner, lhames

Subscribers: llvm-commits

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

llvm-svn: 329288

6 years agoARM: Do not spill CSR to stack on entry to noreturn functions
Tim Northover [Thu, 5 Apr 2018 14:26:06 +0000 (14:26 +0000)]
ARM: Do not spill CSR to stack on entry to noreturn functions

A noreturn nounwind function can be expected to never return in any way, and by
never returning it will also never have to restore any callee-saved registers
for its caller. This makes it possible to skip spills of those registers during
function entry, saving some stack space and time in the process. This is rather
useful for embedded targets with limited stack space.

Should fix PR9970.

Patch by myeisha (pmb).

llvm-svn: 329287