platform/upstream/llvm.git
5 years agoClangTidy: Avoid mixing stdout with stderror when dealing with a large number of...
Andi-Bogdan Postelnicu [Tue, 9 Apr 2019 11:17:02 +0000 (11:17 +0000)]
ClangTidy: Avoid mixing stdout with stderror when dealing with a large number of files.

Summary:
At Mozilla we are using this tool in order to perform review-time static-analysis, since some patches contain a large number of files we've discovered this issue, where `stderr` gets mixed with `stdout` thus obfuscating our possibility to parse the output.
The patch that we are currently use can be found [here](https://searchfox.org/mozilla-central/source/build/build-clang/clang-tidy-8.patch).

This is just an upstream of the original patch.

Reviewers: JonasToth

Reviewed By: JonasToth

Subscribers: cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 357994

5 years ago[RISCV] Unbreak test from r357989
Alex Bradbury [Tue, 9 Apr 2019 10:44:47 +0000 (10:44 +0000)]
[RISCV] Unbreak test from r357989

There were some errors in the committed test checks, left in due to a git
stash apply mishap.

llvm-svn: 357993

5 years ago[TargetLowering] SimplifyDemandedBits - call SimplifyDemandedBits in bitcast handling
Simon Pilgrim [Tue, 9 Apr 2019 10:27:59 +0000 (10:27 +0000)]
[TargetLowering] SimplifyDemandedBits - call SimplifyDemandedBits in bitcast handling

When bitcasting from a source op to a larger bitwidth op, split the demanded bits and OR them on top of one another and demand those merged bits in the SimplifyDemandedBits call on the source op.

llvm-svn: 357992

5 years ago[RISCV][NFC] Minor fixup for r357989
Alex Bradbury [Tue, 9 Apr 2019 10:25:05 +0000 (10:25 +0000)]
[RISCV][NFC] Minor fixup for r357989

One of the tests in riscv64-lp64-lp64f-lp64d would have had a different
lowering for lp64f/lp64d as a float argument was missed.

llvm-svn: 357991

5 years ago[llvm-rtdyld] Fix missing include on MSVC builds.
Simon Pilgrim [Tue, 9 Apr 2019 10:15:10 +0000 (10:15 +0000)]
[llvm-rtdyld] Fix missing include on MSVC builds.

llvm-svn: 357990

5 years ago[RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches
Alex Bradbury [Tue, 9 Apr 2019 10:12:49 +0000 (10:12 +0000)]
[RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches

Split tests in to files representing the subset of RISC-V ABIs they should
have identical output for.

llvm-svn: 357989

5 years ago[DebugInfo] Pass all values in DebugLocEntry's constructor, NFC
David Stenberg [Tue, 9 Apr 2019 10:08:26 +0000 (10:08 +0000)]
[DebugInfo] Pass all values in DebugLocEntry's constructor, NFC

Summary:
With MergeValues() removed, amend DebugLocEntry's constructor so that it
takes multiple values rather than a single, and keep non-fragment values
in OpenRanges, as this allows some cleanup of the code in
buildLocationList().

Reviewers: aprantl, dblaikie, loladiro

Reviewed By: aprantl

Subscribers: hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

llvm-svn: 357988

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Tue, 9 Apr 2019 09:38:25 +0000 (09:38 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 357987

5 years ago[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)
Bjorn Pettersson [Tue, 9 Apr 2019 09:12:32 +0000 (09:12 +0000)]
[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)

Make sure ASTImporter::Import_New(const Decl *) returns
a Expected<const Decl *> and not Expected<Decl *> to
make the clang/unittests/AST/ASTImporterTest.cpp compile
without the warning

 clang/unittests/AST/ASTImporterTest.cpp:117:12: error: no viable conversion from 'Expected<clang::Decl *>' to 'Expected<const clang::Decl *>'
    return Imported;

(I got the above when building with clang 3.6).

llvm-svn: 357985

5 years agoRemove unneeded #ifdef SWIGs
Pavel Labath [Tue, 9 Apr 2019 09:03:43 +0000 (09:03 +0000)]
Remove unneeded #ifdef SWIGs

Summary:
Some of these were present in files which should never be read by swig
(and we also had one in the interface file, which is only read by swig).
They are probably leftovers from the time when we were running swig over
lldb headers directly.

While writing this patch, I noticed that some of the #ifdefs were
guarding public functions that were operating on lldb_private data
types. While it wasn't strictly necessary for this patch, I made these
private, as nobody should really be accessing them. This can potentially
break existing code if it happened to use these methods, though it will
only break at build time -- if someone builds against an old header, he
should still be able to link to a new lldb library, since the functions
are still there.

We could keep these public for backward compatbility, but I would argue
that if anyone was actually using these functions for anything, his code
is already broken.

Reviewers: JDevlieghere, clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 357984

5 years agoFix doxygen warning about function argument
Jonas Devlieghere [Tue, 9 Apr 2019 09:03:30 +0000 (09:03 +0000)]
Fix doxygen warning about function argument

This fixes the following doxygen warning when building the lldb-cpp-doc
target.

This commit fixes:
  SBStructuredData.h:94 warning: Found unknown command `\dst'
  SBStructuredData.h:97 warning: Found unknown command `\dst'
  SBStructuredData.h:98 warning: Found unknown command `\dst'
  SBStructuredData.h:100 warning: Found unknown command `\dst'
  SBStructuredData.h:104 warning: Found unknown command `\dst'

Patch by: Konrad Kleine

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

llvm-svn: 357983

5 years agoDe-template SymbolTable::addShared.
Rui Ueyama [Tue, 9 Apr 2019 08:52:00 +0000 (08:52 +0000)]
De-template SymbolTable::addShared.

Because of r357925, this member function doesn't have to be a
template of ELFT.

llvm-svn: 357982

5 years ago[PowerPC] fix trivial typos in comment, NFC
Hiroshi Inoue [Tue, 9 Apr 2019 08:40:02 +0000 (08:40 +0000)]
[PowerPC] fix trivial typos in comment, NFC

llvm-svn: 357981

5 years agoAdd missing space between \btrue
Jonas Devlieghere [Tue, 9 Apr 2019 08:34:07 +0000 (08:34 +0000)]
Add missing space between \btrue

There was a space missing in some the documentation for
lldb::BreakpointsWriteToFile.

This fixes the following doxygen error when building the lldb-cpp-doc
target:

  llvm-project/lldb/include/lldb/API/SBTarget.h:775 warning: Found
  unknown command `\btrue'

Patch by: Konrad Kleine

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

llvm-svn: 357980

5 years ago[CMake] Fix accidentally swapped input/output parameters of string(REPLACE) for mingw
Martin Storsjo [Tue, 9 Apr 2019 08:31:25 +0000 (08:31 +0000)]
[CMake] Fix accidentally swapped input/output parameters of string(REPLACE) for mingw

llvm-svn: 357979

5 years ago[asan_symbolize] Move argument parser epilog text into script doc comment.
Dan Liew [Tue, 9 Apr 2019 08:30:43 +0000 (08:30 +0000)]
[asan_symbolize] Move argument parser epilog text into script doc comment.

Summary:
This will make it easier to expand on the documentation in the future
that avoids cluttering the code.

rdar://problem/49476995

Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357978

5 years agoMinidump: use string parsing functionality from llvm
Pavel Labath [Tue, 9 Apr 2019 08:28:27 +0000 (08:28 +0000)]
Minidump: use string parsing functionality from llvm

llvm-svn: 357977

5 years ago[CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake
Justin Bogner [Tue, 9 Apr 2019 08:14:32 +0000 (08:14 +0000)]
[CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake

Standalone builds of projects other than llvm itself (lldb, libcxx,
etc) include HandleLLVMOptions but not the top level llvm CMakeLists,
so we need to set this variable here to ensure that it always has a
value.

This should fix the build issues some folks have been seeing.

llvm-svn: 357976

5 years agoBreakpad: Parse Stack CFI records
Pavel Labath [Tue, 9 Apr 2019 08:05:11 +0000 (08:05 +0000)]
Breakpad: Parse Stack CFI records

Summary:
This patch adds support for parsing STACK CFI records from breakpad
files. The expressions specifying the values of registers are not
parsed.The idea is that these will be handed off to the postfix
expression -> dwarf compiler, once it is extracted from the internals of
the NativePDB plugin.

Reviewers: clayborg, amccarth, markmentovai

Subscribers: aprantl, lldb-commits

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

llvm-svn: 357975

5 years ago[DebugInfo] Remove redundant DebugLocEntry::MergeValues() function, NFC
David Stenberg [Tue, 9 Apr 2019 07:46:09 +0000 (07:46 +0000)]
[DebugInfo] Remove redundant DebugLocEntry::MergeValues() function, NFC

Summary:
The MergeValues() function would try to merge two entries if they shared
the same beginning label. Having the same beginning label means that the
former entry's range would be empty; however, after D55919 we no longer
create entries for empty ranges, so we can no longer land in a situation
where that check in MergeValues would succeed. Instead, the "merging" is
done by keeping the live values from the preceding empty ranges in
OpenRanges, and adding them to the first non-empty range.

Reviewers: aprantl, dblaikie, loladiro

Reviewed By: aprantl

Subscribers: llvm-commits

Tags: #debug-info, #llvm

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

llvm-svn: 357974

5 years ago[X86] Remove check on isAsmParserOnly from EVEX2VEX tablegenerator. NFCI
Craig Topper [Tue, 9 Apr 2019 07:40:19 +0000 (07:40 +0000)]
[X86] Remove check on isAsmParserOnly from EVEX2VEX tablegenerator. NFCI

There are no instructions VEX or EVEX instructions that set this field.

llvm-svn: 357973

5 years ago[X86] Have EVEX2VEX tablegenerator use HasVEX_L and HasEVEX_L2 fields instead of...
Craig Topper [Tue, 9 Apr 2019 07:40:14 +0000 (07:40 +0000)]
[X86] Have EVEX2VEX tablegenerator use HasVEX_L and HasEVEX_L2 fields instead of the composite EVEX_LL field. Remove the EVEX_LL field. NFCI

The composite existed to simplify some other tablegen code and not really in an
important way. Remove the combined field and just calculate the vector size
using two ifs.

llvm-svn: 357972

5 years ago[X86] Use VEX_WIG for VPINSRB/W and VPEXTRB/W to match what is done for EVEX.
Craig Topper [Tue, 9 Apr 2019 07:40:10 +0000 (07:40 +0000)]
[X86] Use VEX_WIG for VPINSRB/W and VPEXTRB/W to match what is done for EVEX.

The instruction's document this as W0 for the VEX encoding. But there's a
footnote mentioning that VEX.W is ignored in 64-bit mode. And the main VEX
encoding description says the VEX.W bit is ignored for instructions that are
equivalent to a legacy SSE instruction that uses REX.W to select a GPR which
would apply here.

By making this match EVEX we can remove a special case of allowing EVEX2VEX to
turn an EVEX.WIG instruction into VEX.W0.

llvm-svn: 357971

5 years ago[X86] Split the VEX_WPrefix in X86Inst tablegen class into 3 separate fields with...
Craig Topper [Tue, 9 Apr 2019 07:40:06 +0000 (07:40 +0000)]
[X86] Split the VEX_WPrefix in X86Inst tablegen class into 3 separate fields with clear meanings.

llvm-svn: 357970

5 years ago[ValueTracking] Use ConstantRange methods; NFC
Nikita Popov [Tue, 9 Apr 2019 07:13:09 +0000 (07:13 +0000)]
[ValueTracking] Use ConstantRange methods; NFC

Switch part of the computeOverflowForSignedAdd() implementation to
use Range.isAllNegative() rather than KnownBits.isNegative() and
similar. They do the same thing, but using the ConstantRange methods
allows dropping the KnownBits variables more easily in D60420.

llvm-svn: 357969

5 years ago[ValueTracking] Explicitly specify intersection type; NFC
Nikita Popov [Tue, 9 Apr 2019 07:13:03 +0000 (07:13 +0000)]
[ValueTracking] Explicitly specify intersection type; NFC

Preparation for D60420.

llvm-svn: 357968

5 years agoInclude omitted word in comment.
Eric Christopher [Tue, 9 Apr 2019 06:35:47 +0000 (06:35 +0000)]
Include omitted word in comment.

llvm-svn: 357967

5 years ago[WebAssembly] Ensure ArchiveName is set even in the presence of --whole-archive.
Sam Clegg [Tue, 9 Apr 2019 05:41:52 +0000 (05:41 +0000)]
[WebAssembly] Ensure ArchiveName is set even in the presence of --whole-archive.

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

llvm-svn: 357966

5 years ago[llvm-objdump] Migrate some functions from std::error_code to Error
Fangrui Song [Tue, 9 Apr 2019 05:41:24 +0000 (05:41 +0000)]
[llvm-objdump] Migrate some functions from std::error_code to Error

llvm-svn: 357965

5 years agoAMDGPU/GlobalISel: Implement call lowering for shaders returning values
Tom Stellard [Tue, 9 Apr 2019 02:26:03 +0000 (02:26 +0000)]
AMDGPU/GlobalISel: Implement call lowering for shaders returning values

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, volkan, llvm-commits

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

llvm-svn: 357964

5 years agoGet the run locker before you ask if your thread is valid.
Jim Ingham [Tue, 9 Apr 2019 01:33:23 +0000 (01:33 +0000)]
Get the run locker before you ask if your thread is valid.

I have occasional crashes coming from SBThread::GetExtendedBacktraceThread.  The
symptom is that we got true back from HasThreadScope - so we should have a valid
live thread, but then when we go to use the thread, it is not good anymore and we
crash.
I can't spot any obvious cause for this crash, but in looking for same I noticed
that in the current code we check that the thread is valid, THEN we take the stop
locker.  We really should do that in the other order, and ensure that the process
will stay stopped before we check our thread is still good.  That's what this patch does.

<rdar://problem/47478205>

llvm-svn: 357963

5 years ago[PowerPC] initialize SchedModel according to platform.
Chen Zheng [Tue, 9 Apr 2019 01:25:25 +0000 (01:25 +0000)]
[PowerPC] initialize SchedModel according to platform.
Differential Revision: https://reviews.llvm.org/D60177

llvm-svn: 357962

5 years agoAdd a reduced copy of the llvm .gitignore
Eric Christopher [Tue, 9 Apr 2019 00:52:49 +0000 (00:52 +0000)]
Add a reduced copy of the llvm .gitignore
as a start for the monorepo .gitignore.

llvm-svn: 357961

5 years agohwasan: Enable -hwasan-allow-ifunc by default.
Peter Collingbourne [Tue, 9 Apr 2019 00:25:59 +0000 (00:25 +0000)]
hwasan: Enable -hwasan-allow-ifunc by default.

It's been on in Android for a while without causing problems, so it's time
to make it the default and remove the flag.

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

llvm-svn: 357960

5 years ago[X86] Derive ssmem and sdmem from X86MemOperand. NFCI
Craig Topper [Tue, 9 Apr 2019 00:24:17 +0000 (00:24 +0000)]
[X86] Derive ssmem and sdmem from X86MemOperand. NFCI

This changes the operand type from v4f32/v2f64 to iPTR which seems more correct. But that doesn't seem to do anything other than change the comments in X86GenDAGISel.inc. Probably because we use a ComplexPattern to do the matching so there's no autogenerated code to change.

llvm-svn: 357959

5 years agoRevert "Make reads and writes of the guard variable atomic."
Eric Fiselier [Mon, 8 Apr 2019 23:37:48 +0000 (23:37 +0000)]
Revert "Make reads and writes of the guard variable atomic."

This reverts commit r357944 and r357949.

These changes failed to account for the fact that
the guard object is under aligned for atomic operations
on 32 bit platforms (It's aligned to 4 bytes but we require 8).

llvm-svn: 357958

5 years ago[clang-format] Add AfterCaseLabel to BraceWrapping
Owen Pan [Mon, 8 Apr 2019 23:36:25 +0000 (23:36 +0000)]
[clang-format] Add AfterCaseLabel to BraceWrapping

Fixes PR38686

> llvm-svn: 52527

llvm-svn: 357957

5 years agoFix incorrect change during refactoring.
Eric Fiselier [Mon, 8 Apr 2019 23:20:09 +0000 (23:20 +0000)]
Fix incorrect change during refactoring.

cxa_guard_abort should still broadcast on exit.

llvm-svn: 357956

5 years agoRename Target::GetSharedModule to Target::GetOrCreateModule.
Jason Molenda [Mon, 8 Apr 2019 23:03:02 +0000 (23:03 +0000)]
Rename Target::GetSharedModule to Target::GetOrCreateModule.

Add a flag to control whether the ModulesDidLoad notification is
called when a module is added.  If the notifications are disabled,
the caller must call ModulesDidLoad after adding all the new modules,
but postponing this notification until they're all batched up can
allow for better efficiency than notifying one-by-one.

Change the name of the ModuleList notifier functions that a subclass
can implement to start with 'Notify' to make it clear what they are.
Add a NotifyModulesRemoved.

Add header documentation for the changed/updated methods.

Added defaulted-value 'notify' argument to ModuleList Append,
AppendIfNeeded, and Remove because callers working with a local
ModuleList don't have an obvious idea of what notify means in this
context.  When the ModuleList is a part of the Target class, the
notify behavior matters.

DynamicLoaderDarwin has been updated so that libraries being
added/removed are correctly batched up before notifications are
sent.  Added the TestModuleLoadedNotifys.py test to run on
Darwin to test this.

<rdar://problem/48293064>

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

llvm-svn: 357955

5 years agoExperiment with a larger packet timeout.
Adrian Prantl [Mon, 8 Apr 2019 23:02:11 +0000 (23:02 +0000)]
Experiment with a larger packet timeout.

This is a follow-up to r357829 (https://reviews.llvm.org/D60340) to
see whether increasing the packet timeout for non-asan builds could
also positively affect the stability of non-asan bots.

llvm-svn: 357954

5 years ago[InstCombine] add tests for negate+sdiv; NFC
Sanjay Patel [Mon, 8 Apr 2019 22:55:10 +0000 (22:55 +0000)]
[InstCombine] add tests for negate+sdiv; NFC

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

llvm-svn: 357953

5 years agoRevert "[MS] Add metadata for __declspec(allocator)"
Amy Huang [Mon, 8 Apr 2019 22:46:41 +0000 (22:46 +0000)]
Revert "[MS] Add metadata for __declspec(allocator)"

This reverts commit e7bd735bb03a7b8141e32f7d6cb98e8914d8799e.
Reverting because of buildbot failure.

llvm-svn: 357952

5 years ago[asan_symbolize] Use proper logging infrastructure.
Dan Liew [Mon, 8 Apr 2019 22:28:27 +0000 (22:28 +0000)]
[asan_symbolize] Use proper logging infrastructure.

Summary:
The previous logging infrastructure had several problems:

* Debugging output was emitted to standard output which is also where
  the symbolized output would go. Interleaving these two separate
  bits of information makes inspecting the output difficult and could
  potentially break tests.

* Enabling debugging output requires modifying the script which is
  not very conveninent.

* When debugging it isn't immediately obvious where the output is
  coming from.

This patch uses the Python standard library logging infrastructure
which fixes all of the above problems. Logging is controlled using
two new options.

* `--log-level` - Sets the logging level, default is
`info`.
* `--log-dest` - Set the logging destination, default
is standard error.

Some simple test cases for the feature are included.

rdar://problem/49476995

Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357951

5 years ago[RuntimeDyld] Fix an ambiguous make_unique call.
Lang Hames [Mon, 8 Apr 2019 22:19:05 +0000 (22:19 +0000)]
[RuntimeDyld] Fix an ambiguous make_unique call.

llvm-svn: 357950

5 years agoRemove unneeded write in __cxa_guard_release.
Eric Fiselier [Mon, 8 Apr 2019 22:07:36 +0000 (22:07 +0000)]
Remove unneeded write in __cxa_guard_release.

The INIT_COMPLETE write now writes to the entire guard object
instead of just one byte.

llvm-svn: 357949

5 years agoFix a stack buffer overflow found by ASAN.
Adrian Prantl [Mon, 8 Apr 2019 21:58:36 +0000 (21:58 +0000)]
Fix a stack buffer overflow found by ASAN.

llvm::StringRef host_and_port is not guaranteed to be null-terminated.
Generally, it is not safe at all to convert a StringRef into a char *
by calling data() on it.

<rdar://problem/49698580>

llvm-svn: 357948

5 years ago[RuntimeDyld] Decouple RuntimeDyldChecker from RuntimeDyld.
Lang Hames [Mon, 8 Apr 2019 21:50:48 +0000 (21:50 +0000)]
[RuntimeDyld] Decouple RuntimeDyldChecker from RuntimeDyld.

This will allow RuntimeDyldChecker (and rtdyld-check tests) to test a new JIT
linker: JITLink (https://reviews.llvm.org/D58704).

llvm-svn: 357947

5 years ago[libc++] Remove install_name and compatibility_version on OS X
Louis Dionne [Mon, 8 Apr 2019 21:37:42 +0000 (21:37 +0000)]
[libc++] Remove install_name and compatibility_version on OS X

CMake already specifies those, and we never actually want those to be
used. In fact, r357811 re-ordered those flags in a way that the
explicitly-provided install_name was overriding the CMake-provided
install_name (instead of the other way around). This caused the dylib
to be considered a system dylib, and hence the explicitly provided rpath
to be ignored. This, in turn, caused some unit tests to start linking
against the system libc++.dylib instead of the freshly-built one.
Specifically, the unit tests that started linking against the system
dylib are those that didn't specify a DYLD_LIBRARY_PATH, such as
last_write_time.sh.cpp.

llvm-svn: 357946

5 years ago[BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping
Shoaib Meenai [Mon, 8 Apr 2019 21:37:08 +0000 (21:37 +0000)]
[BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping

The new value is taken from <mach/machine.h> in the MacOSX10.14 SDK from
Xcode 10.1. Update llvm-objdump and llvm-readobj accordingly.

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

llvm-svn: 357945

5 years agoMake reads and writes of the guard variable atomic.
Eric Fiselier [Mon, 8 Apr 2019 21:26:25 +0000 (21:26 +0000)]
Make reads and writes of the guard variable atomic.

The read of the guard variable by the caller is atomic,
and doesn't happen under a mutex.

Our internal reads and writes were non-atomic, because they happened
under a mutex.

The writes should always be atomic since they can be observed outside
of the lock.

Making the reads atomic is not strictly necessary under the current
global mutex approach, but will be under implementations that use a
futex (which I plan to land shortly). However, they should add little
additional cost.

llvm-svn: 357944

5 years ago[InstCombine] peek through fdiv to find a squared sqrt
Sanjay Patel [Mon, 8 Apr 2019 21:23:50 +0000 (21:23 +0000)]
[InstCombine] peek through fdiv to find a squared sqrt

A more general canonicalization between fdiv and fmul would not
handle this case because that would have to be limited by uses
to prevent 2 values from becoming 3 values:
(x/y) * (x/y) --> (x*x) / (y*y)

(But we probably should still have that limited -- but more general --
canonicalization independently of this change.)

llvm-svn: 357943

5 years ago[TargetLowering] SimplifyDemandedBits - use DemandedElts in bitcast handling
Simon Pilgrim [Mon, 8 Apr 2019 20:59:38 +0000 (20:59 +0000)]
[TargetLowering] SimplifyDemandedBits - use DemandedElts in bitcast handling

Be more selective in the SimplifyDemandedBits -> SimplifyDemandedVectorElts bitcast call based on the demanded elts.

llvm-svn: 357942

5 years agoMove the builtin headers to use the new license file header.
Chandler Carruth [Mon, 8 Apr 2019 20:51:30 +0000 (20:51 +0000)]
Move the builtin headers to use the new license file header.

Summary:
These all had somewhat custom file headers with different text from the
ones I searched for previously, and so I missed them. Thanks to Hal and
Kristina and others who prompted me to fix this, and sorry it took so
long.

Reviewers: hfinkel

Subscribers: mcrosier, javed.absar, cfe-commits

Tags: #clang

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

llvm-svn: 357941

5 years ago[ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name...
Shafik Yaghmour [Mon, 8 Apr 2019 20:50:21 +0000 (20:50 +0000)]
[ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name instead of SearchName

Summary:
https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitEnumDecl(...) for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via getTypedefNameForAnonDecl(...).

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

llvm-svn: 357940

5 years ago[InstCombine] add extra-use tests for fmul+sqrt; NFC
Sanjay Patel [Mon, 8 Apr 2019 20:37:34 +0000 (20:37 +0000)]
[InstCombine] add extra-use tests for fmul+sqrt; NFC

llvm-svn: 357939

5 years ago[InstCombine] Add more tests for signed saturing math overflow; NFC
Nikita Popov [Mon, 8 Apr 2019 20:02:47 +0000 (20:02 +0000)]
[InstCombine] Add more tests for signed saturing math overflow; NFC

Overflow conditions for sadd.sat and ssub.sat which can be determined
based on constant ranges, but not necessarily known bits.

llvm-svn: 357938

5 years agoClean up ObjCPropertyDecl printing
David Goldman [Mon, 8 Apr 2019 19:52:45 +0000 (19:52 +0000)]
Clean up ObjCPropertyDecl printing

Summary:
- `@property(attr, attr2)` instead of `@property ( attr,attr2 )`.
- Change priority of attributes (see code/comments inline).
- Support for printing weak and unsafe_unretained attributes.

Subscribers: arphaman, jfb, cfe-commits

Tags: #clang

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

llvm-svn: 357937

5 years agollvm-undname: Fix more crashes and asserts on invalid inputs
Nico Weber [Mon, 8 Apr 2019 19:46:53 +0000 (19:46 +0000)]
llvm-undname: Fix more crashes and asserts on invalid inputs

For functions whose callers don't check that enough input is present,
add checks at the start of the function that enough input is there and
set Error otherwise.

For functions that return AST objects, return nullptr instead of
incomplete AST objects with nullptr fields if an error occurred during
the function.

Introduce a new function demangleDeclarator() for the sequence
demangleFullyQualifiedSymbolName(); demangleEncodedSymbol() and
use it in the two places that had this sequence. Let this new function
check that ConversionOperatorIdentifiers have a valid TargetType.

Some of the bad inputs found by oss-fuzz, others by inspection.

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

llvm-svn: 357936

5 years ago[X86] Fix a couple lowering functions that called ReplaceAllUsesOfValueWith for the...
Craig Topper [Mon, 8 Apr 2019 19:44:07 +0000 (19:44 +0000)]
[X86] Fix a couple lowering functions that called ReplaceAllUsesOfValueWith for the newly created code and then return SDValue(). Use MERGE_VALUES instead.

Returning SDValue() makes the caller think custom lowering was unsuccessful and then it will fall back to trying to expand the original node. This expanded code will end up with no users and end up being pruned later. But it was useless unnecessary work to create it.

Instead return a MERGE_VALUES with all the results so the caller knows something changed. The caller can handle the replacements.

For one of the cases I had to use UNDEF has a dummy value for a result we know is unused. This should get pruned later.

llvm-svn: 357935

5 years agoAdd LLVM IR debug info support for Fortran COMMON blocks
Adrian Prantl [Mon, 8 Apr 2019 19:13:55 +0000 (19:13 +0000)]
Add LLVM IR debug info support for Fortran COMMON blocks

    COMMON blocks are a feature of Fortran that has no direct analog in C languages, but they are similar to data sections in assembly language programming. A COMMON block is a named area of memory that holds a collection of variables. Fortran subprograms may map the COMMON block memory area to their own, possibly distinct, non-empty list of variables. A Fortran COMMON block might look like the following example.

    COMMON /ALPHA/ I, J

    For this construct, the compiler generates a new scope-like DI construct (!DICommonBlock) into which variables (see I, J above) can be placed. As the common block implies a range of storage with global lifetime, the !DICommonBlock refers to a !DIGlobalVariable. The Fortran variable that comprise the COMMON block are also linked via metadata to offsets within the global variable that stands for the entire common block.

    @alpha_ = common global %alphabytes_ zeroinitializer, align 64, !dbg !27, !dbg !30, !dbg !33
    !14 = distinct !DISubprogram(…)
    !20 = distinct !DICommonBlock(scope: !14, declaration: !25, name: "alpha")
    !25 = distinct !DIGlobalVariable(scope: !20, name: "common alpha", type: !24)
    !27 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression())
    !29 = distinct !DIGlobalVariable(scope: !20, name: "i", file: !3, type: !28)
    !30 = !DIGlobalVariableExpression(var: !29, expr: !DIExpression())
    !31 = distinct !DIGlobalVariable(scope: !20, name: "j", file: !3, type: !28)
    !32 = !DIExpression(DW_OP_plus_uconst, 4)
    !33 = !DIGlobalVariableExpression(var: !31, expr: !32)

    The DWARF generated for this is as follows.

    DW_TAG_common_block:
    DW_AT_name: alpha
    DW_AT_location: @alpha_+0
    DW_TAG_variable:
    DW_AT_name: common alpha
    DW_AT_type: array of 8 bytes
    DW_AT_location: @alpha_+0
    DW_TAG_variable:
    DW_AT_name: i
    DW_AT_type: integer*4
    DW_AT_location: @Alpha+0
    DW_TAG_variable:
    DW_AT_name: j
    DW_AT_type: integer*4
    DW_AT_location: @Alpha+4

Patch by Eric Schweitz!

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

llvm-svn: 357934

5 years ago[OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.
Alexey Bataev [Mon, 8 Apr 2019 19:06:42 +0000 (19:06 +0000)]
[OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.

Functions __kmpc_alloc/__kmpc_free are updated with the new interfaces.
Patch synchronizes the compiler with the runtime.

llvm-svn: 357933

5 years agoRevert [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Steven Wu [Mon, 8 Apr 2019 18:53:21 +0000 (18:53 +0000)]
Revert [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

This reverts r357931 (git commit 8b70a5c11e08116955a875b9085433f14737bcaf)

llvm-svn: 357932

5 years ago[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Steven Wu [Mon, 8 Apr 2019 18:24:10 +0000 (18:24 +0000)]
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

Summary:
ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.

This fixes: PR41236
rdar://problem/49293439

Reviewers: tejohnson, pcc, dexonsmith

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, jkorous, dang, llvm-commits

Tags: #llvm

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

llvm-svn: 357931

5 years ago[JumpThreading] Fix incorrect fold conditional after indirectbr/callbr
Brian M. Rzycki [Mon, 8 Apr 2019 18:20:35 +0000 (18:20 +0000)]
[JumpThreading] Fix incorrect fold conditional after indirectbr/callbr

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

There is potential for miscompiled code emitted from JumpThreading when
analyzing a block with one or more indirectbr or callbr predecessors. The
ProcessThreadableEdges() function incorrectly folds conditional branches
into an unconditional branch.

This patch prevents incorrect branch folding without fully pessimizing
other potential threading opportunities through the same basic block.

This IR shape was manually fed in via opt and is unclear if clang and the
full pass pipeline will ever emit similar code shapes.

Thanks to Matthias Liedtke for the bug report and simplified IR example.

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

llvm-svn: 357930

5 years ago[OpenMP] Implement 5.0 memory management
Jonathan Peyton [Mon, 8 Apr 2019 17:59:28 +0000 (17:59 +0000)]
[OpenMP] Implement 5.0 memory management

* Replace HBWMALLOC API with more general MEMKIND API, new functions
  and variables added.
* Have libmemkind.so loaded when accessible.
* Redirect memspaces to default one except for high bandwidth which
  is processed separately.
* Ignore some allocator traits e.g., sync_hint, access, pinned, while
  others are processed normally e.g., alignment, pool_size, fallback,
  fb_data, partition.
* Add tests for memory management

Patch by Andrey Churbanov

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

llvm-svn: 357929

5 years ago[MS] Add metadata for __declspec(allocator)
Amy Huang [Mon, 8 Apr 2019 17:58:29 +0000 (17:58 +0000)]
[MS] Add metadata for __declspec(allocator)

Summary:
Emit !heapallocsite in the metadata for calls to functions marked with
__declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug
info in codeview.

Reviewers: rnk

Subscribers: jfb, cfe-commits

Tags: #clang

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

llvm-svn: 357928

5 years ago[OpenMP] Clean up load balancing dynamic mode
Jonathan Peyton [Mon, 8 Apr 2019 17:50:02 +0000 (17:50 +0000)]
[OpenMP] Clean up load balancing dynamic mode

This patch cleans up the bookkeeping code for the load balancing dynamic mode.

When a thread is moved to or from the thread pool, the th_active_in_pool flag
and the __kmp_thread_pool_active_nth global counter are both updated. This
removes the need for the corrective code in the main wait loop. Another global
counter, __kmp_thread_pool_nth, was removed completely, as it was only used for
debugging, but was not under KMP_DEBUG.

Patch by Terry Wilmarth

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

llvm-svn: 357927

5 years agoELF: Move verneed tracking data structures out of VersionNeedSection.
Peter Collingbourne [Mon, 8 Apr 2019 17:48:05 +0000 (17:48 +0000)]
ELF: Move verneed tracking data structures out of VersionNeedSection.

For partitions I intend to use the same set of version indexes in
each partition for simplicity. Since each partition will need its own
VersionNeedSection this will require moving the verneed tracking out of
VersionNeedSection. The way I've done this is to move most of the tracking
into SharedFile. What will eventually become the per-partition tracking
still lives in VersionNeedSection.

As a bonus the code gets a little simpler and more consistent with how we
handle verdef.

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

llvm-svn: 357926

5 years agoELF: De-template SharedFile. NFCI.
Peter Collingbourne [Mon, 8 Apr 2019 17:35:55 +0000 (17:35 +0000)]
ELF: De-template SharedFile. NFCI.

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

llvm-svn: 357925

5 years ago[X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOr...
Craig Topper [Mon, 8 Apr 2019 17:05:57 +0000 (17:05 +0000)]
[X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOrSAE so their rounding controls will be checked.

If we don't check this in the frontend we'll get an isel error in the backend later. This is far less friendly to users.

llvm-svn: 357924

5 years ago[OPENMP][NVPTX]Fixed processing of memory management directives.
Alexey Bataev [Mon, 8 Apr 2019 16:53:57 +0000 (16:53 +0000)]
[OPENMP][NVPTX]Fixed processing of memory management directives.

Added special processing of the memory management directives/clauses for
NVPTX target. For private locals, omp_default_mem_alloc and
omp_thread_mem_alloc result in allocation in local memory.
omp_const_mem_alloc allocates const memory, omp_teams_mem_alloc
allocates shared memory, and omp_cgroup_mem_alloc and
omp_large_cap_mem_alloc allocate global memory.

llvm-svn: 357923

5 years agoRemove a bogus sed option in test.
Alexander Kornienko [Mon, 8 Apr 2019 16:34:38 +0000 (16:34 +0000)]
Remove a bogus sed option in test.

llvm-svn: 357922

5 years agoRemove a useless assertion in clang-check.
Alexander Kornienko [Mon, 8 Apr 2019 16:29:43 +0000 (16:29 +0000)]
Remove a useless assertion in clang-check.

Re-commit r357915 with a fix for windows.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

llvm-svn: 357921

5 years ago[llvm-objdump] Migrate relocation handling functions from error_code to Error
Fangrui Song [Mon, 8 Apr 2019 16:24:08 +0000 (16:24 +0000)]
[llvm-objdump] Migrate relocation handling functions from error_code to Error

llvm-svn: 357920

5 years ago[llvm-mca][scheduler-stats] Print issued micro opcodes per cycle. NFCI
Andrea Di Biagio [Mon, 8 Apr 2019 16:05:54 +0000 (16:05 +0000)]
[llvm-mca][scheduler-stats] Print issued micro opcodes per cycle. NFCI

It makes more sense to print out the number of micro opcodes that are issued
every cycle rather than the number of instructions issued per cycle.
This behavior is also consistent with the dispatch-stats: numbers from the two
views can now be easily compared.

llvm-svn: 357919

5 years agoRevert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.
Simon Pilgrim [Mon, 8 Apr 2019 15:49:19 +0000 (15:49 +0000)]
Revert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15
........
Breaks windows buildbots

llvm-svn: 357918

5 years ago[python, tests] Disable Clang Python tests on SPARC
Rainer Orth [Mon, 8 Apr 2019 15:01:06 +0000 (15:01 +0000)]
[python, tests] Disable Clang Python tests on SPARC

Running `make check-all` fails on Solaris 11/SPARC since the clang python
tests FAIL:

  ............................
  ======================================================================
  FAIL: test_extent (tests.cindex.test_location.TestLocation)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_location.py", line 87, in test_extent
      self.assert_location(one.extent.start,line=1,column=1,offset=0)
    File "tests/cindex/test_location.py", line 22, in assert_location
      self.assertEqual(loc.column, column)
  AssertionError: 5 != 1

  ======================================================================
  FAIL: test_get_children (tests.cindex.test_cursor.TestCursor)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_cursor.py", line 70, in test_get_children
      self.assertEqual(tu_nodes[0].is_definition(), True)
  AssertionError: False != True

  ----------------------------------------------------------------------
  Ran 126 tests in 2.123s

  FAILED (failures=2, skipped=6)

Unfortunately, this aborts the rest of `make check-all`, even with `-k`, so
this patch disables the test as is already done on a couple of other
targets.

This allowed the `sparc-sun-solaris2.11` test to finish.

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

llvm-svn: 357917

5 years ago[clangd] Add fallback mode for code completion when compile command or preamble is...
Eric Liu [Mon, 8 Apr 2019 14:53:16 +0000 (14:53 +0000)]
[clangd] Add fallback mode for code completion when compile command or preamble is not ready.

Summary:
When calling TUScehduler::runWithPreamble (e.g. in code compleiton), allow
entering a fallback mode when compile command or preamble is not ready, instead of
waiting. This allows clangd to perform naive code completion e.g. using identifiers
in the current file or symbols in the index.

This patch simply returns empty result for code completion in fallback mode. Identifier-based
plus more advanced index-based completion will be added in followup patches.

Reviewers: ilya-biryukov, sammccall

Reviewed By: sammccall

Subscribers: sammccall, javed.absar, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 357916

5 years agoRemove a useless assertion in clang-check.
Alexander Kornienko [Mon, 8 Apr 2019 14:18:26 +0000 (14:18 +0000)]
Remove a useless assertion in clang-check.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

llvm-svn: 357915

5 years ago[X86][AVX] Add PR34380 shuffle test cases
Simon Pilgrim [Mon, 8 Apr 2019 14:05:42 +0000 (14:05 +0000)]
[X86][AVX] Add PR34380 shuffle test cases

llvm-svn: 357914

5 years agoChanged every use of ASTImporter::Import to Import_New
Balazs Keri [Mon, 8 Apr 2019 13:59:15 +0000 (13:59 +0000)]
Changed every use of ASTImporter::Import to Import_New

Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: a_sidorin

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

Tags: #clang

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

llvm-svn: 357913

5 years ago[x86] make 8-bit shl undesirable
Sanjay Patel [Mon, 8 Apr 2019 13:58:50 +0000 (13:58 +0000)]
[x86] make 8-bit shl undesirable

I was looking at a potential DAGCombiner fix for 1 of the regressions in D60278, and it caused severe regression test pain because x86 TLI lies about the desirability of 8-bit shift ops.

We've hinted at making all 8-bit ops undesirable for the reason in the code comment:

// TODO: Almost no 8-bit ops are desirable because they have no actual
//       size/speed advantages vs. 32-bit ops, but they do have a major
//       potential disadvantage by causing partial register stalls.

...but that leads to massive diffs and exposes all kinds of optimization holes itself.

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

llvm-svn: 357912

5 years agoUse llvm::crc32 instead of crc32. NFC
Eugene Leviant [Mon, 8 Apr 2019 13:40:58 +0000 (13:40 +0000)]
Use llvm::crc32 instead of crc32. NFC

llvm-svn: 357911

5 years ago[InstCombine] remove overzealous assert for shuffles (PR41419)
Sanjay Patel [Mon, 8 Apr 2019 13:28:29 +0000 (13:28 +0000)]
[InstCombine] remove overzealous assert for shuffles (PR41419)

As the TODO indicates, instsimplify could be improved.

Should fix:
https://bugs.llvm.org/show_bug.cgi?id=41419

llvm-svn: 357910

5 years ago[InstCombine][X86] Expand MOVMSK to generic IR (PR39927)
Simon Pilgrim [Mon, 8 Apr 2019 13:17:51 +0000 (13:17 +0000)]
[InstCombine][X86] Expand MOVMSK to generic IR (PR39927)

First step towards removing the MOVMSK intrinsics completely - this patch expands MOVMSK to the pattern:

e.g. PMOVMSKB(v16i8 x):
%cmp = icmp slt <16 x i8> %x, zeroinitializer
%int = bitcast <16 x i8> %cmp to i16
%res = zext i16 %int to i32

Which is correctly handled by ISel and FastIsel (give or take an annoying movzx move....): https://godbolt.org/z/rkrSFW

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

llvm-svn: 357909

5 years ago[clang-format] Optionally insert a space after unary ! operator
Reuben Thomas [Mon, 8 Apr 2019 12:54:48 +0000 (12:54 +0000)]
[clang-format] Optionally insert a space after unary ! operator

llvm-svn: 357908

5 years agogn build: Merge r357905
Nico Weber [Mon, 8 Apr 2019 12:43:46 +0000 (12:43 +0000)]
gn build: Merge r357905

llvm-svn: 357907

5 years agogn-build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Mon, 8 Apr 2019 12:42:37 +0000 (12:42 +0000)]
gn-build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

llvm-svn: 357906

5 years agoAttempt to recommit r357901
Eugene Leviant [Mon, 8 Apr 2019 12:31:12 +0000 (12:31 +0000)]
Attempt to recommit r357901

llvm-svn: 357905

5 years ago[InstCombine] sdiv exact flag fixup.
Chen Zheng [Mon, 8 Apr 2019 12:08:03 +0000 (12:08 +0000)]
[InstCombine] sdiv exact flag fixup.

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

llvm-svn: 357904

5 years ago[llvm-readobj] Use `reinterpret_cast` instead of C-style casting. NFC.
Xing GUO [Mon, 8 Apr 2019 11:48:36 +0000 (11:48 +0000)]
[llvm-readobj] Use `reinterpret_cast` instead of C-style casting. NFC.

llvm-svn: 357903

5 years agoReverting r357901 as fails to build on some of the buildbots
Eugene Leviant [Mon, 8 Apr 2019 11:37:20 +0000 (11:37 +0000)]
Reverting r357901 as fails to build on some of the buildbots

llvm-svn: 357902

5 years ago[Support] Add zlib independent CRC32
Eugene Leviant [Mon, 8 Apr 2019 11:25:48 +0000 (11:25 +0000)]
[Support] Add zlib independent CRC32

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

llvm-svn: 357901

5 years ago[llvm-exegesis] benchmarkMain(): less cryptic error if built w/o libpfm
Roman Lebedev [Mon, 8 Apr 2019 10:50:31 +0000 (10:50 +0000)]
[llvm-exegesis] benchmarkMain(): less cryptic error if built w/o libpfm

Wanted to check if inablility to measure latency of CMOV32rm
is a regression from D60041 / D60138, but unable to do that
because the llvm-exegesis-{8,9} from debian sid fails
with that cryptic, unhelpful error.

I suspect this will be a better error.

llvm-svn: 357900

5 years ago[CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD
Justin Bogner [Mon, 8 Apr 2019 10:19:17 +0000 (10:19 +0000)]
[CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD

Simplify building with particular C++ standards by replacing the
specific "enable standard X" flags with a flag that allows specifying
the standard you want directly.

We preserve compatibility with the existing flags so that anyone with
those flags in existing caches won't break mysteriously.

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

llvm-svn: 357899

5 years ago[llvm-exegesis][X86] Randomize CMOVcc/SETcc OPERAND_COND_CODE CondCodes
Roman Lebedev [Mon, 8 Apr 2019 10:11:00 +0000 (10:11 +0000)]
[llvm-exegesis][X86] Randomize CMOVcc/SETcc OPERAND_COND_CODE CondCodes

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 357898

5 years agoObject/Minidump: Add support for reading the ModuleList stream
Pavel Labath [Mon, 8 Apr 2019 09:57:29 +0000 (09:57 +0000)]
Object/Minidump: Add support for reading the ModuleList stream

Summary:
The ModuleList stream consists of an integer giving the number of
entries in the list, followed by the list itself. Each entry in the list
describes a module (dynamically loaded objects which were loaded in the
process when it crashed (or when the minidump was generated).

The code for reading the list is relatively straight-forward, with a
single gotcha. Some minidump writers are emitting padding after the
"count" field in order to align the subsequent list on 8 byte boundary
(this depends on how their ModuleList type was defined and the native
alignment of various types on their platform). Fortunately, the minidump
format contains enough redundancy (in the form of the stream length
field in the stream directory), which allows us to detect this situation
and correct it.

This patch just adds the ability to parse the stream. Code for
conversion to/from yaml will come in a follow-up patch.

Reviewers: zturner, amccarth, jhenderson, clayborg

Subscribers: jdoerfert, markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 357897

5 years agoMinidumpParser: parse SystemInfo stream via llvm
Pavel Labath [Mon, 8 Apr 2019 09:53:03 +0000 (09:53 +0000)]
MinidumpParser: parse SystemInfo stream via llvm

I also update the tests for SystemInfo parsing to use the yaml2minidump
capabilities in llvm instead of relying on checked-in binaries.

llvm-svn: 357896

5 years agoPDBFPO: add dyn_cast support
Pavel Labath [Mon, 8 Apr 2019 09:52:57 +0000 (09:52 +0000)]
PDBFPO: add dyn_cast support

This adds the necessary glue so we can use llvm::dyn_cast, instead of
doing a manual type-check followed by a cast. NFC.

llvm-svn: 357895

5 years ago[InstCombine] add more testcases for sdiv exact flag fixup.
Chen Zheng [Mon, 8 Apr 2019 09:19:42 +0000 (09:19 +0000)]
[InstCombine] add more testcases for sdiv exact flag fixup.

llvm-svn: 357894