platform/upstream/llvm.git
5 years ago[XRay] Help gcc disambiguate names
Dean Michael Berris [Thu, 30 Aug 2018 09:04:12 +0000 (09:04 +0000)]
[XRay] Help gcc disambiguate names

Follow-up to D51210.

llvm-svn: 341042

5 years ago[clang-tidy] fix check_clang_tidy to forbid mixing of CHECK-NOTES and CHECK-MESSAGES
Jonas Toth [Thu, 30 Aug 2018 08:44:27 +0000 (08:44 +0000)]
[clang-tidy] fix check_clang_tidy to forbid mixing of CHECK-NOTES and CHECK-MESSAGES

Summary:
The check_clang_tidy.py script would allow mixing of `CHECK-NOTES` and `CHECK-MESSAGES` but running `FileCheck` for that would implicitly fail, because `CHECK-NOTES` bails out if there is a warning.

That means a clang-tidy test can not mix these constructs to check warnings with `CHECK-MESSAGES` and notes with `CHECK-NOTES`. The script gives now a clear error if that happens.

Reviewers: alexfh, aaron.ballman, lebedev.ri, hokein

Reviewed By: lebedev.ri

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 341039

5 years agoAMDGPU: Default to hidden visibility
Matt Arsenault [Thu, 30 Aug 2018 08:18:06 +0000 (08:18 +0000)]
AMDGPU: Default to hidden visibility

Object linking isn't supported, so it's not useful
to emit default visibility. Default visibility requires
relocations we don't yet support for functions compiled
in another translation unit.

WebAssembly already does this, although they insert these
arguments in a different place for some reason.

llvm-svn: 341033

5 years ago[XRay] Move out template and use perfect forwarding
Dean Michael Berris [Thu, 30 Aug 2018 08:15:42 +0000 (08:15 +0000)]
[XRay] Move out template and use perfect forwarding

Follow up to D51210.

llvm-svn: 341032

5 years agoRevert "[SimplifyCFG] Common debug handling [NFC]"
Martin Storsjo [Thu, 30 Aug 2018 08:06:50 +0000 (08:06 +0000)]
Revert "[SimplifyCFG] Common debug handling [NFC]"

This reverts commit r340997.

This change turned out not to be NFC after all, but e.g. causes
clang to crash when building the linux kernel for aarch64.

llvm-svn: 341031

5 years ago[XRay] Remove attribute packed
Dean Michael Berris [Thu, 30 Aug 2018 07:57:32 +0000 (07:57 +0000)]
[XRay] Remove attribute packed

Followup to D51210.

llvm-svn: 341030

5 years ago[XRay] FDRTraceWriter and FDR Trace Loading
Dean Michael Berris [Thu, 30 Aug 2018 07:22:21 +0000 (07:22 +0000)]
[XRay] FDRTraceWriter and FDR Trace Loading

Summary:
This is the first step in the larger refactoring and reduction of
D50441.

This step in the process does the following:

- Introduces more granular types of `Record`s representing the many
  kinds of records written/read by the Flight Data Recorder (FDR) mode
  `Trace` loading function(s).

- Introduces an abstract `RecordVisitor` type meant to handle the
  processing of the various `Record` derived types. This `RecordVisitor`
  has two implementations in this patch: `RecordInitializer` and
  `FDRTraceWriter`.

- We also introduce a convenience interface for building a collection of
  `Record` instances called a `LogBuilder`. This allows us to generate
  sequences of `Record` instances manually (used in unit tests but
  useful otherwise).

- The`FDRTraceWriter` class implements the `RecordVisitor` interface and
  handles the writing of metadata records to a `raw_ostream`. We
  demonstrate that in the unit test, we can generate in-memory FDR mode
  traces using the specific `Record` derived types, which we load
  through the `loadTrace(...)` function yielding valid `Trace` objects.

This patch introduces the required types and concepts for us to start
replacing the logic implemented in the `loadFDRLog` function to use the
more granular types. In subsequent patches, we will introduce more
visitor implementations which isolate the verification, printing,
indexing, production/consumption, and finally the conversion of the FDR
mode logs.

The overarching goal of these changes is to make handling FDR mode logs
better tested, more understandable, more extensible, and more
systematic. This will also allow us to better represent the execution
trace, as we improve the fidelity of the events we represent in an XRay
`Trace` object, which we intend to do after FDR mode log processing is
in better shape.

Reviewers: eizan

Reviewed By: eizan

Subscribers: mgorny, hiraditya, llvm-commits

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

llvm-svn: 341029

5 years agoDon't count debug instructions towards neighborhood count
Matt Arsenault [Thu, 30 Aug 2018 07:18:19 +0000 (07:18 +0000)]
Don't count debug instructions towards neighborhood count

In computeRegisterLiveness, the max instructions to search
was counting dbg_value instructions, which could potentially
cause an observable codegen change from the presence of debug
info.

llvm-svn: 341028

5 years agoCodeGen: Make computeRegisterLiveness search forward first
Matt Arsenault [Thu, 30 Aug 2018 07:18:10 +0000 (07:18 +0000)]
CodeGen: Make computeRegisterLiveness search forward first

If there is an unused def, this would previously
report that the register was live. Check for uses
first so that it is reported as dead if never used.

llvm-svn: 341027

5 years agoCodeGen: Make computeRegisterLiveness consider successors
Matt Arsenault [Thu, 30 Aug 2018 07:17:51 +0000 (07:17 +0000)]
CodeGen: Make computeRegisterLiveness consider successors

If the end of the block is reached during the scan, check
the live ins of the successors. This was already done in the
other direction if the block entry was reached.

llvm-svn: 341026

5 years ago[DWARF] Missing location debug information with -O2.
Carlos Alberto Enciso [Thu, 30 Aug 2018 07:17:41 +0000 (07:17 +0000)]
[DWARF] Missing location debug information with -O2.

Check that Machine CSE correctly handles during the transformation, the
debug location information for local variables.

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

llvm-svn: 341025

5 years ago[X86] Improved sched model for X86 CMPXCHG* instructions.
Andrew V. Tischenko [Thu, 30 Aug 2018 06:26:00 +0000 (06:26 +0000)]
[X86] Improved sched model for X86 CMPXCHG* instructions.
Differential Revision: https://reviews.llvm.org/D50070

