platform/upstream/llvm.git
5 years ago[MS Demangler] Fail gracefully on invalid pointer types.
Zachary Turner [Fri, 14 Dec 2018 18:10:13 +0000 (18:10 +0000)]
[MS Demangler] Fail gracefully on invalid pointer types.

Once we detect a 'P', we know we a pointer type is upcoming, so
we make some assumptions about the output that follows.  If those
assumptions didn't hold, we would assert.  Instead, we should
fail gracefully and propagate the error up.

llvm-svn: 349169

5 years ago[MS Demangler] Add a regression test for an invalid mangled name.
Zachary Turner [Fri, 14 Dec 2018 17:59:27 +0000 (17:59 +0000)]
[MS Demangler] Add a regression test for an invalid mangled name.

llvm-svn: 349168

5 years ago[globalisel][combiner] Make the CombinerChangeObserver a MachineFunction::Delegate
Daniel Sanders [Fri, 14 Dec 2018 17:50:14 +0000 (17:50 +0000)]
[globalisel][combiner] Make the CombinerChangeObserver a MachineFunction::Delegate

Summary:
This allows us to register it with the MachineFunction delegate and be
notified automatically about erasure and creation of instructions. However,
we still need explicit notification for modifications such as those caused
by setReg() or replaceRegWith().

There is a catch with this though. The notification for creation is
delivered before any operands can be added. While appropriate for
scheduling combiner work. This is unfortunate for debug output since an
opcode by itself doesn't provide sufficient information on what happened.
As a result, the work list remembers the instructions (when debug output is
requested) and emits a more complete dump later.

Another nit is that the MachineFunction::Delegate provides const pointers
which is inconvenient since we want to use it to schedule future
modification. To resolve this GISelWorkList now has an optional pointer to
the MachineFunction which describes the scope of the work it is permitted
to schedule. If a given MachineInstr* is in this function then it is
permitted to schedule work to be performed on the MachineInstr's. An
alternative to this would be to remove the const from the
MachineFunction::Delegate interface, however delegates are not permitted
to modify the MachineInstr's they receive.

In addition to this, the observer has three interface changes.
* erasedInstr() is now erasingInstr() to indicate it is about to be erased
  but still exists at the moment.
* changingInstr() and changedInstr() have been added to report changes
  before and after they are made. This allows us to trace the changes
  in the debug output.
* As a convenience changingAllUsesOfReg() and
  finishedChangingAllUsesOfReg() will report changingInstr() and
  changedInstr() for each use of a given register. This is primarily useful
  for changes caused by MachineRegisterInfo::replaceRegWith()

With this in place, both combine rules have been updated to report their
changes to the observer.

Finally, make some cosmetic changes to the debug output and make Combiner
and CombinerHelp

Reviewers: aditya_nandakumar, bogner, volkan, rtereshin, javed.absar

Reviewed By: aditya_nandakumar

Subscribers: mgorny, rovka, kristof.beyls, llvm-commits

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

llvm-svn: 349167

5 years ago[AArch64] make test immune to scalarization improvements; NFC
Sanjay Patel [Fri, 14 Dec 2018 17:44:07 +0000 (17:44 +0000)]
[AArch64] make test immune to scalarization improvements; NFC

This is explicitly implementing what the comment says rather
than relying on the implicit zext of a costant operand.

llvm-svn: 349166

5 years agoFix a crash in llvm-undname with invalid types.
Zachary Turner [Fri, 14 Dec 2018 17:43:56 +0000 (17:43 +0000)]
Fix a crash in llvm-undname with invalid types.

llvm-svn: 349165

5 years ago[SystemZ] make test immune to scalarization improvements; NFC
Sanjay Patel [Fri, 14 Dec 2018 17:28:52 +0000 (17:28 +0000)]
[SystemZ] make test immune to scalarization improvements; NFC

The undef operands mean this test is probably still too fragile
to accomplish what the comments suggest.

llvm-svn: 349164

5 years ago[Hexagon] make test immune to scalarization improvements; NFC
Sanjay Patel [Fri, 14 Dec 2018 17:23:01 +0000 (17:23 +0000)]
[Hexagon] make test immune to scalarization improvements; NFC

llvm-svn: 349163

5 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Fri, 14 Dec 2018 16:49:57 +0000 (16:49 +0000)]
[x86] auto-generate complete checks; NFC

llvm-svn: 349162

5 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Fri, 14 Dec 2018 16:46:21 +0000 (16:46 +0000)]
[x86] regenerate test checks; NFC

llvm-svn: 349161

5 years ago[x86] make tests immune to scalarization improvements; NFC
Sanjay Patel [Fri, 14 Dec 2018 16:44:58 +0000 (16:44 +0000)]
[x86] make tests immune to scalarization improvements; NFC

llvm-svn: 349160

5 years agoMark interception_failure_test.cc as passing for NetBSD and asan-dynamic-runtime
Kamil Rytarowski [Fri, 14 Dec 2018 16:26:09 +0000 (16:26 +0000)]
Mark interception_failure_test.cc as passing for NetBSD and asan-dynamic-runtime

llvm-svn: 349159

5 years agoNFC. Adding an empty line to test the updated commit credentials.
Ehsan Amiri [Fri, 14 Dec 2018 16:19:02 +0000 (16:19 +0000)]
NFC. Adding an empty line to test the updated commit credentials.

llvm-svn: 349158

5 years agoMove Broadcaster+Listener+Event combo from Core into Utility
Pavel Labath [Fri, 14 Dec 2018 15:59:49 +0000 (15:59 +0000)]
Move Broadcaster+Listener+Event combo from Core into Utility

Summary:
These are general purpose "utility" classes, whose functionality is not
debugger-specific in any way. As such, I believe they belong in the
Utility module.

This doesn't break any particular dependency (yet), but it reduces the
number of Core dependencies across the board.

Reviewers: zturner, jingham, teemperor, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 349157

5 years agoSet shared_libasan_path in lit tests for NetBSD
Kamil Rytarowski [Fri, 14 Dec 2018 15:58:05 +0000 (15:58 +0000)]
Set shared_libasan_path in lit tests for NetBSD

Reuse the Linux code path.

llvm-svn: 349156

5 years agoImplement -frecord-command-line (-frecord-gcc-switches)
Scott Linder [Fri, 14 Dec 2018 15:38:15 +0000 (15:38 +0000)]
Implement -frecord-command-line (-frecord-gcc-switches)

Implement options in clang to enable recording the driver command-line
in an ELF section.

Implement a new special named metadata, llvm.commandline, to support
frontends embedding their command-line options in IR/ASM/ELF.

This differs from the GCC implementation in some key ways:

* In GCC there is only one command-line possible per compilation-unit,
  in LLVM it mirrors llvm.ident and multiple are allowed.
