platform/upstream/llvm.git
6 years ago[ARM] Replace development diagnostics with normal DEBUG macro
Oliver Stannard [Tue, 24 Oct 2017 09:46:56 +0000 (09:46 +0000)]
[ARM] Replace development diagnostics with normal DEBUG macro

* Remove the -arm-asm-parser-dev-diags option.
* Use normal DEBUG(dbgs()) printing for the extra development information about
  missing diagnostics.

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

llvm-svn: 316423

6 years agoRestore the fix rL316059 eliminated by rL316372
Serguei Katkov [Tue, 24 Oct 2017 09:42:55 +0000 (09:42 +0000)]
Restore the fix rL316059 eliminated by rL316372

rL316059 fixed the potential build failure when compiling
with -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON.

rL316372 just reverted the part of the fix, so restore it.

llvm-svn: 316422

6 years ago[ARM] tSETEND needs IsThumb
Oliver Stannard [Tue, 24 Oct 2017 09:03:33 +0000 (09:03 +0000)]
[ARM] tSETEND needs IsThumb

This is the Thumb encoding, so the Requires list must include IsThumb.

No test because we happen to select the ARM one first, but that's just luck.

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

llvm-svn: 316421

6 years ago[ARM] Remove tCPS alias which just crashed
Oliver Stannard [Tue, 24 Oct 2017 08:55:36 +0000 (08:55 +0000)]
[ARM] Remove tCPS alias which just crashed