llvm-svn: 341024

5 years ago[InstCombine] Add test cases for D51398
Craig Topper [Thu, 30 Aug 2018 06:14:54 +0000 (06:14 +0000)]
[InstCombine] Add test cases for D51398

These tests contain the pattern (neg (max ~X, C)) which we should transform to ((min X, ~C) + 1)

llvm-svn: 341023

5 years ago[X86] Make Feature64Bit useful
Craig Topper [Thu, 30 Aug 2018 06:01:05 +0000 (06:01 +0000)]
[X86] Make Feature64Bit useful

We now only add +64bit to the CPU string for "generic" CPU. All other CPU names are assumed to have the feature flag already set if they support 64-bit. I've remove the implies from CMPXCHG8 so that Feature64Bit only comes in via CPUs or user passing -mattr=+64bit.

I've changed the assert to a report_fatal_error so it's not lost in Release builds.

The test updates are to fix things that tripped the new error.

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

llvm-svn: 341022

5 years ago[X86] Update test command line to not use 64-bit mode on a 32-bit only athlon cpu.
Craig Topper [Thu, 30 Aug 2018 06:01:03 +0000 (06:01 +0000)]
[X86] Update test command line to not use 64-bit mode on a 32-bit only athlon cpu.

llvm-svn: 341021

5 years ago[X86] Remove powerpc cpu name and features from uwtables.ll
Craig Topper [Thu, 30 Aug 2018 06:01:01 +0000 (06:01 +0000)]
[X86] Remove powerpc cpu name and features from uwtables.ll

llvm-svn: 341020

5 years ago[Xray] Darwin improving slightly the support
David Carlier [Thu, 30 Aug 2018 05:55:27 +0000 (05:55 +0000)]
[Xray] Darwin improving slightly the support

using sysctl to get the tic frequency data.
still linkage issue for X-ray_init not resolved.

Reviewers: dberris, kubamracek

Reviewed By: dberris

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

llvm-svn: 341019

5 years agoDAG: Don't use ABI copies in some contexts
Matt Arsenault [Thu, 30 Aug 2018 05:49:28 +0000 (05:49 +0000)]
DAG: Don't use ABI copies in some contexts

If an ABI-like value is used in a different block,
the type split used is not necessarily the same as
the call's ABI. The value is used through an intermediate
copy virtual registers from the other block. This
resulted in copies with inconsistent sizes later.

Fixes regressions since r338197 when AMDGPU started
splitting vector types for calls.

llvm-svn: 341018

5 years ago[COFF] Skip exporting artificial symbols when exporting all symbols
Martin Storsjo [Thu, 30 Aug 2018 05:44:41 +0000 (05:44 +0000)]
[COFF] Skip exporting artificial symbols when exporting all symbols

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

llvm-svn: 341017

5 years ago[test] Adjust a test to use CHECK-NEXT instead of CHECK-NOT. NFC.
Martin Storsjo [Thu, 30 Aug 2018 05:44:36 +0000 (05:44 +0000)]
[test] Adjust a test to use CHECK-NEXT instead of CHECK-NOT. NFC.

Since the order and placement of the non-wanted elements might not
be obvious, it feels more straightforward to hardcode the whole list
with -NEXT elements (and checking for the end of the output with
CHECK-EMPTY) instead of adding CHECK-NOT lines at the right places
where the unwanted elements would appear if they erroneously
were to included.

llvm-svn: 341016

5 years ago[NFC] Move OrderedInstructions and InstructionPrecedenceTracking to Analysis
Max Kazantsev [Thu, 30 Aug 2018 04:49:03 +0000 (04:49 +0000)]
[NFC] Move OrderedInstructions and InstructionPrecedenceTracking to Analysis

These classes don't make any changes to IR and have no reason to be in
Transform/Utils. This patch moves them to Analysis folder. This will allow
us reusing these classes in some analyzes, like MustExecute.

llvm-svn: 341015

5 years agoRe-enable "[NFC] Unify guards detection"
Max Kazantsev [Thu, 30 Aug 2018 03:39:16 +0000 (03:39 +0000)]
Re-enable "[NFC] Unify guards detection"

rL340921 has been reverted by rL340923 due to linkage dependency
from Transform/Utils to Analysis which is not allowed. In this patch
this has been fixed, a new utility function moved to Analysis.

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

llvm-svn: 341014

5 years agoEnsure canonical type is actually canonical.
Richard Trieu [Thu, 30 Aug 2018 01:57:52 +0000 (01:57 +0000)]
Ensure canonical type is actually canonical.

ASTContext::applyObjCProtocolQualifiers will return a canonical type when given
a canonical type and an array of canonical protocols.  If the protocols are not
canonical then the returned type is also not canonical.  Since a canonical type is needed, canonicalize the returned type before using it.  This later prevents
a type from having a non-canonical canonical type.

llvm-svn: 341013

5 years ago[XRay][llvm] Load XRay Profiles
Dean Michael Berris [Thu, 30 Aug 2018 01:43:22 +0000 (01:43 +0000)]
[XRay][llvm] Load XRay Profiles

Summary:
This change implements the profile loading functionality in LLVM to
support XRay's profiling mode in compiler-rt.

We introduce a type named `llvm::xray::Profile` which allows building a
profile representation. We can load an XRay profile from a file to build
Profile instances, or do it manually through the Profile type's API.

The intent is to get the `llvm-xray` tool to generate `Profile`
instances and use that as the common abstraction through which all
conversion and analysis can be done. In the future we can generate
`Profile` instances from `Trace` instances as well, through conversion
functions.

Some of the key operations supported by the `Profile` API are:

- Path interning (`Profile::internPath(...)`) which returns a unique path
  identifier.

- Block appending (`Profile::addBlock(...)`) to add thread-associated
  profile information.

- Path ID to Path lookup (`Profile::expandPath(...)`) to look up a
  PathID and return the original interned path.

- Block iteration.

A 'Path' in this context represents the function call stack in
leaf-to-root order. This is represented as a path in an internally
managed prefix tree in the `Profile` instance. Having a handle (PathID)
to identify the unique Paths we encounter for a particular Profile
allows us to reduce the amount of memory required to associate profile
data to a particular Path.