* In GCC individual options are separated by NULL bytes, in LLVM entire
  command-lines are separated by NULL bytes. The advantage of the GCC
  approach is to clearly delineate options in the face of embedded
  spaces. The advantage of the LLVM approach is to support merging
  multiple command-lines unambiguously, while handling embedded spaces
  with escaping.

Differential Revision: https://reviews.llvm.org/D54487
Clang Differential Revision: https://reviews.llvm.org/D54489

llvm-svn: 349155

5 years agoFix minidump unit test failures from r349062
Pavel Labath [Fri, 14 Dec 2018 14:41:04 +0000 (14:41 +0000)]
Fix minidump unit test failures from r349062

This commit added new test inputs, but it did not add them to the cmake
files. This caused the test to fail at runtime.

While in there, I also sorted the list of minidump test inputs.

llvm-svn: 349154

5 years agoFix build with older (<3.0) swigs
Pavel Labath [Fri, 14 Dec 2018 14:25:20 +0000 (14:25 +0000)]
Fix build with older (<3.0) swigs

It turns out it wasn't the compilers, but swig who had issues with my
previous patch -- older versions do not recognise the "constexpr"
keyword.

Fortunately, that can be fixed the same way we fix all other swig
incompatibilities: #ifndef SWIG.

llvm-svn: 349153

5 years ago[dexp] Change FuzzyFind to also print scope of symbols
Kadir Cetinkaya [Fri, 14 Dec 2018 14:17:18 +0000 (14:17 +0000)]
[dexp] Change FuzzyFind to also print scope of symbols

Summary:
When there are multiple symbols in the result of a fuzzy find with the
same name, one has to perform an additional query to figure out which of those
symbols are coming from the "interesting" scope. This patch prints the scope in
fuzzy find results to get rid of the second symbol.

Reviewers: hokein

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits

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

llvm-svn: 349152

5 years ago[RegAllocGreedy] IMPLICIT_DEF values shouldn't prefer registers
John Brawn [Fri, 14 Dec 2018 14:07:57 +0000 (14:07 +0000)]
[RegAllocGreedy] IMPLICIT_DEF values shouldn't prefer registers

It costs nothing to spill an IMPLICIT_DEF value (the only spill code that's
generated is a KILL of the value), so when creating split constraints if the
live-out value is IMPLICIT_DEF the exit constraint should be DontCare instead
of PrefReg.

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

llvm-svn: 349151

5 years agoclang-include-fixer.el: support remote files
Philipp Stephani [Fri, 14 Dec 2018 13:56:05 +0000 (13:56 +0000)]
clang-include-fixer.el: support remote files

Summary: Support remote files (e.g., Tramp) in the Emacs integration for clang-include-fixer

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 349150

5 years agoMark Permissions as a bitmask enum
Pavel Labath [Fri, 14 Dec 2018 13:51:20 +0000 (13:51 +0000)]
Mark Permissions as a bitmask enum

this allows one to use bitwise operators on the variables of this type
without complicated casting.

The gotcha here is that the combinations of these enums were being used
in some constexpr contexts such as case labels (case
ePermissionsWritable | ePermissionsExecutable:), which is not possible
if the user-defined operator| is not constexpr.

So, this commit also marks these operators as constexpr. I am committing
this as a small standalone patch so it can be easily reverted if some
compiler has an issue with this.

llvm-svn: 349149

5 years ago[clangd] Use buildCompilerInvocation to simplify the HeadersTests, NFC.
Haojian Wu [Fri, 14 Dec 2018 13:49:00 +0000 (13:49 +0000)]
[clangd] Use buildCompilerInvocation to simplify the HeadersTests, NFC.

llvm-svn: 349148

5 years ago[ARM GlobalISel] Thumb2: casts between int and ptr
Diana Picus [Fri, 14 Dec 2018 13:45:38 +0000 (13:45 +0000)]
[ARM GlobalISel] Thumb2: casts between int and ptr

Mark as legal and add tests. Nothing special to do.

llvm-svn: 349147

5 years ago[ARM GlobalISel] Remove duplicate test. NFCI
Diana Picus [Fri, 14 Dec 2018 13:28:34 +0000 (13:28 +0000)]
[ARM GlobalISel] Remove duplicate test. NFCI

Fixup for r349026. I forgot to delete these test functions from the
original file when I moved them to arm-legalize-exts.mir.

llvm-svn: 349146

5 years ago[clangd] Fix memory leak in ClangdTests.
Haojian Wu [Fri, 14 Dec 2018 13:19:38 +0000 (13:19 +0000)]
[clangd] Fix memory leak in ClangdTests.

Summary:
createInvocationFromCommandLine sets DisableFree to true by default,
which leads memory leak in clangd. The fix is to  use the `BuildCompilationInvocation`
to create CI with the correct options (DisableFree is false).

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

Reviewers: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 349145

5 years ago[clangd] Fix an assertion failure in background index.
Haojian Wu [Fri, 14 Dec 2018 12:39:08 +0000 (12:39 +0000)]
[clangd] Fix an assertion failure in background index.

Summary:
When indexing a file which contains an uncompilable error, we will
trigger an assertion failure -- the IndexFileIn data is not set, but we
access them in the backgound index.

Reviewers: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 349144

5 years ago[ARM GlobalISel] Minor refactoring. NFCI
Diana Picus [Fri, 14 Dec 2018 12:37:24 +0000 (12:37 +0000)]
[ARM GlobalISel] Minor refactoring. NFCI

Refactor the ARMInstructionSelector to cache some opcodes in the
constructor instead of checking all the time if we're in ARM or Thumb
mode.

llvm-svn: 349143

5 years ago[ARM GlobalISel] Allow simple binary ops in Thumb2
Diana Picus [Fri, 14 Dec 2018 11:58:14 +0000 (11:58 +0000)]
[ARM GlobalISel] Allow simple binary ops in Thumb2

Mark G_ADD, G_SUB, G_MUL, G_AND, G_OR and G_XOR as legal for both ARM
and Thumb2.

Extract the legalizer tests for these opcodes into another file.

Add tests for the instruction selector.

llvm-svn: 349142

5 years ago[TableGen:AsmWriter] Cope with consecutive tied operands.
Simon Tatham [Fri, 14 Dec 2018 11:39:55 +0000 (11:39 +0000)]
[TableGen:AsmWriter] Cope with consecutive tied operands.

When you define an instruction alias as a subclass of InstAlias, you
specify all the MC operands for the instruction it expands to, except
for operands that are tied to a previous one, which you leave out in
the expectation that the Tablegen output code will fill them in
automatically.