This alias caused a crash when trying to print the "cps #0" instruction in a
diagnostic for thumbv6 (which doesn't have that instruction).

The comment was incorrect, this instruction is UNPREDICTABLE if no flag bits
are set, so I don't think it's worth keeping.

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

llvm-svn: 316420

6 years agoSupport formatv of TimePoint with strftime-style formats.
Sam McCall [Tue, 24 Oct 2017 08:30:19 +0000 (08:30 +0000)]
Support formatv of TimePoint with strftime-style formats.

Summary:
Support formatv of TimePoint with strftime-style formats.

Extensions for millis/micros/nanos are added.
Inital use case is HH:MM:SS.MMM timestamps in clangd logs.

Reviewers: bkramer, ilya-biryukov

Subscribers: labath, llvm-commits

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

llvm-svn: 316419

6 years ago[ELF] - Do not collect SHT_REL[A] sections unconditionally when --gc-sections and...
George Rimar [Tue, 24 Oct 2017 08:26:32 +0000 (08:26 +0000)]
[ELF] - Do not collect SHT_REL[A] sections unconditionally when --gc-sections and --emit-relocs used together.

This is "Bug 34836 - --gc-sections remove relocations from --emit-relocs",

When --emit-relocs is used, LLD currently always drops SHT_REL[A] sections from
output if --gc-sections is present. Patch fixes the issue.

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

llvm-svn: 316418

6 years ago[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)
Clement Courbet [Tue, 24 Oct 2017 08:05:07 +0000 (08:05 +0000)]
[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)

Refactor ExpandMemcmp:

 - Stop duplicating the logic for computation of the sequence of loads to
   generate (thsi was done in three different places), this is now done
   only once in MemCmpExpansion::MemCmpExpansion().

 - Add a FIXME to expose a bug with the computation of the number of loads
   when not all sizes are loadable. For example, on X86-32 + SSE, possible
   loads are {16,4,2,1} bytes. The current code considers that all loads
   starting at MaxLoadSize are possible. This is not an issue right now as
   vector loads are not enabled, so I'm not fixing the issue here to keep
   the change as small as possible. I'm going to address this in a
   subsequent revision, where I enable vector loads.

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

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

llvm-svn: 316417

6 years agoX86: Fix X86CallFrameOptimization to search for the COPY StackPointer
Zvi Rackover [Tue, 24 Oct 2017 07:38:29 +0000 (07:38 +0000)]
X86: Fix X86CallFrameOptimization to search for the COPY StackPointer

SelectionDAG inserts a copy of ESP into a virtual register.
X86CallFrameOptimization assumed that the COPY, if present, is always
right after the call-frame setup instruction (ADJCALLSTACKDOWN). This was a
wrong assumption as the COPY can be located anywhere between the call-frame setup
instruction and its first use. If the COPY happened to be located in a different
location than what X86CallFrameOptimization assumed, visiting it while
processing the call chain would lead to a conservative bail-out.

The fix is quite straightfoward, scan ahead for the stack-pointer copy and make note
of it so it can be ignored while processing the call chain.

Fixes pr34903

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

llvm-svn: 316416

6 years agoAdd missing checks for register number
Martin Storsjo [Tue, 24 Oct 2017 07:16:40 +0000 (07:16 +0000)]
Add missing checks for register number

Most other cases that touch savedRegisters[reg] have got this check,
but these three seemed to lack it.

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

llvm-svn: 316415

6 years ago[Modules] Add module for Config/llvm-config.h
Bruno Cardoso Lopes [Tue, 24 Oct 2017 06:18:52 +0000 (06:18 +0000)]
[Modules] Add module for Config/llvm-config.h

Besides all the goodness from modularizing a header, this is necessary
to compile ToT with modules with the clang host compiler from Xcode 9 in
macOS 10.13, which our bots don't use yet.

rdar://problem/35038151

llvm-svn: 316414

6 years ago[MC] Adding code padding for performance stability - infrastructure. NFC.
Omer Paparo Bivas [Tue, 24 Oct 2017 06:16:03 +0000 (06:16 +0000)]
[MC] Adding code padding for performance stability - infrastructure. NFC.

Infrastructure designed for padding code with nop instructions in key places such that preformance improvement will be achieved.
The infrastructure is implemented such that the padding is done in the Assembler after the layout is done and all IPs and alignments are known.
This patch by itself in a NFC. Future patches will make use of this infrastructure to implement required policies for code padding.

Reviewers:
aaboud
zvi
craig.topper
gadi.haber

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

Change-Id: I92110d0c0a757080a8405636914a93ef6f8ad00e
llvm-svn: 316413

6 years agoX86: Register the X86CallFrameOptimization pass
Zvi Rackover [Tue, 24 Oct 2017 05:47:07 +0000 (05:47 +0000)]
X86: Register the X86CallFrameOptimization pass

Summary:
The motivation of this change is to enable .mir testing for this pass.
Added one test case to cover the functionality, this same case will be improved by
a future patch.

Reviewers: igorb, guyblank, DavidKreitzer

Reviewed By: guyblank, DavidKreitzer

Subscribers: llvm-commits

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

llvm-svn: 316412

6 years ago[test] Fix clang-test for FreeBSD and NetBSD
Tim Shen [Tue, 24 Oct 2017 03:11:02 +0000 (03:11 +0000)]
[test] Fix clang-test for FreeBSD and NetBSD

Lit tries to inject the shared library paths, but no action is taken
when platform.system() is not recognized, results in an environment
variable with an empty name, which is illegal.

The patch fixes this mechanism for FreeBSD and NetBSD, and gives an
warning on other platforms, so that the latecomers don't have to spend
time on debugging lit.

Thanks Zhihao Yuan for the patch!

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

llvm-svn: 316411

6 years ago[XRay][compiler-rt] More fixups.
Dean Michael Berris [Tue, 24 Oct 2017 02:43:49 +0000 (02:43 +0000)]
[XRay][compiler-rt] More fixups.

Follow-up to D39175.

llvm-svn: 316410

6 years ago[XRay][compiler-rt] Fixup shadowing
Dean Michael Berris [Tue, 24 Oct 2017 02:36:32 +0000 (02:36 +0000)]
[XRay][compiler-rt] Fixup shadowing

Follow-up to D39175.

llvm-svn: 316409

6 years agoUnnamed bitfields don't block constant evaluation of constexpr ctors
Jordan Rose [Tue, 24 Oct 2017 02:17:07 +0000 (02:17 +0000)]
Unnamed bitfields don't block constant evaluation of constexpr ctors

C++14 [dcl.constexpr]p4 states that in the body of a constexpr
constructor,

> every non-variant non-static data member and base class sub-object
  shall be initialized

However, [class.bit]p2 notes that

> Unnamed bit-fields are not members and cannot be initialized.

Therefore, we should make sure to filter them out of the check that
all fields are initialized.

Fixing this makes the constant evaluator a bit smarter, and
specifically allows constexpr constructors to avoid tripping
-Wglobal-constructors when the type contains unnamed bitfields.

Reviewed at https://reviews.llvm.org/D39035.

llvm-svn: 316408

6 years ago[globalisel][tablegen] Remove unused InstructionMatcher's. NFC
Daniel Sanders [Tue, 24 Oct 2017 01:48:34 +0000 (01:48 +0000)]
[globalisel][tablegen] Remove unused InstructionMatcher's. NFC

llvm-svn: 316407

6 years ago[XRay][compiler-rt] Remove C++ STL from the buffer queue implementation
Dean Michael Berris [Tue, 24 Oct 2017 01:39:59 +0000 (01:39 +0000)]
[XRay][compiler-rt] Remove C++ STL from the buffer queue implementation

Summary:
This change removes the dependency on C++ standard library
types/functions in the implementation of the buffer queue. This is an
incremental step in resolving llvm.org/PR32274.

Reviewers: dblaikie, pelikan

Subscribers: llvm-commits

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

llvm-svn: 316406

6 years agoFix template parameter default args missed if redecled
Erich Keane [Tue, 24 Oct 2017 01:39:56 +0000 (01:39 +0000)]
Fix template parameter default args missed if redecled

This bug was found via self-build on lld, and worked around
here: https://reviews.llvm.org/rL316180

The issue is that the 'using' causes the lookup to pick up the
first decl. However, when setting inherited default parameters,
we only update 'forward', not 'backward'. SO, only the newest param
list has all the information about the default arguments.

This patch ensures that the list of parameters we look through checks
the newest decl's template parameter list so it doesn't miss a default.

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

llvm-svn: 316405

6 years ago[raw_fd_ostream] report actual error in error messages
Bob Haarman [Tue, 24 Oct 2017 01:26:22 +0000 (01:26 +0000)]
[raw_fd_ostream] report actual error in error messages

Summary:
Previously, we would emit error messages like "IO failure on output
stream". This change causes use to include information about what
actually went wrong, e.g. "No space left on device".

Reviewers: sunfish, rnk

Reviewed By: rnk

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

llvm-svn: 316404

6 years ago[Analyzer] Fix for the memory leak: fix typo in if-statement.
George Karpenkov [Tue, 24 Oct 2017 01:09:43 +0000 (01:09 +0000)]
[Analyzer] Fix for the memory leak: fix typo in if-statement.

llvm-svn: 316403

6 years ago[Analyzer] Handle implicit function reference in bodyfarming std::call_once
George Karpenkov [Tue, 24 Oct 2017 00:13:18 +0000 (00:13 +0000)]
[Analyzer] Handle implicit function reference in bodyfarming std::call_once

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

llvm-svn: 316402

6 years agoObjCARC: do not increment past the end of the BB
Saleem Abdulrasool [Tue, 24 Oct 2017 00:09:10 +0000 (00:09 +0000)]
ObjCARC: do not increment past the end of the BB

The `BasicBlock::getFirstInsertionPt` call may return `std::end` for the
BB.  Dereferencing the end iterator results in an assertion failure
"(!NodePtr->isKnownSentinel()), function operator*".  Ensure that the
returned iterator is valid before dereferencing it.  If the end is
returned, move one position backward to get a valid insertion point.

llvm-svn: 316401

6 years ago[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp
George Karpenkov [Mon, 23 Oct 2017 23:59:52 +0000 (23:59 +0000)]
[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp

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

llvm-svn: 316400

6 years ago[analyzer] Fix handling of labels in getLValueElement
Alexander Shaposhnikov [Mon, 23 Oct 2017 23:46:06 +0000 (23:46 +0000)]
[analyzer] Fix handling of labels in getLValueElement

In getLValueElement Base may represent the address of a label
(as in the newly-added test case), in this case it's not a loc::MemRegionVal
and Base.castAs<loc::MemRegionVal>() triggers an assert, this diff makes
getLValueElement return UnknownVal instead.

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

llvm-svn: 316399

6 years ago[codeview] Add support for inlinee lists
Reid Kleckner [Mon, 23 Oct 2017 23:43:40 +0000 (23:43 +0000)]
[codeview] Add support for inlinee lists

This adds type index discovery and dumper support for symbol record kind
0x1168, which is a list of inlined function ids. This symbol kind is
undocumented, but S_INLINEES is consistent with the existing
nomenclature.

Fixes PR34222

llvm-svn: 316398

6 years ago[PM] Fix Typo
Justin Lebar [Mon, 23 Oct 2017 23:42:05 +0000 (23:42 +0000)]
[PM] Fix Typo

Patch by Nick Sarnie.

llvm-svn: 316397

6 years ago[MachineOutliner] Add optimisation remarks for successful outlining
Jessica Paquette [Mon, 23 Oct 2017 23:36:46 +0000 (23:36 +0000)]
[MachineOutliner] Add optimisation remarks for successful outlining

This commit adds optimisation remarks for outlining which fire when a function
is successfully outlined.

To do this, OutlinedFunctions must now contain references to their Candidates.
Since the Candidates must still be sorted and worked on separately, this is
done by working on everything in terms of shared_ptrs to Candidates. This is
good; it means that we can easily move everything to outlining in terms of
the OutlinedFunctions rather than the individual Candidates. This is far more
intuitive than what's currently there!

(Remarks are output when a function is created for some group of Candidates.
In a later commit, all of the outlining logic should be rewritten so that we
loop over OutlinedFunctions rather than over Candidates.)

llvm-svn: 316396

6 years ago[Sanitizers-libFuzzer] Addressing coding style issues.
Alex Shlyapnikov [Mon, 23 Oct 2017 23:24:33 +0000 (23:24 +0000)]
[Sanitizers-libFuzzer] Addressing coding style issues.

Summary: The result of clang-format and few manual changes (as prompted on D39155).

Reviewers: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 316395

6 years agoMore fuzzing interfaces
Marshall Clow [Mon, 23 Oct 2017 23:19:30 +0000 (23:19 +0000)]
More fuzzing interfaces

llvm-svn: 316394

6 years ago[lldbtests] Handle errors instead of crashing.
Davide Italiano [Mon, 23 Oct 2017 23:17:53 +0000 (23:17 +0000)]
[lldbtests] Handle errors instead of crashing.

If you pass an invalid compiler/debugger path on the cmdline to `dotest.py`  this is what you get.

  Traceback (most recent call last):
  [...]
    File "dotest.py", line 7, in <module>
      lldbsuite.test.run_suite()
  [...]

And with the patch applied:

  /home/davide/work/build-lldb/bin/clandasfasg is not a valid path, exiting

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

llvm-svn: 316393

6 years ago[PDB] Add test for S_THUNK32 records
Reid Kleckner [Mon, 23 Oct 2017 23:15:40 +0000 (23:15 +0000)]
[PDB] Add test for S_THUNK32 records

I locally reverted r316385 and confirmed that this test fails without
it.

Really fixes the cause of PR35014.

llvm-svn: 316392

6 years agoUse ipv4 localhost address in lldb-server tests
Pavel Labath [Mon, 23 Oct 2017 23:15:37 +0000 (23:15 +0000)]
Use ipv4 localhost address in lldb-server tests

Since the ipv6 patch, we've experienced occasional flakyness in
lldb-server tests. This was due to the fact that lldb-server was trying
to listen on both v4 and v6 localhost sockets (and consider it a success
if at least one of them succeeded), while the test framework was only
trying to connect to the v4 one.

This change makes sure lldb-server only listens on the v4 socket.

llvm-svn: 316391

6 years ago[Symbol] Remove dead code. NFCI.
Davide Italiano [Mon, 23 Oct 2017 23:14:17 +0000 (23:14 +0000)]
[Symbol] Remove dead code. NFCI.

llvm-svn: 316390

6 years agoAMDGPU: Initialize WavefrontSize from TD files
Konstantin Zhuravlyov [Mon, 23 Oct 2017 23:02:39 +0000 (23:02 +0000)]
AMDGPU: Initialize WavefrontSize from TD files

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

llvm-svn: 316389

6 years ago[GISel][ARM]: Fix illegal Generic copies in tests
Aditya Nandakumar [Mon, 23 Oct 2017 22:53:08 +0000 (22:53 +0000)]
[GISel][ARM]: Fix illegal Generic copies in tests

This is in preparation for a verifier check that makes sure
copies are of the same size (when generic virtual registers are involved).

llvm-svn: 316388

6 years ago[GISel][AArch64]: Fix illegal Generic copies in tests
Aditya Nandakumar [Mon, 23 Oct 2017 22:53:04 +0000 (22:53 +0000)]
[GISel][AArch64]: Fix illegal Generic copies in tests

This is in preparation for a verifier check that makes sure copies are
of the same size (when generic virtual registers are involved).

llvm-svn: 316387

6 years ago[PDB] Fix logging of bad type indices
Reid Kleckner [Mon, 23 Oct 2017 22:44:51 +0000 (22:44 +0000)]
[PDB] Fix logging of bad type indices

llvm-svn: 316386

6 years ago[codeview] Recognize two records with no type index fields
Reid Kleckner [Mon, 23 Oct 2017 22:44:24 +0000 (22:44 +0000)]
[codeview] Recognize two records with no type index fields

Thunk records do not have types and frame cookies do not have types.

These were found while linking libconcrt.lib from MSVC.

llvm-svn: 316385

6 years ago[PM] Add pgo-memop-opt pass to the new pass manager
Rong Xu [Mon, 23 Oct 2017 22:21:29 +0000 (22:21 +0000)]
[PM] Add pgo-memop-opt pass to the new pass manager

This pass adds pgo-memop-opt pass to the new pass manager.
It is in the old pass manager but somehow left out in the new pass manager.

Differential Revision: http://reviews.llvm.org/D39145

llvm-svn: 316384

6 years ago[X86][SSE] combineBitcastvxi1 - use PACKSSWB directly to pack v8i16 to v16i8
Simon Pilgrim [Mon, 23 Oct 2017 22:05:02 +0000 (22:05 +0000)]
[X86][SSE] combineBitcastvxi1 - use PACKSSWB directly to pack v8i16 to v16i8

Avoid difficulties determining the number of sign bits later on in shuffle lowering to lower to PACKSS

llvm-svn: 316383

6 years ago[libFuzzer] Periodically purge allocator's quarantine to prolong fuzzing sessions.
Alex Shlyapnikov [Mon, 23 Oct 2017 22:04:30 +0000 (22:04 +0000)]
[libFuzzer] Periodically purge allocator's quarantine to prolong fuzzing sessions.

Summary:
Fuzzing targets that allocate/deallocate a lot of memory tend to consume
a lot of RSS when ASan quarantine is enabled. Purging quarantine between
iterations and returning memory to OS keeps RSS down and should not
reduce the quarantine effectiveness provided the fuzz target does not
preserve state between iterations (in this case this feature can be turned off).

Based on D39153.

Reviewers: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 316382

6 years ago[Sema] Add support for flexible array members in Obj-C.
Volodymyr Sapsai [Mon, 23 Oct 2017 22:01:41 +0000 (22:01 +0000)]
[Sema] Add support for flexible array members in Obj-C.

Allow Obj-C ivars with incomplete array type but only as the last ivar.
Also add a requirement for ivars that contain a flexible array member to
be at the end of class too. It is possible to add in a subclass another
ivar at the end but we'll emit a warning in this case. Also we'll emit a
warning if a variable sized ivar is declared in class extension or in
implementation because subclasses won't know they should avoid adding
new ivars.

In ARC incomplete array objects are treated as __unsafe_unretained so
require them to be marked as such.

Prohibit synthesizing ivars with flexible array members because order of
synthesized ivars is not obvious and tricky to control. Spelling out
ivar explicitly gives control to developers and helps to avoid surprises
with unexpected ivar ordering.

For C and C++ changed diagnostic to tell explicitly a field is not the
last one and point to the next field. It is not as useful as in Obj-C
but it is an improvement and it is consistent with Obj-C. For C for
unions emit more specific err_flexible_array_union instead of generic
err_field_incomplete.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 316381

6 years agoAdd a new Simulator entry for the target triple environment.
Bob Wilson [Mon, 23 Oct 2017 21:51:50 +0000 (21:51 +0000)]
Add a new Simulator entry for the target triple environment.

Apple's iOS, tvOS and watchOS simulator platforms have never been clearly
distinguished in the target triples. Even though they are intended to
behave similarly to the corresponding device platforms, they have separate
SDKs and are really separate platforms from the compiler's perspective.
Clang now defines a macro when building for one of these simulator platforms
(r297866) but that relies on the very indirect mechanism of checking to see
which option was used to specify the minimum deployment target. That is not
so great. Swift would also like to distinguish these simulator platforms in
a similar way, but unlike Clang, Swift does not use a separate option to
specify the minimum deployment target -- it uses a -target option to
specify the target triple directly, including the OS version number.
Using a different target triple for the simulator platforms is a much
more direct and obvious way to specify this. Putting the "simulator" in
the environment component of the triple means the OS values can stay the
same and existing code the looks at the OS field will not be affected.

https://reviews.llvm.org/D39143
rdar://problem/34729432

llvm-svn: 316380

6 years ago[Driver] Use ld.lld directly for Fuchsia rather than passing flavor
Petr Hosek [Mon, 23 Oct 2017 21:31:05 +0000 (21:31 +0000)]
[Driver] Use ld.lld directly for Fuchsia rather than passing flavor

Passing a flavor to LLD requires command line argument, but if these
are being passed through a response file, this will fail because LLD
needs to know which driver to use before processing the response file.
Use ld.lld directly instead to avoid this issue.

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

llvm-svn: 316379

6 years agoMake Ctx a plain pointer again.
Rafael Espindola [Mon, 23 Oct 2017 21:12:19 +0000 (21:12 +0000)]
Make Ctx a plain pointer again.

If a struct has a std::unique_ptr member, the logical interpretation
is that that member will be destroyed with the struct.

That is not the case for Ctx. It is has to be deleted earlier and its
lifetime is defined by the functions where the AddressState is
created.

llvm-svn: 316378

6 years agoFix buildbot breakage
George Burgess IV [Mon, 23 Oct 2017 21:08:02 +0000 (21:08 +0000)]
Fix buildbot breakage

SP is only used in an assert. Caused by r316374.

llvm-svn: 316377

6 years agoDocument a change of behavior in r315552.
Rafael Espindola [Mon, 23 Oct 2017 21:00:15 +0000 (21:00 +0000)]
Document a change of behavior in r315552.

We used to reject this, but we now accept. The output seems
reasonable, so this is probably an OK extension over bfd/gold.

llvm-svn: 316376

6 years agoMade llvm-cfi-verify not execute unit tests on non-x86 builds.
Mitch Phillips [Mon, 23 Oct 2017 20:54:01 +0000 (20:54 +0000)]
Made llvm-cfi-verify not execute unit tests on non-x86 builds.

Patched out from D38427.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc, mgorny

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

llvm-svn: 316375

6 years agoDon't crash when we see unallocatable registers in clobbers
George Burgess IV [Mon, 23 Oct 2017 20:46:36 +0000 (20:46 +0000)]
Don't crash when we see unallocatable registers in clobbers

This fixes a bug where we'd crash given code like the test-case from
https://bugs.llvm.org/show_bug.cgi?id=30792 . Instead, we let the
offending clobber silently slide through.

This doesn't fully fix said bug, since the assembler will still complain
the moment it sees a crypto/fp/vector op, and we still don't diagnose
calls that require vector regs.

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

llvm-svn: 316374

6 years agoGraph builder implementation.
Mitch Phillips [Mon, 23 Oct 2017 20:25:19 +0000 (20:25 +0000)]
Graph builder implementation.

Implement a localised graph builder for indirect control flow
instructions. Main interface is through GraphBuilder::buildFlowGraph,
which will build a flow graph around an indirect CF instruction. Various
modifications to FileVerifier are also made to const-expose some members
needed for machine code analysis done by the graph builder.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc

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

llvm-svn: 316372

6 years agoRevert "[PowerPC] Try to simplify a Swap if it feeds a Splat"
Stefan Pintilie [Mon, 23 Oct 2017 20:22:23 +0000 (20:22 +0000)]
Revert "[PowerPC] Try to simplify a Swap if it feeds a Splat"

Revert commit r316366.
Previous commit causes p8-scalar_vector_conversions.ll to fail.

This reverts commit 990e764ad8a2eec206ce5dda6aefab059ccd4e92.

llvm-svn: 316371

6 years agolld::COFF: better behavior when using as a library
Rui Ueyama [Mon, 23 Oct 2017 20:03:32 +0000 (20:03 +0000)]
lld::COFF: better behavior when using as a library

Previously, the COFF driver would call exit(0) when called
as a library.  Now it takes `ExitEarly` option, and if it
is false, it doesn't exit.  So it is now more library-friendly.

Furthermore, link() calls freeArena() before returning, to
clean up resources.

Based on an Andrew Kelley's patch.

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

llvm-svn: 316370

6 years ago[GVNSink] Fix failing GVNSink tests in the reverse iteration bot
Mandeep Singh Grang [Mon, 23 Oct 2017 19:56:52 +0000 (19:56 +0000)]
[GVNSink] Fix failing GVNSink tests in the reverse iteration bot

Summary:

The elts of ActivePreds which is defined as a SmallPtrSet are copied
into Blocks using std::copy. This makes the resultant order of Blocks
non-deterministic. We cannot simply sort Blocks as they need to match
the corresponding Values. So a better approach is to define ActivePreds
as SmallSetVector.

This fixes the following failures in
http://lab.llvm.org:8011/builders/reverse-iteration:
  LLVM :: Transforms/GVNSink/indirect-call.ll
  LLVM :: Transforms/GVNSink/sink-common-code.ll
  LLVM :: Transforms/GVNSink/struct.ll

Reviewers: dberlin, jmolloy, bkramer, efriedma

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 316369

6 years agoLogging: Disable logging after fork()
Pavel Labath [Mon, 23 Oct 2017 19:41:17 +0000 (19:41 +0000)]
Logging: Disable logging after fork()

Summary:
We had a bug where if we had forked (in the ProcessLauncherPosixFork)
while another thread was writing a log message, we would deadlock. This
happened because the fork child inherited the locked log rwmutex, which
would never get unlocked. This meant the child got stuck trying to
disable all log channels.

The bug existed for a while but only started being apparent after
D37930, which started using ThreadLauncher (which uses logging) instead
of std::thread (which does not) for launching TaskPool threads.

The fix is to use pthread_atfork to disable logging in the forked child.

Reviewers: zturner, eugene, clayborg

Subscribers: lldb-commits

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

llvm-svn: 316368

6 years ago[Hexagon] Return the correct chain edge for i1 function calls
Krzysztof Parzyszek [Mon, 23 Oct 2017 19:35:25 +0000 (19:35 +0000)]
[Hexagon] Return the correct chain edge for i1 function calls

In HexagonISelLowering, there is code to handle the case when
a function returns an i1 type. In this case, we need to generate
extra nodes to copy the result from R0 to a predicate register.

The code was returning the wrong value for the chain edge which
caused an assert "Wrong topological sorting" when converting the
instructions to MIs.

This patch fixes the problem by returning the chain for the final
copy.

Patch by Brendon Cahoon.

llvm-svn: 316367

6 years ago[PowerPC] Try to simplify a Swap if it feeds a Splat
Stefan Pintilie [Mon, 23 Oct 2017 19:33:31 +0000 (19:33 +0000)]
[PowerPC] Try to simplify a Swap if it feeds a Splat

If we have the situation where a Swap feeds a Splat we can sometimes change the
index on the Splat and then remove the Swap instruction.

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

llvm-svn: 316366

6 years agoLLD: Fix large integer implicitly truncated to unsigned type gcc warning
Konstantin Zhuravlyov [Mon, 23 Oct 2017 19:31:31 +0000 (19:31 +0000)]
LLD: Fix large integer implicitly truncated to unsigned type gcc warning

This fixes gcc warning.

Change by Brian Sumner

llvm-svn: 316365

6 years agoAbstract rwlocks into a class, provide a SRW lock implementation for windows
Martin Storsjo [Mon, 23 Oct 2017 19:29:36 +0000 (19:29 +0000)]
Abstract rwlocks into a class, provide a SRW lock implementation for windows

This requires _WIN32_WINNT >= 0x0600.

If someone wants to spend effort on supporting earlier versions,
one can easily add another fallback implementation based on
critical sections, or try to load SRW lock functions dynamically.

This makes sure that the FDE cache is thread safe on windows.

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

llvm-svn: 316364

6 years ago[Hexagon] Add extra pattern for S4_addaddi
Krzysztof Parzyszek [Mon, 23 Oct 2017 19:07:50 +0000 (19:07 +0000)]
[Hexagon] Add extra pattern for S4_addaddi

One combination was missing: add(add(x,y),c).

llvm-svn: 316363

6 years ago[OpenMP] Avoid VLAs for some reductions on array sections
Jonas Hahnfeld [Mon, 23 Oct 2017 19:01:35 +0000 (19:01 +0000)]
[OpenMP] Avoid VLAs for some reductions on array sections

In some cases the compiler can deduce the length of an array section
as constants. With this information, VLAs can be avoided in place of
a constant sized array or even a scalar value if the length is 1.
Example:
int a[4], b[2];
pragma omp parallel reduction(+: a[1:2], b[1:1])
{ }

For chained array sections, this optimization is restricted to cases
where all array sections except the last have a constant length 1.
This trivially guarantees that there are no holes in the memory region
that needs to be privatized.
Example:
int c[3][4];
pragma omp parallel reduction(+: c[1:1][1:2])
{ }

This relands commit r316229 that I reverted in r316235 because it
failed on some bots. During investigation I found that this was because
Clang and GCC evaluate the two arguments to emplace_back() in
ReductionCodeGen::emitSharedLValue() in a different order, hence
leading to a different order of generated instructions in the final
LLVM IR. Fix this by passing in the arguments from temporary variables
that are evaluated in a defined order.

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

llvm-svn: 316362

6 years agoFix FormatVariadicTest with GCC
Jonas Hahnfeld [Mon, 23 Oct 2017 18:41:22 +0000 (18:41 +0000)]
Fix FormatVariadicTest with GCC

Looks like GCC didn't like the original specialization, try within namespace.

llvm-svn: 316361

6 years ago[globalisel][tablegen] Import stores and allow GISel to automatically substitute...
Daniel Sanders [Mon, 23 Oct 2017 18:19:24 +0000 (18:19 +0000)]
[globalisel][tablegen] Import stores and allow GISel to automatically substitute zero regs like WZR/XZR/$zero.

This patch enables the import of stores. Unfortunately, doing so by itself,
loses an optimization where storing 0 to memory makes use of WZR/XZR.

To mitigate this, this patch also introduces a new feature that allows register
operands to nominate a zero register. When this is done, GlobalISel will
substitute (G_CONSTANT 0) with the nominated register automatically. This
is currently configured to only apply to the stores.

Applying it to GPR32/GPR64 register classes in general will be done after
review see (https://reviews.llvm.org/D39150).

llvm-svn: 316360

6 years agoAccidently merged an incomplete upstream patch in 10e6ee563a6b5ca498f27972ca6dbe6c308...
Mitch Phillips [Mon, 23 Oct 2017 18:17:56 +0000 (18:17 +0000)]
Accidently merged an incomplete upstream patch in 10e6ee563a6b5ca498f27972ca6dbe6c308f1ac2 - reverting the changes.

llvm-svn: 316359

6 years agoPatch in
Mitch Phillips [Mon, 23 Oct 2017 18:11:31 +0000 (18:11 +0000)]
Patch in

llvm-svn: 316358

6 years ago[wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)
Vedant Kumar [Mon, 23 Oct 2017 18:04:34 +0000 (18:04 +0000)]
[wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)

A wasm file crafted with a bogus section size can trigger an ASan issue
in the DWARFObjInMemory constructor. Nip the problem in the bud when we
read the wasm section.

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3219

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

llvm-svn: 316357

6 years ago[Sanitizers] Add total primary allocator RSS to allocator report.
Alex Shlyapnikov [Mon, 23 Oct 2017 17:58:16 +0000 (17:58 +0000)]
[Sanitizers] Add total primary allocator RSS to allocator report.

Summary: .

Reviewers: cryptoad

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 316356

6 years ago[lldbtest] Simplify removing an unneeded else. NFCI.
Davide Italiano [Mon, 23 Oct 2017 17:51:22 +0000 (17:51 +0000)]
[lldbtest] Simplify removing an unneeded else. NFCI.

llvm-svn: 316355

6 years ago[X86][SSE] Regenerate PACKSS tests on 32 + 64-bit targets
Simon Pilgrim [Mon, 23 Oct 2017 17:50:40 +0000 (17:50 +0000)]
[X86][SSE] Regenerate PACKSS tests on 32 + 64-bit targets

llvm-svn: 316354

6 years agoCodeGen: Fix invalid bitcast in partial initialization of automatic arrary variable
Yaxun Liu [Mon, 23 Oct 2017 17:49:26 +0000 (17:49 +0000)]
CodeGen: Fix invalid bitcast in partial initialization of automatic arrary variable

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

llvm-svn: 316353

6 years agoUpdated 'Getting Started' to use valid git links (added trailing slashes)
Mitch Phillips [Mon, 23 Oct 2017 17:37:41 +0000 (17:37 +0000)]
Updated 'Getting Started' to use valid git links (added trailing slashes)

Reviewers: pcc, asl, tonic

Reviewed By: pcc

Subscribers: llvm-commits, kcc

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

llvm-svn: 316352

6 years ago[PassManager] add test to show the new PM uses -latesimplifycfg early; NFC
Sanjay Patel [Mon, 23 Oct 2017 17:30:17 +0000 (17:30 +0000)]
[PassManager] add test to show the new PM uses -latesimplifycfg early; NFC

llvm-svn: 316351

6 years ago[globalisel] Add very brief docs summarizing the ISel part of the LLVMDev tutorial.
Daniel Sanders [Mon, 23 Oct 2017 17:18:44 +0000 (17:18 +0000)]
[globalisel] Add very brief docs summarizing the ISel part of the LLVMDev tutorial.

Also added links to the talks available.

llvm-svn: 316350

6 years agoAMDGPU: Cleanup local atomic node names
Matt Arsenault [Mon, 23 Oct 2017 17:16:43 +0000 (17:16 +0000)]
AMDGPU: Cleanup local atomic node names

llvm-svn: 316349

6 years agoRevert "[Compiler-rt][MIPS] Fix cross build for XRAY."
Evgeniy Stepanov [Mon, 23 Oct 2017 17:13:24 +0000 (17:13 +0000)]
Revert "[Compiler-rt][MIPS] Fix cross build for XRAY."

Breaks build:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/4677/steps/build%20with%20ninja/logs/stdio

In file included from compiler-rt/lib/xray/xray_fdr_logging.cc:34:
In file included from compiler-rt/lib/xray/xray_fdr_logging_impl.h:36:
In file included from compiler-rt/lib/xray/xray_flags.h:18:
compiler-rt/lib/xray/../sanitizer_common/sanitizer_flag_parser.h:23:7: error: '__sanitizer::FlagHandlerBase' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]
class FlagHandlerBase {

llvm-svn: 316348

6 years ago[Sanitizers] New sanitizer API to purge allocator quarantine.
Alex Shlyapnikov [Mon, 23 Oct 2017 17:12:07 +0000 (17:12 +0000)]
[Sanitizers] New sanitizer API to purge allocator quarantine.

Summary:
Purging allocator quarantine and returning memory to OS might be desired
between fuzzer iterations since, most likely, the quarantine is not
going to catch bugs in the code under fuzz, but reducing RSS might
significantly prolong the fuzzing session.

Reviewers: cryptoad

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 316347

6 years agoAMDGPU: Fix default range in non-kernel functions
Matt Arsenault [Mon, 23 Oct 2017 17:09:35 +0000 (17:09 +0000)]
AMDGPU: Fix default range in non-kernel functions

The range should be assumed to be the hardware maximum
if a workitem intrinsic is used in a callable function
which does not know the restricted limit of the calling
kernel.

llvm-svn: 316346

6 years ago[X86] Fix disassembler table generation to prevent instructions tagged with 'PS'...
Craig Topper [Mon, 23 Oct 2017 16:49:26 +0000 (16:49 +0000)]
[X86] Fix disassembler table generation to prevent instructions tagged with 'PS' being inherited into PD/XS/XD attribute entries.

llvm-svn: 316345

6 years ago[ASTMatchers] Expose forEachOverriden in dynamic AST matchers.
Benjamin Kramer [Mon, 23 Oct 2017 16:48:46 +0000 (16:48 +0000)]
[ASTMatchers] Expose forEachOverriden in dynamic AST matchers.

llvm-svn: 316344

6 years agoFix misguided error message in debug mode. No functional change. Fixes PR#34966
Marshall Clow [Mon, 23 Oct 2017 16:46:44 +0000 (16:46 +0000)]
Fix misguided error message in debug mode. No functional change. Fixes PR#34966

llvm-svn: 316343

6 years ago[scudo] Add a shared runtime
Kostya Kortchinsky [Mon, 23 Oct 2017 16:27:47 +0000 (16:27 +0000)]
[scudo] Add a shared runtime

Summary:
Up to now, the Scudo cmake target only provided a static library that had to be
linked to an executable to benefit from the hardened allocator.
This introduces a shared library as well, that can be LD_PRELOAD'ed.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, mgorny, llvm-commits

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

llvm-svn: 316342

6 years ago[MachineOutliner] NFC: Rename getters/setters to fit coding style
Jessica Paquette [Mon, 23 Oct 2017 16:25:53 +0000 (16:25 +0000)]
[MachineOutliner] NFC: Rename getters/setters to fit coding style

Rename endIdx, startIdx, and length to getEndIdx, getStartIdx, and getLength
in Candidate.

llvm-svn: 316341

6 years ago[X86] Change VMPTRST to use PS instead of TB to match VMPTRLD.
Craig Topper [Mon, 23 Oct 2017 16:22:40 +0000 (16:22 +0000)]
[X86] Change VMPTRST to use PS instead of TB to match VMPTRLD.

llvm-svn: 316340

6 years ago[X86] Change RDRAND to use PS instead of TB.
Craig Topper [Mon, 23 Oct 2017 16:22:38 +0000 (16:22 +0000)]
[X86] Change RDRAND to use PS instead of TB.

Should be no functional change for now. A future disassembler change will prevent disassembling with 0xf2/0xf3.

llvm-svn: 316339

6 years agoPull X86 "CPUKind" checking into .cpp file. [NFC]
Erich Keane [Mon, 23 Oct 2017 16:20:15 +0000 (16:20 +0000)]
Pull X86 "CPUKind" checking into .cpp file. [NFC]

Preparing to do a refactor of CPU/feature checking, this
patch pulls the one CPU implementation from the .h file
to the .cpp file.

llvm-svn: 316338

6 years ago[X86] Change XRSTOR to use PS instead of TB to match XSAVE.
Craig Topper [Mon, 23 Oct 2017 16:11:33 +0000 (16:11 +0000)]
[X86] Change XRSTOR to use PS instead of TB to match XSAVE.

I don't think this changes anything functionally yet, but I plan to fix the disassembler to use this to disable matching certain instructions with 0xf3/0xf2/0x66 prefixes.

llvm-svn: 316337

6 years ago[X86][SSE] Remove AssertZext stage from PEXTRW/PEXTRB lowering. NFCI.
Simon Pilgrim [Mon, 23 Oct 2017 16:00:57 +0000 (16:00 +0000)]
[X86][SSE] Remove AssertZext stage from PEXTRW/PEXTRB lowering. NFCI.

Remove AssertZext and instead add PEXTRW/PEXTRB support to computeKnownBitsForTargetNode to simplify instruction selection.

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

llvm-svn: 316336

6 years agoclang-cl: Expose --version.
Nico Weber [Mon, 23 Oct 2017 15:54:44 +0000 (15:54 +0000)]
clang-cl: Expose --version.

This is for consistency with lld-link, see https://reviews.llvm.org/D38972
Also give --version a help text so it shows up in --help / /? output (for
both clang-cl and regular clang).

llvm-svn: 316335

6 years agoUpdate DPPD/DPPS instruction scheduling on btver2.
Andrew V. Tischenko [Mon, 23 Oct 2017 15:53:30 +0000 (15:53 +0000)]
Update DPPD/DPPS instruction scheduling on btver2.
Differential Revision: https://reviews.llvm.org/D39046

llvm-svn: 316334

6 years ago[X86] Add PTWRITE instruction for assembler and disassembler.
Craig Topper [Mon, 23 Oct 2017 15:53:21 +0000 (15:53 +0000)]
[X86] Add PTWRITE instruction for assembler and disassembler.

llvm-svn: 316333

6 years ago[X86] Add RDPID instruction for assembler and disassembler.
Craig Topper [Mon, 23 Oct 2017 15:53:16 +0000 (15:53 +0000)]
[X86] Add RDPID instruction for assembler and disassembler.

llvm-svn: 316332

6 years ago[DAGCombine] Permit combining of shuffles of equivalent splat BUILD_VECTORs
Simon Pilgrim [Mon, 23 Oct 2017 15:48:08 +0000 (15:48 +0000)]
[DAGCombine] Permit combining of shuffles of equivalent splat BUILD_VECTORs

combineShuffleOfScalars is very conservative about shuffled BUILD_VECTORs that can be combined together.

This patch adds one additional case - if both BUILD_VECTORs represent splats of the same scalar value but with different UNDEF elements, then we should create a single splat BUILD_VECTOR, sharing only the UNDEF elements defined by the shuffle mask.

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

llvm-svn: 316331

6 years agoSupport formatting formatv_objects.
Sam McCall [Mon, 23 Oct 2017 15:40:44 +0000 (15:40 +0000)]
Support formatting formatv_objects.

Summary:
Support formatting formatv_objects.

While here, fix documentation about member-formatters, and attempted
perfect-forwarding (I think).

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 316330

6 years agoAdd the --version option.
Rui Ueyama [Mon, 23 Oct 2017 14:57:53 +0000 (14:57 +0000)]
Add the --version option.

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

llvm-svn: 316329

6 years ago[X86][SSE] Regenerate bitcast-and-setcc tests
Simon Pilgrim [Mon, 23 Oct 2017 14:47:49 +0000 (14:47 +0000)]
[X86][SSE] Regenerate bitcast-and-setcc tests

Avoid the retl/retq changes in an upcoming patch

llvm-svn: 316328

6 years ago[clangd] Allow to pass code completion opts to ClangdServer.
Ilya Biryukov [Mon, 23 Oct 2017 14:46:48 +0000 (14:46 +0000)]
[clangd] Allow to pass code completion opts to ClangdServer.

Reviewers: bkramer, krasimir, sammccall

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 316327

6 years ago[X86][AVX2] Regenerate AVX2 intrinsics tests on 32 + 64-bit targets
Simon Pilgrim [Mon, 23 Oct 2017 14:19:46 +0000 (14:19 +0000)]
[X86][AVX2] Regenerate AVX2 intrinsics tests on 32 + 64-bit targets

llvm-svn: 316326

6 years ago[X86][AVX] Regenerate AVX intrinsics tests on 32 + 64-bit targets
Simon Pilgrim [Mon, 23 Oct 2017 14:17:59 +0000 (14:17 +0000)]
[X86][AVX] Regenerate AVX intrinsics tests on 32 + 64-bit targets

llvm-svn: 316325

6 years ago[X86][F16C] Regenerate F16C schedule tests
Simon Pilgrim [Mon, 23 Oct 2017 14:15:24 +0000 (14:15 +0000)]
[X86][F16C] Regenerate F16C schedule tests

llvm-svn: 316324

6 years ago[clangd] Updated outdated test comment. NFC.
Ilya Biryukov [Mon, 23 Oct 2017 14:08:52 +0000 (14:08 +0000)]
[clangd] Updated outdated test comment. NFC.

llvm-svn: 316323