This is the first of a series of patches to migrate the `llvm-stacks`
tool towards using a single profile representation.

Depends on D48653.

Reviewers: kpw, eizan

Reviewed By: kpw

Subscribers: kpw, thakis, mgorny, llvm-commits, hiraditya

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

llvm-svn: 341012

5 years ago[sanitizer] Transition to new _zx_vmar_... calls
Petr Hosek [Thu, 30 Aug 2018 01:27:26 +0000 (01:27 +0000)]
[sanitizer] Transition to new _zx_vmar_... calls

Now that all _zx_vmar_... calls have been updated, we can undo the
change made in r337801 and switch over to the new calls.

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

llvm-svn: 341011

5 years ago[WebAssembly] Be a little more conservative in WebAssemblyFixFunctionBitcasts
Sam Clegg [Thu, 30 Aug 2018 01:01:30 +0000 (01:01 +0000)]
[WebAssembly] Be a little more conservative in WebAssemblyFixFunctionBitcasts

We don't have enough information to know if struct types being
bitcast will cause validation failures or not, so be conservative
and allow such cases to persist (fot now).

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

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 341010

5 years agoAdjust Attr representation so that changes to documentation don't affect
Richard Smith [Thu, 30 Aug 2018 01:01:07 +0000 (01:01 +0000)]
Adjust Attr representation so that changes to documentation don't affect
how we parse source code.

Instead of implicitly opting all undocumented attributes out of '#pragma
clang attribute' support, explicitly opt them all out and remove the
documentation check from TableGen.

(No new attributes should be added without documentation, so this has
little chance of backsliding. We already support the pragma on one
undocumented attribute, so we don't even want to enforce our old
"rule".)

No functionality change intended.

llvm-svn: 341009

5 years ago[GlobalMerge] Fix GlobalMerge on bss external global variables.
Huihui Zhang [Thu, 30 Aug 2018 00:49:50 +0000 (00:49 +0000)]
[GlobalMerge] Fix GlobalMerge on bss external global variables.

Summary:
Global variables that are external and zero initialized are
supposed to be merged with global variables in the bss section
rather than the data section.

Reviewers: efriedma, rengolin, t.p.northover, javed.absar, asl, john.brawn, pcc

Reviewed By: efriedma

Subscribers: dmgreen, llvm-commits

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

llvm-svn: 341008