But the code in Tablegen's AsmWriter backend that skips over a tied
operand was doing it using 'if' instead of 'while', because it wasn't
expecting to find two tied operands in sequence.

So if an instruction updates a pair of registers in place, so that its
MC representation has two input operands tied to the output ones (for
example, Arm's UMLAL instruction), then any alias which wants to
expand to a special case of that instruction is likely to fail to
match, because the indices of subsequent operands will be off by one
in the generated printAliasInstr function.

This patch re-indents some existing code, so it's clearest when
viewed as a diff with whitespace changes ignored.

Reviewers: fhahn, rengolin, sdesmalen, atanasyan, asb, jholewinski, t.p.northover, kparzysz, craig.topper, stoklund

Reviewed By: rengolin

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

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

llvm-svn: 349141

5 years ago[AArch64][libunwind] Unwinding support for return address signing
Luke Cheeseman [Fri, 14 Dec 2018 11:30:12 +0000 (11:30 +0000)]
[AArch64][libunwind] Unwinding support for return address signing

- Follow up to revision r342895
- gcc would not build libunwind with the earlier patch as the autia1716
  instruction wasn't allowed to be assembled for pre armv8.3a targets
- The autia1716 instruction lives in the hint space encodings so is a valid
  instruction for all armv8a targets
- To work around this I have swapped out the autia1716 instruction for the hint
  instruction

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

llvm-svn: 349140

5 years agoRevert rL349136: [llvm-exegesis] Optimize ToProcess in dbScan
Simon Pilgrim [Fri, 14 Dec 2018 09:25:08 +0000 (09:25 +0000)]
Revert rL349136: [llvm-exegesis] Optimize ToProcess in dbScan

Summary:
Use `vector<char> Added + vector<size_t> ToProcess` to replace `SetVector ToProcess`

We also check `Added[P]` to enqueueing a point more than once, which
also saves us a `ClusterIdForPoint_[Q].isUndef()` check.

Reviewers: courbet, RKSimon, gchatelet, john.brawn, lebedev.ri

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D54442
........
Patch wasn't approved and breaks buildbots

llvm-svn: 349139

5 years agoIntroduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteM...
Dan Liew [Fri, 14 Dec 2018 09:03:18 +0000 (09:03 +0000)]
Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteMap`, and `TwoLevelByteMap`.

Summary:
This is a follow up patch to r346956 for the `SizeClassAllocator32`
allocator.

This patch makes `AddressSpaceView` a template parameter both to the
`ByteMap` implementations (but makes `LocalAddressSpaceView` the
default), some `AP32` implementations and is used in `SizeClassAllocator32`.
The actual changes to `ByteMap` implementations and
`SizeClassAllocator32` are very simple. However the patch is large
because it requires changing all the `AP32` definitions, and users of
those definitions.

For ASan and LSan we make `AP32` and `ByteMap` templateds type that take
a single `AddressSpaceView` argument. This has been done because we will
instantiate the allocator with a type that isn't `LocalAddressSpaceView`
in the future patches. For the allocators used in the other sanitizers
(i.e. HWAsan, MSan, Scudo, and TSan) use of `LocalAddressSpaceView` is
hard coded because we do not intend to instantiate the allocators with
any other type.

In the cases where untemplated types have become templated on a single
`AddressSpaceView` parameter (e.g. `PrimaryAllocator`) their name has
been changed to have a `ASVT` suffix (Address Space View Type) to
indicate they are templated.  The only exception to this are the `AP32`
types due to the desire to keep the type name as short as possible.

In order to check that template is instantiated in the correct a way a
`static_assert(...)` has been added that checks that the
`AddressSpaceView` type used by `Params::ByteMap::AddressSpaceView` matches
the `Params::AddressSpaceView`. This uses the new `sanitizer_type_traits.h`
header.

rdar://problem/45284065

Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

Subscribers: mgorny, llvm-commits, #sanitizers

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

llvm-svn: 349138

5 years ago[DAGCombiner][X86] Prevent visitSIGN_EXTEND from returning N when (sext (setcc))...
Craig Topper [Fri, 14 Dec 2018 08:28:24 +0000 (08:28 +0000)]
[DAGCombiner][X86] Prevent visitSIGN_EXTEND from returning N when (sext (setcc)) already has the target desired type for the setcc

Summary:
If the setcc already has the target desired type we can reach the getSetCC/getSExtOrTrunc after the MatchingVecType check with the exact same types as the nodes we started with. This causes those causes VsetCC to be CSEd to N0 and the getSExtOrTrunc will CSE to N. When we return N, the caller will think that meant we called CombineTo and did our own worklist management. But that's not what happened. This prevents target hooks from being called for the node.

To fix this, I've now returned SDValue if the setcc is already the desired type. But to avoid some regressions in X86 I've had to disable one of the target combines that wasn't being reached before in the case of a (sext (setcc)). If we get vector widening legalization enabled that entire function will be deleted anyway so hopefully this is only for the short term.

Reviewers: RKSimon, spatel

Subscribers: llvm-commits

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

llvm-svn: 349137

5 years ago[llvm-exegesis] Optimize ToProcess in dbScan
Fangrui Song [Fri, 14 Dec 2018 08:27:35 +0000 (08:27 +0000)]
[llvm-exegesis] Optimize ToProcess in dbScan

Summary:
Use `vector<char> Added + vector<size_t> ToProcess` to replace `SetVector ToProcess`

We also check `Added[P]` to enqueueing a point more than once, which
also saves us a `ClusterIdForPoint_[Q].isUndef()` check.

Reviewers: courbet, RKSimon, gchatelet, john.brawn, lebedev.ri

Subscribers: tschuett, llvm-commits

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

llvm-svn: 349136

5 years ago[ThinLTO] Fix test added in rL349076
Fangrui Song [Fri, 14 Dec 2018 08:21:08 +0000 (08:21 +0000)]
[ThinLTO] Fix test added in rL349076

llvm-svn: 349135

5 years ago[sanitizer] Fix nolibc internal_sleep
Fangrui Song [Fri, 14 Dec 2018 08:09:43 +0000 (08:09 +0000)]
[sanitizer] Fix nolibc internal_sleep

Reviewers: kubamracek, vitalybuka

Reviewed By: vitalybuka

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 349134

5 years ago[Object] Rename getRelrRelocationType to getRelativeRelocationType
Fangrui Song [Fri, 14 Dec 2018 07:46:58 +0000 (07:46 +0000)]
[Object] Rename getRelrRelocationType to getRelativeRelocationType

Summary:
The two utility functions were added in D47919 to support SHT_RELR.
However, these are just relative relocations types and are't
necessarily be named Relr.

Reviewers: phosek, dberris

Reviewed By: dberris

Subscribers: llvm-commits

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

llvm-svn: 349133

5 years ago[clang-tidy] Remove extra config.h includes
Ivan Donchevskii [Fri, 14 Dec 2018 07:44:52 +0000 (07:44 +0000)]
[clang-tidy] Remove extra config.h includes

It's included in a new header ClangTidyForceLinker.h and should not
be included the second time.

Follow up for the https://reviews.llvm.org/D55595

llvm-svn: 349132

5 years ago[clang-tidy] Share the forced linking code between clang-tidy tool and plugin
Ivan Donchevskii [Fri, 14 Dec 2018 07:29:06 +0000 (07:29 +0000)]
[clang-tidy] Share the forced linking code between clang-tidy tool and plugin

Extract code that forces linking to the separate header and include it in both plugin and standalone tool.
Try 2: missing header guard and "clang/Config/config.h" are added to the new header.

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

llvm-svn: 349131

5 years ago[llvm-xray] Use correct variable name
Petr Hosek [Fri, 14 Dec 2018 06:06:19 +0000 (06:06 +0000)]
[llvm-xray] Use correct variable name

This fixes the compiler error introduced in r349129.

llvm-svn: 349130

5 years ago[llvm-xray] Store offset pointers in temporaries
Petr Hosek [Fri, 14 Dec 2018 05:56:20 +0000 (05:56 +0000)]
[llvm-xray] Store offset pointers in temporaries

DataExtractor::getU64 modifies the OffsetPtr which also pass to
RelocateOrElse which breaks on Windows. This addresses the issue
introduced in r349120.

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

llvm-svn: 349129

5 years agoRemove unused variable.
Richard Trieu [Fri, 14 Dec 2018 05:40:30 +0000 (05:40 +0000)]
Remove unused variable.

llvm-svn: 349128

5 years agoUpdate google benchmark again
Eric Fiselier [Fri, 14 Dec 2018 03:48:09 +0000 (03:48 +0000)]
Update google benchmark again

llvm-svn: 349127

5 years agoUpdate google benchmark version
Eric Fiselier [Fri, 14 Dec 2018 03:37:13 +0000 (03:37 +0000)]
Update google benchmark version

llvm-svn: 349126

5 years agoFix up diagnostics.
Richard Trieu [Fri, 14 Dec 2018 03:35:10 +0000 (03:35 +0000)]
Fix up diagnostics.

Move some diagnostics around between Diagnostic*Kinds.td files.  Diagnostics
used in multiple places were moved to DiagnosticCommonKinds.td.  Diagnostics
listed in the wrong place (ie, Sema diagnostics listed in
DiagnosticsParseKinds.td) were moved to the correct places.  One diagnostic
split into two so that the diagnostic string is in the .td file instead of in
code.  Cleaned up the diagnostic includes after all the changes.

llvm-svn: 349125

5 years ago[gn build] Merge r348963 and r349076
Nico Weber [Fri, 14 Dec 2018 03:20:46 +0000 (03:20 +0000)]
[gn build] Merge r348963 and r349076

llvm-svn: 349124

5 years ago[clang-tidy] Improve google-objc-function-naming diagnostics 📙
Stephane Moore [Fri, 14 Dec 2018 03:13:31 +0000 (03:13 +0000)]
[clang-tidy] Improve google-objc-function-naming diagnostics ðŸ“™

Summary:
The diagnostics from google-objc-function-naming check will be more
actionable if they provide a brief description of the requirements from
the Google Objective-C style guide. The more descriptive diagnostics may
help clarify that functions in the global namespace must have an
appropriate prefix followed by Pascal case (engineers working previously
with static functions might not immediately understand the different
requirements of static and non-static functions).

Test Notes:
Verified against the clang-tidy tests.

Reviewers: benhamilton, aaron.ballman

Reviewed By: benhamilton

Subscribers: MyDeveloperDay, xazax.hun, cfe-commits

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

llvm-svn: 349123

5 years agoFix test failures that depended on module order
Greg Clayton [Fri, 14 Dec 2018 03:07:15 +0000 (03:07 +0000)]
Fix test failures that depended on module order

llvm-svn: 349122

5 years agoRevert "[clang-tidy] Share the forced linking code between clang-tidy tool and plugin"
Douglas Yung [Fri, 14 Dec 2018 02:04:04 +0000 (02:04 +0000)]
Revert "[clang-tidy] Share the forced linking code between clang-tidy tool and plugin"

This reverts commit r349038 as it was causing test failures:

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

llvm-svn: 349121

5 years ago[llvm-xray] Support for PIE
Petr Hosek [Fri, 14 Dec 2018 01:37:56 +0000 (01:37 +0000)]
[llvm-xray] Support for PIE

When the instrumented binary is linked as PIE, we need to apply the
relative relocations to sleds. This is handled by the dynamic linker
at runtime, but when processing the file we have to do it ourselves.

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

llvm-svn: 349120

5 years ago[macho] save the SDK version stored in module metadata into the version min and
Alex Lorenz [Fri, 14 Dec 2018 01:14:10 +0000 (01:14 +0000)]
[macho] save the SDK version stored in module metadata into the version min and
build version load commands in the object file

This commit introduces a new metadata node called "SDK Version". It will be set
by the frontend to mark the platform SDK (macOS/iOS/etc) version which was used
during that particular compilation.
This node is used when machine code is emitted, by either saving the SDK version
into the appropriate macho load command (version min/build version), or by
emitting the assembly for these load commands with the SDK version specified as
well.
The assembly for both load commands is extended by allowing it to contain the
sdk_version X, Y [, Z] trailing directive to represent the SDK version
respectively.

rdar://45774000

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

llvm-svn: 349119

5 years agoRevert "Try to update the test to fix the breakage With the new warning, we are showi...
Adam Nemet [Fri, 14 Dec 2018 00:43:36 +0000 (00:43 +0000)]
Revert "Try to update the test to fix the breakage With the new warning, we are showing one more output in the test."

This reverts commit r349064.

This wasn't updating the right test.  Causing (not the different line number
from the previous revert):

======================================================================
FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py", line 18, in test_diagnostic_warning
    self.assertEqual(len(tu.diagnostics), 2)
AssertionError: 1 != 2

llvm-svn: 349118

5 years agoRevert "Make -Wstring-plus-int warns even if when the result is not out of bounds"
Adam Nemet [Fri, 14 Dec 2018 00:43:34 +0000 (00:43 +0000)]
Revert "Make -Wstring-plus-int warns even if when the result is not out of bounds"

This reverts commit r349054.

It's causing:

FAILED: tools/clang/bindings/python/tests/CMakeFiles/check-clang-python
FAIL: test_diagnostic_range (tests.cindex.test_diagnostics.TestDiagnostics)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
  "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
  line 55, in test_diagnostic_range
      self.assertEqual(len(tu.diagnostics), 1)
      AssertionError: 2 != 1

======================================================================
FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
  "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
  line 18, in test_diagnostic_warning
      self.assertEqual(len(tu.diagnostics), 2)
      AssertionError: 1 != 2

llvm-svn: 349117

5 years agoWindows ASan: Instrument _msize_base()
Vlad Tsyrklevich [Fri, 14 Dec 2018 00:39:16 +0000 (00:39 +0000)]
Windows ASan: Instrument _msize_base()

Summary:
A recent update to the VS toolchain in chromium [1] broke the windows
ASan bot because the new toolchain calls _msize_base() instead of
_msize() in a number of _aligned_* UCRT routines. Instrument
_msize_base() as well.

[1] https://crbug.com/914947

Reviewers: rnk, #sanitizers, vitalybuka

Reviewed By: rnk, #sanitizers, vitalybuka

Subscribers: vitalybuka, kubamracek, llvm-commits

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

llvm-svn: 349115

5 years ago[Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for MS...
Craig Topper [Fri, 14 Dec 2018 00:21:02 +0000 (00:21 +0000)]
[Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for MS compatibility. Remove declarations from intrin.h and implementations from lzcntintrin.h

intrin.h had forward declarations for these and lzcntintrin.h had implementations that were only available with -mlzcnt or a -march that supported the lzcnt feature.

For MS compatibility we should always have these builtins available regardless of X86 being the target or the CPU support the lzcnt instruction. The backends should be able to gracefully fallback to something support even if its just shifts and bit ops.

Unfortunately, gcc also implements 2 of the 3 function names here on X86 when lzcnt feature is enabled.

This patch adds builtins for these for MSVC compatibility and drops the forward declarations from intrin.h. To keep the gcc compatibility the two intrinsics that collided have been turned into macros that use the X86 specific builtins with the lzcnt feature check. These macros are only defined when _MSC_VER is not defined. Without them being macros we can get a redefinition error because -ms-extensions doesn't seem to set _MSC_VER but does make the MS builtins available.

Should fix PR40014

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

llvm-svn: 349098

5 years agoSilence CMP0048 warning in the benchmark utility library
Reid Kleckner [Fri, 14 Dec 2018 00:17:12 +0000 (00:17 +0000)]
Silence CMP0048 warning in the benchmark utility library

I'm testing this in LLVM before sending it upstream.

Part of PR38874

llvm-svn: 349097

5 years ago[gn build] Add infrastructure to create symlinks and use it to create lld's symlinks
Nico Weber [Fri, 14 Dec 2018 00:16:33 +0000 (00:16 +0000)]
[gn build] Add infrastructure to create symlinks and use it to create lld's symlinks

This is slightly involved, see the comments in the code.

The GN build now builds a functional lld!

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

llvm-svn: 349096

5 years ago[DAGCombiner] clean up visitEXTRACT_VECTOR_ELT
Sanjay Patel [Fri, 14 Dec 2018 00:09:08 +0000 (00:09 +0000)]
[DAGCombiner] clean up visitEXTRACT_VECTOR_ELT

This isn't quite NFC, but I don't know how to expose
any outward diffs from these changes. Mostly, this
was confusing because it used 'VT' to refer to the
operand type rather the usual type of the input node.

There's also a large block at the end that is dedicated
solely to matching loads, but that wasn't obvious. This
could probably be split up into separate functions to
make it easier to see.

It's still not clear to me when we make certain transforms
because the legality and constant conditions are
intertwined in a way that might be improved.

llvm-svn: 349095

5 years ago[X86] Demote EmitTest to a helper function of EmitCmp. Route all callers except EmitC...
Craig Topper [Thu, 13 Dec 2018 23:55:30 +0000 (23:55 +0000)]
[X86] Demote EmitTest to a helper function of EmitCmp. Route all callers except EmitCmp through EmitCmp.

This requires the two callers to manifest a 0 to make EmitCmp call EmitTest.

I'm looking into changing how we combine TEST and flag setting instructions to not be part of lowering. And instead be part of DAG combine or isel. Which will mean EmitTest will probably become gutted and maybe disappear entirely.

llvm-svn: 349094

5 years agoRevert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"
Evgeniy Stepanov [Thu, 13 Dec 2018 23:47:59 +0000 (23:47 +0000)]
Revert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"

Breaks sanitizer-android buildbot.

This reverts commit 85e02baff327e7b67ea5b47897302901abb2aa5d.

llvm-svn: 349093

5 years agoRevert "[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"
Evgeniy Stepanov [Thu, 13 Dec 2018 23:47:50 +0000 (23:47 +0000)]
Revert "[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"

Breaks sanitizer-android buildbot.

This reverts commit af8443a984c3b491c9ca2996b8d126ea31e5ecbe.

llvm-svn: 349092

5 years ago[AArch64] Fix Exynos predicates (NFC)
Evandro Menezes [Thu, 13 Dec 2018 23:19:46 +0000 (23:19 +0000)]
[AArch64] Fix Exynos predicates (NFC)

Fix the logic in the definition of the `ExynosShiftExPred` as a more
specific version of `ExynosShiftPred`.  But, since `ExynosShiftExPred` is
not used yet, this change has NFC.

llvm-svn: 349091

5 years ago[OpenMP] Fix transient divide by zero bug in 32-bit code
Jonathan Peyton [Thu, 13 Dec 2018 23:18:55 +0000 (23:18 +0000)]
[OpenMP] Fix transient divide by zero bug in 32-bit code

The value returned by __kmp_now_nsec() can overflow 32-bit values causing
incorrect values to be returned. The overflow can end up causing a divide
by zero error because in __kmp_initialize_system_tick(), the value
(__kmp_now_nsec() - nsec) can end up being much larger than the numerator:
1e6 * (delay + (now - goal))
during a pathological timing where the current time calculated is much larger
than nsec. When this happens, the value of __kmp_ticks_per_msec is set to zero
which is then used as the denominator in the KMP_NOW_MSEC() macro leading to
the divide by zero error.

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

llvm-svn: 349090

5 years ago[OpenMP] Implement OpenMP 5.0 affinity format functionality
Jonathan Peyton [Thu, 13 Dec 2018 23:14:24 +0000 (23:14 +0000)]
[OpenMP] Implement OpenMP 5.0 affinity format functionality

This patch adds the affinity format functionality introduced in OpenMP 5.0.
This patch adds: Two new environment variables:

OMP_DISPLAY_AFFINITY=TRUE|FALSE
OMP_AFFINITY_FORMAT=<string>
and Four new API:
1) omp_set_affinity_format()
2) omp_get_affinity_format()
3) omp_display_affinity()
4) omp_capture_affinity()
The affinity format functionality has two ICV's associated with it:
affinity-display-var (bool) and affinity-format-var (string).
The affinity-display-var enables/disables the functionality through the
envirable OMP_DISPLAY_AFFINITY. The affinity-format-var is a formatted
string with the special field types beginning with a '%' character
similar to printf
For example, the affinity-format-var could be:
"OMP: host:%H pid:%P OStid:%i num_threads:%N thread_num:%n affinity:{%A}"

The affinity-format-var is displayed by every thread implicitly at the beginning
of a parallel region when any thread's affinity has changed (including a brand
new thread being spawned), or explicitly using the omp_display_affinity() API.
The omp_capture_affinity() function can capture the affinity-format-var in a
char buffer. And omp_set|get_affinity_format() allow the user to set|get the
affinity-format-var explicitly at runtime. omp_capture_affinity() and
omp_get_affinity_format() both return the number of characters needed to hold
the entire string it tried to make (not including NULL character). If not
enough buffer space is available,
both these functions truncate their output.

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

llvm-svn: 349089

5 years ago[SampleFDO] handle ProfileSampleAccurate when initializing function entry count
Wei Mi [Thu, 13 Dec 2018 21:51:42 +0000 (21:51 +0000)]
[SampleFDO] handle ProfileSampleAccurate when initializing function entry count

ProfileSampleAccurate is used to indicate the profile has exact match to the
code to be optimized.

Previously ProfileSampleAccurate is handled in ProfileSummaryInfo::isColdCallSite
and ProfileSummaryInfo::isColdBlock. A better solution is to initialize function
entry count to 0 when ProfileSampleAccurate is true, so we don't have to handle
ProfileSampleAccurate in multiple places.

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

llvm-svn: 349088

5 years ago[CUDA] Make all host-side shadows of device-side variables undef.
Artem Belevich [Thu, 13 Dec 2018 21:43:04 +0000 (21:43 +0000)]
[CUDA] Make all host-side shadows of device-side variables undef.

The host-side code can't (and should not) access the values that may
only exist on the device side. E.g. address of a __device__ function
does not exist on the host side as we don't generate the code for it there.

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

llvm-svn: 349087

5 years agoAttempt to fix code completion test to handle LLP64 platforms
Reid Kleckner [Thu, 13 Dec 2018 21:41:07 +0000 (21:41 +0000)]
Attempt to fix code completion test to handle LLP64 platforms

llvm-svn: 349086

5 years agoFix test after -Wstring-plus-int warning was enabled
Reid Kleckner [Thu, 13 Dec 2018 21:24:08 +0000 (21:24 +0000)]
Fix test after -Wstring-plus-int warning was enabled

Use array indexing instead of addition.

llvm-svn: 349085

5 years agoRevert r348971: [AMDGPU] Support for "uniform-work-group-size" attribute
Aakanksha Patil [Thu, 13 Dec 2018 21:23:12 +0000 (21:23 +0000)]
Revert r348971: [AMDGPU] Support for "uniform-work-group-size" attribute

This patch breaks RADV (and probably RadeonSI as well)

llvm-svn: 349084

5 years agoFix debug-info-abspath.c on Windows by removing /tmp/t.o line
Reid Kleckner [Thu, 13 Dec 2018 21:18:16 +0000 (21:18 +0000)]
Fix debug-info-abspath.c on Windows by removing /tmp/t.o line

This object seemed unused, so I believe we can just remove this compiler
invocation without losing any test coverage.

llvm-svn: 349083

5 years agoUpdate the scan-build to generate SARIF.
Aaron Ballman [Thu, 13 Dec 2018 20:55:34 +0000 (20:55 +0000)]
Update the scan-build to generate SARIF.

This updates the scan-build perl script to allow outputting to sarif in a more natural fashion by specifying -sarif as a command line argument, similar to how -plist is already supported.

llvm-svn: 349082

5 years agoAMDGPU/GlobalISel: Legalize/regbankselect block_addr
Matt Arsenault [Thu, 13 Dec 2018 20:34:15 +0000 (20:34 +0000)]
AMDGPU/GlobalISel: Legalize/regbankselect block_addr

llvm-svn: 349081

5 years ago[libc++] Fix _LIBCPP_EXPORTED_FROM_ABI when visibility annotations are disabled
Thomas Anderson [Thu, 13 Dec 2018 20:06:14 +0000 (20:06 +0000)]
[libc++] Fix _LIBCPP_EXPORTED_FROM_ABI when visibility annotations are disabled

Fixes a bug where functions would get exported when building with
-fvisibility=hidden and defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS. No
visibility annotations should be added in this case.

The new logic for _LIBCPP_EXPORTED_FROM_ABI matches that of the other visibility
annotations around it.

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

llvm-svn: 349080

5 years agoReapply "[MemCpyOpt] memset->memcpy forwarding with undef tail"
Nikita Popov [Thu, 13 Dec 2018 20:04:27 +0000 (20:04 +0000)]
Reapply "[MemCpyOpt] memset->memcpy forwarding with undef tail"

Currently memcpyopt optimizes cases like

    memset(a, byte, N);
    memcpy(b, a, M);

to

    memset(a, byte, N);
    memset(b, byte, M);

if M <= N. Often this allows further simplifications down the line,
which drop the first memset entirely.

This patch extends this optimization for the case where M > N, but we
know that the bytes a[N..M] are undef due to alloca/lifetime.start.

This situation arises relatively often for Rust code, because Rust does
not initialize trailing structure padding and loves to insert redundant
memcpys. This also fixes https://bugs.llvm.org/show_bug.cgi?id=39844.

The previous version of this patch did not perform dependency checking
properly: While the dependency is checked at the position of the memset,
the used size must be that of the memcpy. Previously the size of the
memset was used, which missed modification in the region
MemSetSize..CopySize, resulting in miscompiles. The added tests cover
variations of this issue.

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

llvm-svn: 349078

5 years agoImplement a small subset of the C++ `type_traits` header inside sanitizer_common...
Dan Liew [Thu, 13 Dec 2018 19:55:36 +0000 (19:55 +0000)]
Implement a small subset of the C++ `type_traits` header inside sanitizer_common so we can avoid depending on system C++ headers.

Summary:
In particular we implement the `is_same<T,U>` templated type. This is
useful for doing compile-time comparison of types in `static_assert`s.
The plan is to use this in another patch (
https://reviews.llvm.org/D54904 ).

Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

Subscribers: mgorny, #sanitizers, llvm-commits

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

llvm-svn: 349077

5 years ago[ThinLTO] Compute synthetic function entry count
Easwaran Raman [Thu, 13 Dec 2018 19:54:27 +0000 (19:54 +0000)]
[ThinLTO] Compute synthetic function entry count

Summary:
This patch computes the synthetic function entry count on the whole
program callgraph (based on module summary) and writes the entry counts
to the summary. After function importing, this count gets attached to
the IR as metadata. Since it adds a new field to the summary, this bumps
up the version.

Reviewers: tejohnson

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 349076

5 years ago[llvm] Address base discriminator overflow in X86DiscriminateMemOps
Mircea Trofin [Thu, 13 Dec 2018 19:40:59 +0000 (19:40 +0000)]
[llvm] Address base discriminator overflow in X86DiscriminateMemOps

Summary:
Macros are expanded on a single line. In case of large expansions,
with sufficiently many instructions with memory operands (and when
-fdebug-info-for-profiling is requested), we may be unable to generate
new base discriminator values - new values overflow (base
discriminators may not be larger than 2^12).

This CL warns instead of asserting in such a case. A subsequent CL
will add APIs to check for overflow before creating new debug info.

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

Reviewers: davidxl, wmi, gbedwell

Reviewed By: davidxl

Subscribers: aprantl, llvm-commits

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

llvm-svn: 349075

5 years ago[llvm-size][libobject] Add explicit "inTextSegment" methods similar to "isText" secti...
Jordan Rupprecht [Thu, 13 Dec 2018 19:40:12 +0000 (19:40 +0000)]
[llvm-size][libobject] Add explicit "inTextSegment" methods similar to "isText" section methods to calculate size correctly.

Summary:
llvm-size uses "isText()" etc. which seem to indicate whether the section contains code-like things, not whether or not it will actually go in the text segment when in a fully linked executable.

The unit test added (elf-sizes.test) shows some types of sections that cause discrepencies versus the GNU size tool. llvm-size is not correctly reporting sizes of things mapping to text/data segments, at least for ELF files.

This fixes pr38723.

Reviewers: echristo, Bigcheese, MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

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

llvm-svn: 349074

5 years ago[clang-tidy] Add the abseil-duration-subtraction check
Hyrum Wright [Thu, 13 Dec 2018 19:23:52 +0000 (19:23 +0000)]
[clang-tidy] Add the abseil-duration-subtraction check

Summary:
This check uses the context of a subtraction expression as well as knowledge
about the Abseil Time types, to infer the type of the second operand of some
subtraction expressions in Duration conversions. For example:

   absl::ToDoubleSeconds(duration) - foo

can become
   absl::ToDoubleSeconds(duration - absl::Seconds(foo))

This ensures that time calculations are done in the proper domain, and also
makes it easier to further deduce the types of the second operands to these
expressions.

Reviewed By: JonasToth

Tags: #clang-tools-extra

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

llvm-svn: 349073

5 years ago[CostModel][X86] Don't count 2 shuffles on the last level of a pairwise arithmetic...
Craig Topper [Thu, 13 Dec 2018 19:08:10 +0000 (19:08 +0000)]
[CostModel][X86] Don't count 2 shuffles on the last level of a pairwise arithmetic or min/max reduction

This is split from D55452 with the correct patch this time.

Pairwise reductions require two shuffles on every level but the last. On the last level the two shuffles are <1, u, u, u...> and <0, u, u, u...>, but <0, u, u, u...> will be dropped by InstCombine/DAGCombine as being an identity shuffle.

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

llvm-svn: 349072

5 years ago[libcxx] Fix pop_back() tests to make sure they don't always just pass
Louis Dionne [Thu, 13 Dec 2018 18:53:17 +0000 (18:53 +0000)]
[libcxx] Fix pop_back() tests to make sure they don't always just pass

llvm-svn: 349071

5 years ago[CMake] llvm_codesign workaround for Xcode double-signing errors
Stefan Granitz [Thu, 13 Dec 2018 18:51:19 +0000 (18:51 +0000)]
[CMake] llvm_codesign workaround for Xcode double-signing errors

Summary:
When using Xcode to build LLVM with code signing, the post-build rule is executed even if the actual build-step was skipped. This causes double-signing errors. We can currently only avoid it by passing the `--force` flag.

Plus some polishing for my previous patch D54443.

Reviewers: beanz, kubamracek

Reviewed By: kubamracek

Subscribers: #lldb, mgorny, llvm-commits

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

llvm-svn: 349070

5 years ago[LoopUtils] Use i32 instead of `void`.
Davide Italiano [Thu, 13 Dec 2018 18:37:23 +0000 (18:37 +0000)]
[LoopUtils] Use i32 instead of `void`.

The actual type of the first argument of the @dbg intrinsic
doesn't really matter as we're setting it to `undef`, but the
bitcode reader is picky about `void` types.

llvm-svn: 349069

5 years agoDon't add unnecessary compiler flags to llvm-config output
Tom Stellard [Thu, 13 Dec 2018 18:21:23 +0000 (18:21 +0000)]
Don't add unnecessary compiler flags to llvm-config output

Summary:
llvm-config --cxxflags --cflags, should only output the minimal flags
required to link against the llvm libraries.  They currently contain
all flags used to compile llvm including flags like -g, -pedantic,
-Wall, etc, which users may not always want.

This changes the llvm-config output to only include flags that have been
explictly added to the COMPILE_FLAGS property of the llvm-config target
by the llvm build system.

llvm.org/PR8220

Output from llvm-config when running cmake with:
cmake -G Ninja .. -DCMAKE_CXX_FLAGS=-funroll-loops

Before:

--cppflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include
            -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
--cflags:   -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include
            -fPIC -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings \
            -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough \
            -Wno-comment -fdiagnostics-color -g -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS \
            -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
--cxxflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include\
            -funroll-loops -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall \
            -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers \
            -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized \
            -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment \
            -fdiagnostics-color -g  -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG \
            -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"

After:

--cppflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include \
            -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
--cflags:   -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include \
            -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
--cxxflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include \
             -std=c++11   -fno-exceptions -fno-rtti \
             -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

Reviewers: sylvestre.ledru, infinity0, mgorny

Reviewed By: sylvestre.ledru, mgorny

Subscribers: mgorny, dmgreen, llvm-commits

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

llvm-svn: 349068

5 years ago[NativePDB] Add support for local variables.
Zachary Turner [Thu, 13 Dec 2018 18:17:51 +0000 (18:17 +0000)]
[NativePDB] Add support for local variables.

This patch adds support for parsing and evaluating local variables.
using the native pdb plugin.

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

llvm-svn: 349067

5 years agoCorrectly handle skewed streams in drop_front() method.
Zachary Turner [Thu, 13 Dec 2018 18:11:33 +0000 (18:11 +0000)]
Correctly handle skewed streams in drop_front() method.

When calling BinaryStreamArray::drop_front(), if the stream
is skewed it means we must never drop the first bytes of the
stream since offsets which occur in records assume the existence
of those bytes.  So if we want to skip the first record in a
stream, then what we really want to do is just set the begin
pointer to the next record.  But we shouldn't actually remove
those bytes from the underlying view of the data.

llvm-svn: 349066

5 years agoReinstate DW_AT_comp_dir support after D55519.
Adrian Prantl [Thu, 13 Dec 2018 17:53:29 +0000 (17:53 +0000)]
Reinstate DW_AT_comp_dir support after D55519.

The DIFile used by the CU is special and distinct from the main source
file. Its directory part specifies what becomes the DW_AT_comp_dir
(the compilation directory), even if the source file was specified
with an absolute path.

To support the .dwo workflow, a valid DW_AT_comp_dir is necessary even
if source files were specified with an absolute path.

llvm-svn: 349065

5 years agoTry to update the test to fix the breakage
Sylvestre Ledru [Thu, 13 Dec 2018 17:39:02 +0000 (17:39 +0000)]
Try to update the test to fix the breakage
With the new warning, we are showing one more output in the test.

llvm-svn: 349064

5 years ago[CodeComplete] Adhere to LLVM naming style in CodeCompletionTest. NFC
Ilya Biryukov [Thu, 13 Dec 2018 17:32:38 +0000 (17:32 +0000)]
[CodeComplete] Adhere to LLVM naming style in CodeCompletionTest. NFC

Also reuses the same var for multiple to reduce the chance of
accidentally referecing the previous test.

llvm-svn: 349063

5 years agoFix MinidumpParser::GetFilteredModuleList() and test it
Greg Clayton [Thu, 13 Dec 2018 17:24:30 +0000 (17:24 +0000)]
Fix MinidumpParser::GetFilteredModuleList() and test it

The MinidumpParser::GetFilteredModuleList() code was attempting to iterate through the entire module list and if it found more than one entry for a given module name, it wanted to pick the MinidumpModule with the lowest address. A bug existed where it wasn't doing that due to "exists" variable being inverted. "exists" was set to true if it was inserted, not if it existed. Furthermore, the order of the modules would be modified by sorting all modules from low address to high address (using MinidumpModule::base_of_image). This fix also maintains the original order which means your executable is at index 0 as intended instead of some random shared library.

Tests were added to ensure this functionality doesn't regress.

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

llvm-svn: 349062

5 years ago[CodeComplete] Temporarily disable failing assertion
Ilya Biryukov [Thu, 13 Dec 2018 17:23:48 +0000 (17:23 +0000)]
[CodeComplete] Temporarily disable failing assertion

Found the case in the clang codebase where the assertion fires.
To avoid crashing assertion-enabled builds before I re-add the missing
operation.
Will restore the assertion alongside the upcoming fix.

llvm-svn: 349061

5 years ago[MachO][TLOF] Add support for local symbols in the indirect symbol table
Francis Visoiu Mistrih [Thu, 13 Dec 2018 17:23:30 +0000 (17:23 +0000)]
[MachO][TLOF] Add support for local symbols in the indirect symbol table

On 32-bit archs, before, we would assume that an indirect symbol will
never have local linkage. This can lead to miscompiles where the
symbol's value would be 0 and the linker would use that value, because
the indirect symbol table would contain the value
`INDIRECT_SYMBOL_LOCAL` for that specific symbol.

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

llvm-svn: 349060

5 years agoFix CodeCompleteTest.cpp for older gcc plus ccache builds
David Green [Thu, 13 Dec 2018 17:20:06 +0000 (17:20 +0000)]
Fix CodeCompleteTest.cpp for older gcc plus ccache builds

Some versions of gcc, especially when invoked through ccache (-E), can have
trouble with raw string literals inside macros. This moves the string out of
the macro.

llvm-svn: 349059

5 years ago[DAGCombiner] after simplifying demanded elements of vector operand of extract, revis...
Sanjay Patel [Thu, 13 Dec 2018 17:05:01 +0000 (17:05 +0000)]
[DAGCombiner] after simplifying demanded elements of vector operand of extract, revisit the extract; 2nd try

This is a retry of rL349051 (reverted at rL349056). I changed the check for dead-ness from
number of uses to an opcode test for DELETED_NODE based on existing similar code.

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

llvm-svn: 349058

5 years ago[X86][SSE] Add SSE vector imm/var shift support to SimplifyDemandedVectorEltsForTarge...
Simon Pilgrim [Thu, 13 Dec 2018 16:39:29 +0000 (16:39 +0000)]
[X86][SSE] Add SSE vector imm/var shift support to SimplifyDemandedVectorEltsForTargetNode

llvm-svn: 349057

5 years agorevert rL349051: [DAGCombiner] after simplifying demanded elements of vector operand...
Sanjay Patel [Thu, 13 Dec 2018 16:32:44 +0000 (16:32 +0000)]
revert rL349051: [DAGCombiner] after simplifying demanded elements of vector operand of extract, revisit the extract

This causes an address sanitizer bot failure:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/27187/steps/check-llvm%20asan/logs/stdio

llvm-svn: 349056

5 years agoRecommit r349041: [tblgen][disasm] Separate encodings from instructions
Daniel Sanders [Thu, 13 Dec 2018 16:17:54 +0000 (16:17 +0000)]
Recommit r349041: [tblgen][disasm] Separate encodings from instructions

Removed const from the ArrayRef<const EncodingAndInst> to avoid the
std::vector<const EncodingAndInst> that G++ saw

llvm-svn: 349055

5 years agoMake -Wstring-plus-int warns even if when the result is not out of bounds
Sylvestre Ledru [Thu, 13 Dec 2018 16:06:23 +0000 (16:06 +0000)]
Make -Wstring-plus-int warns even if when the result is not out of bounds

Summary: Patch by Arnaud Bienner

Reviewers: sylvestre.ledru, thakis

Reviewed By: thakis

Subscribers: cfe-commits

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

llvm-svn: 349054

5 years ago[CodeComplete] Fill preferred type on binary expressions
Ilya Biryukov [Thu, 13 Dec 2018 16:06:11 +0000 (16:06 +0000)]
[CodeComplete] Fill preferred type on binary expressions

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: arphaman, cfe-commits

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

llvm-svn: 349053

5 years ago[X86][SSE] Fix all remaining modulo vector rotation amounts (PR38243)
Simon Pilgrim [Thu, 13 Dec 2018 15:50:31 +0000 (15:50 +0000)]
[X86][SSE] Fix all remaining modulo vector rotation amounts (PR38243)

There's still a couple of minor SimplifyDemandedElts regressions in some of the shift amount splats that will be fixed in future patches.

llvm-svn: 349052