5 years ago[hwasan] add a simple threaded UAF test, make it work on x86 (need to disable tagging...
Kostya Serebryany [Thu, 30 Aug 2018 00:44:55 +0000 (00:44 +0000)]
[hwasan] add a simple threaded UAF test, make it work on x86 (need to disable tagging in malloc with inside pthread_create)

llvm-svn: 341007

5 years agoProvide a default implementation of TypeSystem::GetNumTemplateArguments
Frederic Riss [Thu, 30 Aug 2018 00:37:23 +0000 (00:37 +0000)]
Provide a default implementation of TypeSystem::GetNumTemplateArguments

... and remove the dummy implementations from the languages that do not
support it.

llvm-svn: 341006

5 years ago[hwasan] add basic ThreadRegistry plumbing, also rename HwasanThread to Thread
Kostya Serebryany [Thu, 30 Aug 2018 00:13:20 +0000 (00:13 +0000)]
[hwasan] add basic ThreadRegistry plumbing, also rename HwasanThread to Thread

llvm-svn: 341005

5 years ago[SimplifyCFG] Rename a variable for readibility of a future change [NFC]
Philip Reames [Thu, 30 Aug 2018 00:12:29 +0000 (00:12 +0000)]
[SimplifyCFG] Rename a variable for readibility of a future change [NFC]

llvm-svn: 341004

5 years agoMove the column marking functionality to the Highlighter framework
Raphael Isemann [Thu, 30 Aug 2018 00:09:21 +0000 (00:09 +0000)]
Move the column marking functionality to the Highlighter framework

Summary:
The syntax highlighting feature so far is mutually exclusive with the lldb feature
that marks the current column in the line by underlining it via an ANSI color code.
Meaning that if you enable one, the other is automatically disabled by LLDB.

This was caused by the fact that both features inserted color codes into the the
source code and were likely to interfere with each other (which would result
in a broken source code printout to the user).

This patch moves the cursor code into the highlighting framework, which provides
the same feature to the user in normal non-C source code. For any source code
that is highlighted by Clang, we now also have cursor marking for the whole token
that is under the current source location. E.g., before we underlined only the '!' in the
expression '1 != 2', but now the whole token '!=' is underlined. The same for function
calls and so on. Below you can see two examples where we before only underlined
the first character of the token, but now underline the whole token.

{F7075400}
{F7075414}

It also simplifies the DisplaySourceLines method in the SourceManager as most of
the code in there was essentially just for getting this column marker to work as
a FormatEntity.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: lldb-commits

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

llvm-svn: 341003

5 years ago[AttrDocs] Fix build bots: add missing GNUInline pragma to test.
Jordan Rupprecht [Thu, 30 Aug 2018 00:04:34 +0000 (00:04 +0000)]
[AttrDocs] Fix build bots: add missing GNUInline pragma to test.

llvm-svn: 341002

5 years ago[SimplifyCFG] Fix a cost modeling oversight in branch commoning
Philip Reames [Thu, 30 Aug 2018 00:03:02 +0000 (00:03 +0000)]
[SimplifyCFG] Fix a cost modeling oversight in branch commoning

The cost modeling was not accounting for the fact we were duplicating the instruction once per predecessor.  With a default threshold of 1, this meant we were actually creating #pred copies.

Adding to the fun, there is *absolutely no* test coverage for this.  Simply bailing for more than one predecessor passes all checked in tests.

llvm-svn: 341001

5 years ago[MS Demangler] Fix several crashes and demangling bugs.
Zachary Turner [Wed, 29 Aug 2018 23:56:09 +0000 (23:56 +0000)]
[MS Demangler] Fix several crashes and demangling bugs.

These bugs were found by writing a Python script which spidered
the entire Chromium build directory tree demangling every symbol
in every object file.  At the start, the tool printed:

  Processed 27443 object files.
  2926377/2936108 symbols successfully demangled (99.6686%)
  9731 symbols could not be demangled (0.3314%)
  14589 files crashed while demangling (53.1611%)

After this patch, it prints:

  Processed 27443 object files.
  41295518/41295617 symbols successfully demangled (99.9998%)
  99 symbols could not be demangled (0.0002%)
  0 files crashed while demangling (0.0000%)

The issues fixed in this patch are:

  * Ignore empty parameter packs.  Previously we would encounter
    a mangling for an empty parameter pack and add a null node
    to the AST.  Since we don't print these anyway, we now just
    don't add anything to the AST and ignore it entirely.  This
    fixes some of the crashes.

  * Account for "incorrect" string literal demanglings.  Apparently
    an older version of clang would not truncate mangled string
    literals to 32 bytes of encoded character data.  The demangling
    code however would allocate a 32 byte buffer thinking that it
    would not encounter more than this, and overrun the buffer.
    We now demangle up to 128 bytes of data, since the buggy
    clang would encode up to 32 *characters* of data.

  * Extended support for demangling init-fini stubs.  If you had
    something like
      struct Foo {
        static vector<string> S;
      };
    this would generate a dynamic atexit initializer *for the
    variable*.  We didn't handle this, but now we print something
    nice.  This is actually an improvement over undname, which will
    fail to demangle this at all.

  * Fixed one case of static this adjustment.  We weren't handling
    several thunk codes so we didn't recognize the mangling.  These
    are now handled.

  * Fixed a back-referencing problem.  Member pointer templates
    should have their components considered for back-referencing

The remaining 99 symbols which can't be demangled are all symbols
which are compiler-generated and undname can't demangle either.

llvm-svn: 341000

5 years ago[NFC] Make getPreferredAlignment honor section markings.
Eli Friedman [Wed, 29 Aug 2018 23:46:26 +0000 (23:46 +0000)]
[NFC] Make getPreferredAlignment honor section markings.

This should more accurately reflect what the AsmPrinter will actually
do.

This is NFC, as far as I can tell; all the places that might be affected
already have an extra check to avoid using the result of
getPreferredAlignment in this situation.

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

llvm-svn: 340999

5 years agoELF: Don't examine values of linker script symbols during ICF.
Peter Collingbourne [Wed, 29 Aug 2018 23:43:38 +0000 (23:43 +0000)]
ELF: Don't examine values of linker script symbols during ICF.

These symbols are declared early with the same value, so they otherwise
appear identical to ICF.

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

llvm-svn: 340998

5 years ago[SimplifyCFG] Common debug handling [NFC]
Philip Reames [Wed, 29 Aug 2018 23:22:07 +0000 (23:22 +0000)]
[SimplifyCFG] Common debug handling [NFC]

llvm-svn: 340997

5 years ago[llvm-strip] Fix -p|--preserve-dates to not truncate output when used in-place.
Jordan Rupprecht [Wed, 29 Aug 2018 23:21:56 +0000 (23:21 +0000)]
[llvm-strip] Fix -p|--preserve-dates to not truncate output when used in-place.

The restoreDateOnFile() method used to preserve dates uses sys::fs::openFileForWrite(). That method defaults to opening files with CD_CreateAlways, which truncates the output file if it exists. Use CD_OpenExisting instead to open it and *not* truncate it, which also has the side benefit of erroring if the file does not exist (it should always exist, because we just wrote it out).

Also, fix the test case to make sure the output is a valid output file, and not empty. The extra test assertions are enough to catch this regression.

llvm-svn: 340996

5 years ago[MemorySSA] Silence warning.
Alina Sbirlea [Wed, 29 Aug 2018 23:20:29 +0000 (23:20 +0000)]
[MemorySSA] Silence warning.

llvm-svn: 340995

5 years agoRefactor BreakpointResolver::SetSCMatchesByLine() to make it easier to
Adrian Prantl [Wed, 29 Aug 2018 23:16:42 +0000 (23:16 +0000)]
Refactor BreakpointResolver::SetSCMatchesByLine() to make it easier to
read/understand/maintain.

As a side-effect, this should also improve the performance by avoiding
costly vector element removals and switching from a std::map to a
SmallDenseSet.

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

llvm-svn: 340994

5 years agoReverse subregister saved loops in register usage info collector; NFC
Matthias Braun [Wed, 29 Aug 2018 23:12:42 +0000 (23:12 +0000)]
Reverse subregister saved loops in register usage info collector; NFC

On AMDGPU we have 70 register classes, so iterating over all 70
each time and exiting is costly on the CPU, this flips the loop
around so that it loops over the 70 register classes first,
and exits without doing the inner loop if needed.

On my test just starting radv this takes
RegUsageInfoCollector::runOnMachineFunction
from 6.0% of total time to 2.7% of total time,
and reduces the startup from 2.24s to 2.19s

Patch by David Airlie!

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

llvm-svn: 340993

5 years agoLast week, someone noted that a couple of the time_point member functions were not...
Marshall Clow [Wed, 29 Aug 2018 23:02:15 +0000 (23:02 +0000)]
Last week, someone noted that a couple of the time_point member functions were not constexpr. I looked, and they were right. They were made constexpr in p0505, so I looked at all the other bits in that paper to make sure that I didn't miss anything else. There were a couple methods in the synopsis that should have been marked constexpr, but the code was correct.

llvm-svn: 340992

5 years agoRevert r340947 "[InstCombine] Expand the simplification of pow() into exp2()"
Reid Kleckner [Wed, 29 Aug 2018 22:58:33 +0000 (22:58 +0000)]
Revert r340947 "[InstCombine] Expand the simplification of pow() into exp2()"

It broke the clang-cl self-host.

llvm-svn: 340991

5 years ago[analyzer] Document that pointer arithmetic is not represented by SymExprs.
Artem Dergachev [Wed, 29 Aug 2018 22:57:52 +0000 (22:57 +0000)]
[analyzer] Document that pointer arithmetic is not represented by SymExprs.

Add assertions to verify that.

llvm-svn: 340990

5 years ago[hwasan] remove even more stale code
Kostya Serebryany [Wed, 29 Aug 2018 22:54:52 +0000 (22:54 +0000)]
[hwasan] remove even more stale code

llvm-svn: 340989

5 years agoDon't cancel the current IOHandler when we push a handler for an utility function...
Raphael Isemann [Wed, 29 Aug 2018 22:50:54 +0000 (22:50 +0000)]
Don't cancel the current IOHandler when we push a handler for an utility function run.

Summary:
D48465 is currently blocked by the fact that tab-completing the first expression is deadlocking LLDB.

The reason for this deadlock is that when we push the ProcessIO handler for reading the Objective-C runtime
information from the executable (which is triggered when we parse the an expression for the first time),
the IOHandler can't be pushed as the Editline::Cancel method is deadlocking.

The deadlock in Editline is coming from the m_output_mutex, which is locked before we go into tab completion.
Even without this lock, calling Cancel on Editline will mean that Editline cleans up behind itself and deletes the
current user-input, which is screws up the console when we are tab-completing at the same time.

I think for now the most reasonable way of fixing this is to just not call Cancel on the current IOHandler when we push
the IOHandler for running an internal utility function.

As we can't really write unit tests for IOHandler itself (due to the hard dependency on an initialized Debugger including
all its global state) and Editline completion is currently also not really testable in an automatic fashion, the test for this has
to be that the expression command completion in D48465 doesn't fail when requesting completion the first time.

A more precise test plan for this is:

1. Apply D48465.
2. Start lldb and break in some function.
3. Type `expr foo` and press tab to request completion.
4. Without this patch, we deadlock and LLDB stops responding.

I'll provide an actual unit test for this once I got around and made the IOHandler code testable,
but for now unblocking D48465 is more critical.

Thanks to Jim for helping me debugging this.

Reviewers: jingham

Reviewed By: jingham

Subscribers: emaste, clayborg, abidh, lldb-commits

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

llvm-svn: 340988

5 years ago[AttrDocs]: document gnu_inline function attribute
Nick Desaulniers [Wed, 29 Aug 2018 22:50:47 +0000 (22:50 +0000)]
[AttrDocs]: document gnu_inline function attribute

Summary: This wasn't documented https://clang.llvm.org/docs/AttributeReference.html, and briefly mentioned https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: efriedma, cfe-commits, srhines

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

llvm-svn: 340987

5 years ago[analyzer] Improve tracing for uninitialized struct fields
George Karpenkov [Wed, 29 Aug 2018 22:48:50 +0000 (22:48 +0000)]
[analyzer] Improve tracing for uninitialized struct fields

rdar://13729267

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

llvm-svn: 340986

5 years ago[hwasan] remove more stale code
Kostya Serebryany [Wed, 29 Aug 2018 22:47:53 +0000 (22:47 +0000)]
[hwasan] remove more stale code

llvm-svn: 340985

5 years ago[analyzer] Support modeling no-op BaseToDerived casts in ExprEngine.
Artem Dergachev [Wed, 29 Aug 2018 22:43:31 +0000 (22:43 +0000)]
[analyzer] Support modeling no-op BaseToDerived casts in ExprEngine.

Introduce a new MemRegion sub-class, CXXDerivedObjectRegion, which is
the opposite of CXXBaseObjectRegion, to represent such casts. Such region is
a bit weird because it is by design bigger than its super-region.
But it's not harmful when it is put on top of a SymbolicRegion
that has unknown extent anyway.

Offset computation for CXXDerivedObjectRegion and proper modeling of casts
still remains to be implemented.

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

llvm-svn: 340984

5 years ago[hwasan] get rid of some macros, remove the fixed shadow mapping
Kostya Serebryany [Wed, 29 Aug 2018 22:42:16 +0000 (22:42 +0000)]
[hwasan] get rid of some macros, remove the fixed shadow mapping

llvm-svn: 340983

5 years ago[analyzer] CFRetainReleaseChecker: Don't check C++ methods with the same name.
Artem Dergachev [Wed, 29 Aug 2018 22:39:20 +0000 (22:39 +0000)]
[analyzer] CFRetainReleaseChecker: Don't check C++ methods with the same name.

Don't try to understand what's going on when there's a C++ method called eg.
CFRetain().

Refactor the checker a bit, to use more modern APIs.

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

llvm-svn: 340982

5 years ago[MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.
Alina Sbirlea [Wed, 29 Aug 2018 22:38:51 +0000 (22:38 +0000)]
[MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.

llvm-svn: 340981

5 years ago[hwasan] formatting change, NFC
Kostya Serebryany [Wed, 29 Aug 2018 22:23:34 +0000 (22:23 +0000)]
[hwasan] formatting change, NFC

llvm-svn: 340980

5 years ago[hwasan] rename some variables and functions for better readability, NFC
Kostya Serebryany [Wed, 29 Aug 2018 22:21:22 +0000 (22:21 +0000)]
[hwasan] rename some variables and functions for better readability, NFC

llvm-svn: 340979

5 years agoAdd a todo and tests to Address a review commnt from D50925 [NFC]
Philip Reames [Wed, 29 Aug 2018 22:09:21 +0000 (22:09 +0000)]
Add a todo and tests to Address a review commnt from D50925 [NFC]

llvm-svn: 340978

5 years ago[CFG] [analyzer] Disable argument construction contexts for variadic functions.
Artem Dergachev [Wed, 29 Aug 2018 22:05:35 +0000 (22:05 +0000)]
[CFG] [analyzer] Disable argument construction contexts for variadic functions.

The analyzer doesn't make use of them anyway and they seem to have
pretty weird AST from time to time, so let's just skip them for now.

Fixes a crash reported as pr37769.

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

llvm-svn: 340977

5 years ago[libFuzzer] Remove mutation stats and weighted mutation selection.
Max Moroz [Wed, 29 Aug 2018 21:53:15 +0000 (21:53 +0000)]
[libFuzzer] Remove mutation stats and weighted mutation selection.

Summary:
This was an experimental feature. After evaluating it with:

1) https://github.com/google/fuzzer-test-suite/tree/master/engine-comparison

2) enabling on real world fuzz targets running at ClusterFuzz and OSS-Fuzz

The following conclusions were made:

1) With fuzz targets that have reached a code coverage plateau, the feature does
   not improve libFuzzer's ability to discover new coverage and may actually
   negatively impact it.

2) With fuzz targets that have not yet reached a code coverage plateau, the
   feature might speed up new units discovery in some cases, but it is quite
   rare and hard to confirm with a high level on confidence.

Revert of https://reviews.llvm.org/D48054 and https://reviews.llvm.org/D49621.

Reviewers: metzman, morehouse

Reviewed By: metzman, morehouse

Subscribers: delcypher, #sanitizers, llvm-commits, kcc

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

llvm-svn: 340976

5 years ago[CFG] [analyzer] Disable argument construction contexts for variadic functions.
Artem Dergachev [Wed, 29 Aug 2018 21:50:52 +0000 (21:50 +0000)]
[CFG] [analyzer] Disable argument construction contexts for variadic functions.

The analyzer doesn't make use of them anyway and they seem to have
pretty weird AST from time to time, so let's just skip them for now.

Fixes pr37769.

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

llvm-svn: 340975

5 years ago[LICM] Hoist stores of invariant values to invariant addresses out of loops
Philip Reames [Wed, 29 Aug 2018 21:49:30 +0000 (21:49 +0000)]
[LICM] Hoist stores of invariant values to invariant addresses out of loops

Teach LICM to hoist stores out of loops when the store writes to a location otherwise unused in the loop, writes a value which is invariant, and is guaranteed to execute if the loop is entered.

Worth noting is that this transformation is partially overlapping with the existing promotion transformation. Reasons this is worthwhile anyway include:
 * For multi-exit loops, this doesn't require duplication of the store.
 * It kicks in for case where we can't prove we exit through a normal exit (i.e. we may throw), but can prove the store executes before that possible side exit.

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

llvm-svn: 340974

5 years ago[hwasan] simplify the realloc implementation: always allocate/deallocate on realloc...
Kostya Serebryany [Wed, 29 Aug 2018 21:28:14 +0000 (21:28 +0000)]
[hwasan] simplify the realloc implementation: always allocate/deallocate on realloc. This may slowdown some realloc-heavy code, but at least at this point a want simpler code. Also added a test

llvm-svn: 340973

5 years ago[analyzer] Fix tests on 32-bit platforms by specifying the tuple explicitly
George Karpenkov [Wed, 29 Aug 2018 21:18:47 +0000 (21:18 +0000)]
[analyzer] Fix tests on 32-bit platforms by specifying the tuple explicitly

llvm-svn: 340972

5 years agoAdd a thread-local ring buffer of heap allocations
Kostya Serebryany [Wed, 29 Aug 2018 21:07:07 +0000 (21:07 +0000)]
Add a thread-local ring buffer of heap allocations

Summary:
We need this in order to properly report heap-use-after-free,
since we don't have a quarantine.

This is a first part of the code, more like a proof of concept.
But I'd like to commit at as is and proceed with refactoring,
adding a ThreadRegistry, and extending the functionality.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 340971

5 years ago[WebAssembly] clang-format (NFC)
Heejin Ahn [Wed, 29 Aug 2018 21:03:16 +0000 (21:03 +0000)]
[WebAssembly] clang-format (NFC)

Summary: This patch runs clang-format on all wasm-only files.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 340970

5 years ago[sanitizer] reapply r340884 'Add a RingBuffer class to sanitizer_common', with fixes...
Kostya Serebryany [Wed, 29 Aug 2018 21:00:01 +0000 (21:00 +0000)]
[sanitizer] reapply r340884 'Add a RingBuffer class to sanitizer_common', with fixes for Windows

llvm-svn: 340969

5 years ago[OPENMP] Do not create offloading entry for declare target variables
Alexey Bataev [Wed, 29 Aug 2018 20:41:37 +0000 (20:41 +0000)]
[OPENMP] Do not create offloading entry for declare target variables
declarations.

We should not create offloading entries for declare target var
declarations as it causes compiler crash.

llvm-svn: 340968

5 years agoAdd predefined macro __gnu_linux__ for proper aux-triple
Yaxun Liu [Wed, 29 Aug 2018 20:39:22 +0000 (20:39 +0000)]
Add predefined macro __gnu_linux__ for proper aux-triple

Clang predefine macro __linx__ for aux-triple with Linux OS
but does not predefine macro __gnu_linux__. This causes
some compilation error for certain applications, e.g. Eigen.

This patch fixes that.

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

llvm-svn: 340967

5 years agoDon't include the Age in the UUID for CvRecordPdb70 UUID records in minidump files...
Greg Clayton [Wed, 29 Aug 2018 20:34:08 +0000 (20:34 +0000)]
Don't include the Age in the UUID for CvRecordPdb70 UUID records in minidump files for Apple vendors.

The CvRecordPdb70 structure looks like:

struct CvRecordPdb70 {
  uint8_t Uuid[16];
  llvm::support::ulittle32_t Age;
  // char PDBFileName[];
};
We were including the "Age" in the UUID for Apple vedors which caused us to not be able to match the UUID to built binaries. The "Age" field is set to zero in breakpad minidump files for Apple targets.

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

llvm-svn: 340966

5 years ago[analyzer] Resolve the crash in ReturnUndefChecker
George Karpenkov [Wed, 29 Aug 2018 20:29:59 +0000 (20:29 +0000)]
[analyzer] Resolve the crash in ReturnUndefChecker

By making sure the returned value from getKnownSVal is consistent with
the value used inside expression engine.

PR38427

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

llvm-svn: 340965

5 years ago[analyzer] [NFC] Move class definition out of the function
George Karpenkov [Wed, 29 Aug 2018 20:29:39 +0000 (20:29 +0000)]
[analyzer] [NFC] Move class definition out of the function

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

llvm-svn: 340964

5 years ago[analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default
George Karpenkov [Wed, 29 Aug 2018 20:29:17 +0000 (20:29 +0000)]
[analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default

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

llvm-svn: 340963

5 years ago[analyzer] [NFC] Remove unused "state" argument from makeSymExprValNN
George Karpenkov [Wed, 29 Aug 2018 20:28:54 +0000 (20:28 +0000)]
[analyzer] [NFC] Remove unused "state" argument from makeSymExprValNN

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

llvm-svn: 340962

5 years ago[analyzer] Better retain count rules for OSObjects
George Karpenkov [Wed, 29 Aug 2018 20:28:33 +0000 (20:28 +0000)]
[analyzer] Better retain count rules for OSObjects

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

llvm-svn: 340961

5 years ago[analyzer] [NFC] Follow the convention when naming classes
George Karpenkov [Wed, 29 Aug 2018 20:28:13 +0000 (20:28 +0000)]
[analyzer] [NFC] Follow the convention when naming classes

Renames InvalidateRegionsWorker and RemoveDeadBindingsWorker

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

llvm-svn: 340960

5 years agoAMDGPU: Handle 32-bit address wraparounds for SMRD opcodes
Marek Olsak [Wed, 29 Aug 2018 20:03:00 +0000 (20:03 +0000)]
AMDGPU: Handle 32-bit address wraparounds for SMRD opcodes

Summary: This fixes GPU hangs with OpenGL bindless handle arithmetic.

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 340959

5 years agoRemoved commented out includes [NFC]
Raphael Isemann [Wed, 29 Aug 2018 19:55:33 +0000 (19:55 +0000)]
Removed commented out includes [NFC]

llvm-svn: 340958

5 years ago[sanitizer] Revert D50940
Kostya Kortchinsky [Wed, 29 Aug 2018 19:41:28 +0000 (19:41 +0000)]
[sanitizer] Revert D50940

Summary:
The previous version of the patch makes some code unable to distinguish
failure to map address 0 and error.
Revert to turn the bots back to green while figuring out a new approach.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 340957

5 years ago[OPENMP][NVPTX] Replace assert() by ASSERT0() macro, NFC.
Alexey Bataev [Wed, 29 Aug 2018 19:22:06 +0000 (19:22 +0000)]
[OPENMP][NVPTX] Replace assert() by ASSERT0() macro, NFC.

Required to fix the buildbots.

llvm-svn: 340956

5 years ago[SimpleLoopUnswitch] After unswitch delete dead blocks in parent loops
Fedor Sergeev [Wed, 29 Aug 2018 19:10:44 +0000 (19:10 +0000)]
[SimpleLoopUnswitch] After unswitch delete dead blocks in parent loops

Summary:
Assert from PR38737 happens on the dead block inside the parent loop
after unswitching nontrivial switch in the inner loop.

deleteDeadBlocksFromLoop now takes extra care to detect/remove dead
blocks in all the parent loops in addition to the blocks from original
loop being unswitched.

Reviewers: asbirlea, chandlerc

Reviewed By: asbirlea

Subscribers: llvm-commits

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

llvm-svn: 340955

5 years agoRevert "[libFuzzer] Port to Windows"
Matt Morehouse [Wed, 29 Aug 2018 18:40:41 +0000 (18:40 +0000)]
Revert "[libFuzzer] Port to Windows"

This reverts r340949 due to bot breakage again.

llvm-svn: 340954

5 years ago[OPENMP][NVPTX] Add support for lightweight runtime.
Alexey Bataev [Wed, 29 Aug 2018 18:32:21 +0000 (18:32 +0000)]
[OPENMP][NVPTX] Add support for lightweight runtime.

If the target construct can be executed in SPMD mode + it is a loop
based directive with static scheduling, we can use lightweight runtime
support.

llvm-svn: 340953

5 years ago[InstCombine] canonicalize fneg with llvm.sin
Sanjay Patel [Wed, 29 Aug 2018 18:27:49 +0000 (18:27 +0000)]
[InstCombine] canonicalize fneg with llvm.sin

This is a follow-up to rL339604 which did the same transform
for a sin libcall. The handling of intrinsics vs. libcalls
is unfortunately scattered, so I'm just adding this next to
the existing transform for llvm.cos for now.

This should resolve PR38458:
https://bugs.llvm.org/show_bug.cgi?id=38458
If the call was already negated, the negates will cancel
each other out.

llvm-svn: 340952

5 years ago[MemorySSA] Add expesive check for validating clobber accesses.
Alina Sbirlea [Wed, 29 Aug 2018 18:26:04 +0000 (18:26 +0000)]
[MemorySSA] Add expesive check for validating clobber accesses.

Summary: Add validation of clobber accesses as expensive check.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 340951

5 years ago[InstCombine] add tests for llvm.sin(-x); NFC
Sanjay Patel [Wed, 29 Aug 2018 18:11:42 +0000 (18:11 +0000)]
[InstCombine] add tests for llvm.sin(-x); NFC

Also add a corresponding test for llvm.cos with FMF to
make sure that was handled correctly.

llvm-svn: 340950

5 years ago[libFuzzer] Port to Windows
Matt Morehouse [Wed, 29 Aug 2018 18:08:34 +0000 (18:08 +0000)]
[libFuzzer] Port to Windows

Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

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

llvm-svn: 340949

5 years ago[InstCombine] Expand the simplification of pow() with nested exp{,2}()
Evandro Menezes [Wed, 29 Aug 2018 17:59:48 +0000 (17:59 +0000)]
[InstCombine] Expand the simplification of pow() with nested exp{,2}()

Expand the simplification of `pow(exp{,2}(x), y)` to all FP types.

This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray.  Otherwise, no significant regressions on
x86-64 or A64.

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

llvm-svn: 340948

5 years ago[InstCombine] Expand the simplification of pow() into exp2()
Evandro Menezes [Wed, 29 Aug 2018 17:59:34 +0000 (17:59 +0000)]
[InstCombine] Expand the simplification of pow() into exp2()

Generalize the simplification of `pow(2.0, y)` to `pow(2.0 ** n, y)` for all
scalar and vector types.

This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray.  Otherwise, no significant regressions on
x86-64 or A64.

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

llvm-svn: 340947

5 years ago[llvm-mca] Add fields "Total uOps" and "uOps Per Cycle" to the report generated by...
Andrea Di Biagio [Wed, 29 Aug 2018 17:56:39 +0000 (17:56 +0000)]
[llvm-mca] Add fields "Total uOps" and "uOps Per Cycle" to the report generated by the SummaryView.

This patch adds two new fields to the perf report generated by the SummaryView.
Fields are now logically organized into two small groups; only the second group
contains throughput indicators.

Example:
```
Iterations:        100
Instructions:      300
Total Cycles:      414
Total uOps:        700

Dispatch Width:    4
uOps Per Cycle:    1.69
IPC:               0.72
Block RThroughput: 4.0
```

This patch also updates the docs for llvm-mca.
Due to the nature of this change, several tests in the tools/llvm-mca directory
were affected, and had to be updated using script `update_mca_test_checks.py`.

llvm-svn: 340946

5 years ago[llvm-mca] Don't disable the SummaryView if flag `-all-stats` is false.
Andrea Di Biagio [Wed, 29 Aug 2018 17:40:04 +0000 (17:40 +0000)]
[llvm-mca] Don't disable the SummaryView if flag `-all-stats` is false.

llvm-svn: 340945

5 years ago[OPENMP][NVPTX] Lightweight runtime support for SPMD mode.
Alexey Bataev [Wed, 29 Aug 2018 17:35:09 +0000 (17:35 +0000)]
[OPENMP][NVPTX] Lightweight runtime support for SPMD mode.

Summary:
Implemented simple and lightweight runtime support for SPMD mode-based
constructs. It adds support for L2 sequential parallelism wihtout full
runtime support. Also, patch fixes some use cases for
uninitialized|lightweight runtime.

Reviewers: grokos, kkwli0, Hahnfeld, gtbercea

Subscribers: guansong, openmp-commits

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

llvm-svn: 340944

5 years ago[CMake] Add an lld-test-depends target
Martin Storsjo [Wed, 29 Aug 2018 17:30:45 +0000 (17:30 +0000)]
[CMake] Add an lld-test-depends target

This builds all dependencies of lld-test/check-lld, without running
the tests. This matches llvm-test-depends and clang-test-depends.

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

llvm-svn: 340943

5 years ago[MinGW] [X86] Add stubs for references to data variables that might end up imported...
Martin Storsjo [Wed, 29 Aug 2018 17:28:34 +0000 (17:28 +0000)]
[MinGW] [X86] Add stubs for references to data variables that might end up imported from a dll

Variables declared with the dllimport attribute are accessed via a
stub variable named __imp_<var>. In MinGW configurations, variables that
aren't declared with a dllimport attribute might still end up imported
from another DLL with runtime pseudo relocs.

For x86_64, this avoids the risk that the target is out of range
for a 32 bit PC relative reference, in case the target DLL is loaded
further than 4 GB from the reference. It also avoids having to make the
text section writable at runtime when doing the runtime fixups, which
makes it worthwhile to do for i386 as well.

Add stub variables for all dso local data references where a definition
of the variable isn't visible within the module, since the DLL data
autoimporting might make them imported even though they are marked as
dso local within LLVM.

Don't do this for variables that actually are defined within the same
module, since we then know for sure that it actually is dso local.

Don't do this for references to functions, since there's no need for
runtime pseudo relocations for autoimporting them; if a function from
a different DLL is called without the appropriate dllimport attribute,
the call just gets routed via a thunk instead.

GCC does something similar since 4.9 (when compiling with -mcmodel=medium
or large; from that version, medium is the default code model for x86_64
mingw), but only for x86_64.

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

llvm-svn: 340942

5 years ago[MinGW] Don't mark external variables as DSO local
Martin Storsjo [Wed, 29 Aug 2018 17:26:58 +0000 (17:26 +0000)]
[MinGW] Don't mark external variables as DSO local

Since MinGW supports automatically importing external variables from
DLLs even without the DLLImport attribute, we shouldn't mark them
as DSO local unless we actually know them to be local for sure.

Keep marking thread local variables as DSO local.

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

llvm-svn: 340941

5 years ago[COFF] Merge the .ctors, .dtors and .CRT sections into .rdata for MinGW
Martin Storsjo [Wed, 29 Aug 2018 17:24:10 +0000 (17:24 +0000)]
[COFF] Merge the .ctors, .dtors and .CRT sections into .rdata for MinGW

There's no point in keeping them as separate sections.

This differs from GNU ld, which places .ctors and .dtors content in
.text (implemented by a built-in linker script). But since the content
only is pointers, there's no need to have it executable.

GNU ld also leaves .CRT separate as its own standalone section.

MSVC merges .CRT into .rdata similarly, with a directive embedded in
an object file in msvcrt.lib or libcmt.lib.

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

llvm-svn: 340940

5 years ago[InstCombine] Replace two calls to getNumUses() with !hasNUsesOrMore
Craig Topper [Wed, 29 Aug 2018 17:09:21 +0000 (17:09 +0000)]
[InstCombine] Replace two calls to getNumUses() with !hasNUsesOrMore

We were calling getNumUses to check for 1 or 2 uses. But getNumUses is linear in the number of uses. We can instead use !hasNUsesOrMore(3) which will stop the linear scan as soon as it determines there are at least 3 uses even if there are more.

llvm-svn: 340939

5 years agoUpdate Visual Studio Integration version number.
Zachary Turner [Wed, 29 Aug 2018 16:57:37 +0000 (16:57 +0000)]
Update Visual Studio Integration version number.

This updates the version number in the manifest file to match
the SVN revision at which it was committed.

llvm-svn: 340938

5 years ago[Tooling] Do not restore working dir in ClangTool
Ilya Biryukov [Wed, 29 Aug 2018 16:35:31 +0000 (16:35 +0000)]
[Tooling] Do not restore working dir in ClangTool

Summary:
Resolve all relative paths before running the tool instead.

This fixes the usage of ClangTool in AllTUsExecutor. The executor will
try running multiple ClangTool instances in parallel with compile
commands that usually have the same working directory.

Changing working directory is a global operation, so we end up
changing working directory in the middle of running other actions,
which leads to spurious compile errors.

Reviewers: ioeric, sammccall

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 340937

5 years ago[AMDGPU] Match udot4 pattern.
Farhana Aleen [Wed, 29 Aug 2018 16:31:18 +0000 (16:31 +0000)]
[AMDGPU] Match udot4 pattern.

Summary: D.u32 = S0.u8[0] * S1.u8[0] +
                 S0.u8[1] * S1.u8[1] +
                 S0.u8[2] * S1.u8[2] +
                 S0.u8[3] * S1.u8[3] + S2.u32

Author: FarhanaAleen

Reviewed By: arsenm

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 340936