platform/upstream/llvm.git
6 years agoReland r330223, "COFF: Merge .idata, .didat and .edata into .rdata by default.",...
Peter Collingbourne [Tue, 17 Apr 2018 23:28:52 +0000 (23:28 +0000)]
Reland r330223, "COFF: Merge .idata, .didat and .edata into .rdata by default.", which was reverted in r330228.

In this reland I removed an unnecessary use of /debug in the test
delayimports32.test and used the /pdbaltpath flag in the test
pdb-publics-import.test, both of which avoid embedding absolute PDB
paths in executables which could affect later RVAs.

Original commit message:
> COFF: Merge .idata, .didat and .edata into .rdata by default.
>
> This saves a little space and matches what link.exe does.
>
> Tested using the chromium Windows trybots:
> https://chromium-review.googlesource.com/c/chromium/src/+/1014784

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

llvm-svn: 330233

6 years agoCOFF: Implement /pdbaltpath flag.
Peter Collingbourne [Tue, 17 Apr 2018 23:28:38 +0000 (23:28 +0000)]
COFF: Implement /pdbaltpath flag.

I needed to revert r330223 because we were embedding an absolute PDB
path in the .rdata section, which ended up being laid out before the
.idata section and affecting its RVAs. This flag will let us control
the embedded path.

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

llvm-svn: 330232

6 years ago[XRay][compiler-rt] Add noop patch functions for unsupported arches.
Keith Wyss [Tue, 17 Apr 2018 23:19:23 +0000 (23:19 +0000)]
[XRay][compiler-rt] Add noop patch functions for unsupported arches.

Summary:
Typed event patching is implemented for x86-64, but functions must
be defined for other arches.

Reviewers: dberris, pelikan

Subscribers: nemanjai, javed.absar, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330231

6 years ago[AMDGPU] Enabled v2.16 literals for VOP3P
Stanislav Mekhanoshin [Tue, 17 Apr 2018 23:09:05 +0000 (23:09 +0000)]
[AMDGPU] Enabled v2.16 literals for VOP3P

Literal encoding needs op_sel_hi to select low 16 bit in this case.

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

llvm-svn: 330230

6 years ago[AAch64] Add the __ARM_FEATURE_DOTPROD macro definition
Junmo Park [Tue, 17 Apr 2018 22:38:40 +0000 (22:38 +0000)]
[AAch64] Add the __ARM_FEATURE_DOTPROD macro definition

This matches what GCC does.
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/aarch64/aarch64-c.c

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

llvm-svn: 330229

6 years agoRevert r330223, "COFF: Merge .idata, .didat and .edata into .rdata by default."
Peter Collingbourne [Tue, 17 Apr 2018 22:16:39 +0000 (22:16 +0000)]
Revert r330223, "COFF: Merge .idata, .didat and .edata into .rdata by default."

Seems to have uncovered some sort of non-determinism on the bots.

llvm-svn: 330228

6 years ago[Mem2Reg] Create merged debug locations for inserted phis
Vedant Kumar [Tue, 17 Apr 2018 22:03:08 +0000 (22:03 +0000)]
[Mem2Reg] Create merged debug locations for inserted phis

Track the debug locations of the incoming values to newly-created phis,
and apply merged debug locations to the phis.

A merged location will be on line 0, but will have the correct scope
set. This improves crash reporting when an inlined instruction with a
merged location triggers a machine exception. A debugger will be able to
narrow down the crash to the correct inlined scope, instead of simply
pointing to the outer scope of the caller.

Taken together with a change allows generating merged line-0 locations
for  instructions which aren't calls, this results in a 0.5% increase in
the uncompressed size of the .debug_line section of a stage2+Release
build of clang (-O3 -g).

rdar://33858697

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

llvm-svn: 330227

6 years ago[Mem2Reg] Make RenamePassData a struct, NFC
Vedant Kumar [Tue, 17 Apr 2018 22:03:07 +0000 (22:03 +0000)]
[Mem2Reg] Make RenamePassData a struct, NFC

llvm-svn: 330226

6 years agoAdd Microsoft mangling for _Float16
Erich Keane [Tue, 17 Apr 2018 22:00:54 +0000 (22:00 +0000)]
Add Microsoft mangling for _Float16

Enables _Float16 on Windows by creating a mangling
mechanism in MicrosoftMangle.  It accomplishes this by
mangling as a structure type of __clang::_Float16, similar
to how Complex works.

Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D45738

llvm-svn: 330225

6 years ago[RISCV] implement li pseudo instruction
Alex Bradbury [Tue, 17 Apr 2018 21:56:40 +0000 (21:56 +0000)]
[RISCV] implement li pseudo instruction

The implementation follows the MIPS backend and expands the
pseudo instruction directly during asm parsing. As the result, only
real MC instructions are emitted to the MCStreamer. Additionally,
PseudoLI instructions are emitted during codegen. The actual
expansion to real instructions is performed during MI to MC lowering
and is similar to the expansion performed by the GNU Assembler.

Differential Revision: https://reviews.llvm.org/D41949
Patch by Mario Werner.

llvm-svn: 330224

6 years agoCOFF: Merge .idata, .didat and .edata into .rdata by default.
Peter Collingbourne [Tue, 17 Apr 2018 21:44:31 +0000 (21:44 +0000)]
COFF: Merge .idata, .didat and .edata into .rdata by default.

This saves a little space and matches what link.exe does.

Tested using the chromium Windows trybots:
https://chromium-review.googlesource.com/c/chromium/src/+/1014784

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

llvm-svn: 330223

6 years agollvm-pdbutil: Fix an off-by-one error.
Peter Collingbourne [Tue, 17 Apr 2018 21:44:17 +0000 (21:44 +0000)]
llvm-pdbutil: Fix an off-by-one error.

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

llvm-svn: 330222

6 years agoLoadStoreVectorizer crashes due to unsized type
Stanislav Mekhanoshin [Tue, 17 Apr 2018 21:40:04 +0000 (21:40 +0000)]
LoadStoreVectorizer crashes due to unsized type

When we skip bitcasts while looking for GEP in LoadSoreVectorizer
we should also verify that the type is sized otherwise we assert

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

llvm-svn: 330221

6 years ago[XRay] Add clang builtin for xray typed events.
Keith Wyss [Tue, 17 Apr 2018 21:32:43 +0000 (21:32 +0000)]
[XRay] Add clang builtin for xray typed events.

Summary:
A clang builtin for xray typed events. Differs from
__xray_customevent(...) by the presence of a type tag that is vended by
compiler-rt in typical usage. This allows xray handlers to expand logged
events with their type description and plugins to process traced events
based on type.

This change depends on D45633 for the intrinsic definition.

Reviewers: dberris, pelikan, rnk, eizan

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 330220

6 years ago[XRay] Typed event logging intrinsic
Keith Wyss [Tue, 17 Apr 2018 21:30:29 +0000 (21:30 +0000)]
[XRay] Typed event logging intrinsic

Summary:
Add an LLVM intrinsic for type discriminated event logging with XRay.
Similar to the existing intrinsic for custom events, but also accepts
a type tag argument to allow plugins to be aware of different types
and semantically interpret logged events they know about without
choking on those they don't.

Relies on a symbol defined in compiler-rt patch D43668. I may wait
to submit before I can see demo everything working together including
a still to come clang patch.

Reviewers: dberris, pelikan, eizan, rSerge, timshen

Subscribers: llvm-commits

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

llvm-svn: 330219

6 years agoImplement trampoline and handler for typed xray event tracing.
Keith Wyss [Tue, 17 Apr 2018 21:28:53 +0000 (21:28 +0000)]
Implement trampoline and handler for typed xray event tracing.

Summary:
Compiler-rt support first before defining the __xray_typedevent() lowering in
llvm. I'm looking for some early feedback before I touch much more code.

Reviewers: dberris

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 330218

6 years ago[WebAssembly] Add an assertion for an invalid CFG
Heejin Ahn [Tue, 17 Apr 2018 21:19:21 +0000 (21:19 +0000)]
[WebAssembly] Add an assertion for an invalid CFG

Summary:
It was not easy to provide a test case for D45648 (rL330079) because the bug
didn't manifest itself in the set of currently valid IRs. Added an assertion to
check this faster, thanks to @dblaikie's suggestion.

Reviewers: dblaikie

Subscribers: jfb, dschuff, sbc100, jgravelle-google, llvm-commits, dblaikie

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

llvm-svn: 330217

6 years agoRename sys::Process::GetArgumentVector -> sys::windows::GetCommandLineArguments
Rui Ueyama [Tue, 17 Apr 2018 21:09:16 +0000 (21:09 +0000)]
Rename sys::Process::GetArgumentVector -> sys::windows::GetCommandLineArguments

GetArgumentVector (or GetCommandLineArguments) is very Windows-specific.
I think it doesn't make much sense to provide that function from sys::Process.

I also made a change so that the function takes a BumpPtrAllocator
instead of a SpecificBumpPtrAllocator. The latter is the class to call
dtors, but since char * is trivially destructible, we should use the
former class.

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

llvm-svn: 330216

6 years ago[WebAssembly] Teach fast-isel to gracefully recover from illegal return types.
Dan Gohman [Tue, 17 Apr 2018 20:46:42 +0000 (20:46 +0000)]
[WebAssembly] Teach fast-isel to gracefully recover from illegal return types.

Fixes PR36564.

llvm-svn: 330215

6 years agoChange PlatformPosix::DoLoadImage to use a UtilityFunction.
Jim Ingham [Tue, 17 Apr 2018 20:44:47 +0000 (20:44 +0000)]
Change PlatformPosix::DoLoadImage to use a UtilityFunction.

That way we won't have to compile a new expression every time we want
dlopen a library.

<rdar://problem/32626584>

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

llvm-svn: 330214

6 years ago[Driver] Use the per-API level Android library directories.
Dan Albert [Tue, 17 Apr 2018 20:42:07 +0000 (20:42 +0000)]
[Driver] Use the per-API level Android library directories.

Summary:
Android sysroots contain libraries for each OS version, as well as a
handful of unversioned libraries in the typical multiarch directory.

Reviewers: srhines, eugenis, george.burgess.iv

Reviewed By: eugenis

Subscribers: javed.absar, cfe-commits

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

llvm-svn: 330213

6 years agoRequire shell for test
Teresa Johnson [Tue, 17 Apr 2018 20:36:51 +0000 (20:36 +0000)]
Require shell for test

Attempt to fix windows bot which doesn't like the "(cd .." invocation
added in r330194:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-windows/builds/8704/steps/stage%202%20check/logs/stdio

llvm-svn: 330212

6 years agoFix the xcode project for the Args -> Utility move.
Jim Ingham [Tue, 17 Apr 2018 20:35:00 +0000 (20:35 +0000)]
Fix the xcode project for the Args -> Utility move.

llvm-svn: 330211

6 years agoRemove unused variable
Teresa Johnson [Tue, 17 Apr 2018 20:21:53 +0000 (20:21 +0000)]
Remove unused variable

Fixes unused variable error introduced in r330194.

llvm-svn: 330210

6 years ago[llvm-pdbutil] Dump first section contribution for each module.
Zachary Turner [Tue, 17 Apr 2018 20:06:43 +0000 (20:06 +0000)]
[llvm-pdbutil] Dump first section contribution for each module.

The DBI stream contains a list of module descriptors.  At the
beginning of each descriptor is a structure representing the first
section contribution in the output file for that module.  LLD
currently doesn't fill out this structure at all, but link.exe
does.  So as a precursor to emitting this data in LLD, we first
need a way to dump it so that it can be checked.

This patch adds support for the dumping, and verifies via a test
that LLD emits bogus information.

llvm-svn: 330208

6 years agopowr: Use denormal path only
Jan Vesely [Tue, 17 Apr 2018 19:35:32 +0000 (19:35 +0000)]
powr: Use denormal path only

It's OK to either flush to 0 or return denormal result if the device
does not support denormals. See sec 7.2 and 7.5.3 of OCL specs
Fixes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>

llvm-svn: 330207

6 years agopown: Use denormal path only
Jan Vesely [Tue, 17 Apr 2018 19:35:30 +0000 (19:35 +0000)]
pown: Use denormal path only

It's OK to either flush to 0 or return denormal result if the device
does not support denormals. See sec 7.2 and 7.5.3 of OCL specs
Fixes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>

llvm-svn: 330206

6 years agopow: Use denormal path only
Jan Vesely [Tue, 17 Apr 2018 19:35:28 +0000 (19:35 +0000)]
pow: Use denormal path only

It's OK to either flush to 0 or return denormal result if the device
does not support denormals. See sec 7.2 and 7.5.3 of OCL specs
Fixes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>

llvm-svn: 330205

6 years ago[X86] Add separate scheduling class for PSADBW instruction.
Craig Topper [Tue, 17 Apr 2018 19:35:19 +0000 (19:35 +0000)]
[X86] Add separate scheduling class for PSADBW instruction.

llvm-svn: 330204

6 years ago[X86] Remove unnecessary InstRW overrides. Add somes FIXMEs/TODOs.
Craig Topper [Tue, 17 Apr 2018 19:35:14 +0000 (19:35 +0000)]
[X86] Remove unnecessary InstRW overrides. Add somes FIXMEs/TODOs.

llvm-svn: 330203

6 years ago[Sema] Warn about memcpy'ing non-trivial C structs.
Akira Hatanaka [Tue, 17 Apr 2018 19:13:41 +0000 (19:13 +0000)]
[Sema] Warn about memcpy'ing non-trivial C structs.

Issue a warning when non-trivial C structs are copied or initialized by
calls to memset, bzero, memcpy, or memmove.

rdar://problem/36124208

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

llvm-svn: 330202

6 years agoMove the visitor classes that are used to traverse non-trivial C structs
Akira Hatanaka [Tue, 17 Apr 2018 19:05:17 +0000 (19:05 +0000)]
Move the visitor classes that are used to traverse non-trivial C structs
to a header file.

This is in preparation for using the visitor classes to warn about
memcpy'ing non-trivial C structs.

See the discussion here:
https://reviews.llvm.org/D45310

rdar://problem/36124208

llvm-svn: 330201

6 years agoMove Args.cpp from Interpreter to Utility
Pavel Labath [Tue, 17 Apr 2018 18:53:35 +0000 (18:53 +0000)]
Move Args.cpp from Interpreter to Utility

Summary:
The Args class is used in plenty of places besides the command
interpreter (e.g., anything requiring an argc+argv combo, such as when
launching a process), so it needs to be in a lower layer. Now that the
class has no external dependencies, it can be moved down to the Utility
module.

This removes the last (direct) dependency from the Host module to
Interpreter, so I remove the Interpreter module from Host's dependency
list.

Reviewers: zturner, jingham, davide

Subscribers: mgorny, lldb-commits

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

llvm-svn: 330200

6 years agoAdd a command line option 'fregister_global_dtors_with_atexit' to
Akira Hatanaka [Tue, 17 Apr 2018 18:41:52 +0000 (18:41 +0000)]
Add a command line option 'fregister_global_dtors_with_atexit' to
register destructor functions annotated with __attribute__((destructor))
using __cxa_atexit or atexit.

Register destructor functions annotated with __attribute__((destructor))
calling __cxa_atexit in a synthesized constructor function instead of
emitting references to the functions in a special section.

The primary reason for adding this option is that we are planning to
deprecate the __mod_term_funcs section on Darwin in the future. This
feature is enabled by default only on Darwin. Users who do not want this
can use command line option 'fno_register_global_dtors_with_atexit' to
disable it.

rdar://problem/33887655

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

llvm-svn: 330199

6 years agoamdgcn/fmin: Fix typos that reduced precision
Jan Vesely [Tue, 17 Apr 2018 18:11:29 +0000 (18:11 +0000)]
amdgcn/fmin: Fix typos that reduced precision

Not sure how these sneaked in.
Fixes fminD and few other tests(fractD, cosD) on carrizo
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 330198

6 years agoexp10: Port from amd builtins
Jan Vesely [Tue, 17 Apr 2018 18:08:08 +0000 (18:08 +0000)]
exp10: Port from amd builtins

Passes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed and Tested (on RX 580) by: Aaron Watry <awatry@gmail.com>

llvm-svn: 330197

6 years ago[X86] Remove -mcpu=skx/knl from some tests and use -mattr instead.
Craig Topper [Tue, 17 Apr 2018 17:30:06 +0000 (17:30 +0000)]
[X86] Remove -mcpu=skx/knl from some tests and use -mattr instead.

mcpu exposes other tuning flags. These tests are only trying to test instruction set features so it is better to use mattr.

llvm-svn: 330196

6 years ago[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch64 mode only
Ivan A. Kosarev [Tue, 17 Apr 2018 16:43:07 +0000 (16:43 +0000)]
[NEON] Define vget_high_f16() and vget_low_f16() intrinsics in AArch64 mode only

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

llvm-svn: 330195

6 years ago[ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds
Teresa Johnson [Tue, 17 Apr 2018 16:39:25 +0000 (16:39 +0000)]
[ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds

Summary:
The clang driver option -save-temps was not passed to the LTO config,
so when invoking the ThinLTO backends via clang during distributed
builds there was no way to get LTO to save temp files.

Getting this to work with ThinLTO distributed builds also required
changing the driver to avoid a separate compile step to emit unoptimized
bitcode when the input was already bitcode under -save-temps. Not only is
this unnecessary in general, it is problematic for ThinLTO backends since
the temporary bitcode file to the backend would not match the module path
in the combined index, leading to incorrect ThinLTO backend index-based
optimizations.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 330194

6 years agoRevert "Fix incorrect choice of callee-saved registers save/restore points (take 2)"
Momchil Velikov [Tue, 17 Apr 2018 16:29:58 +0000 (16:29 +0000)]
Revert "Fix incorrect choice of callee-saved registers save/restore points (take 2)"

Revert in order to fix the test to not run when required targets aren't
configured.

llvm-svn: 330193

6 years agoFix incorrect choice of callee-saved registers save/restore points (take 2)
Momchil Velikov [Tue, 17 Apr 2018 15:59:06 +0000 (15:59 +0000)]
Fix incorrect choice of callee-saved registers save/restore points (take 2)

Add the accidentally omitted testcase.

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

llvm-svn: 330192

6 years ago[Hexagon] Do not merge initializers for stack and non-stack expressions
Krzysztof Parzyszek [Tue, 17 Apr 2018 15:23:09 +0000 (15:23 +0000)]
[Hexagon] Do not merge initializers for stack and non-stack expressions

Stack addressing needs addressing modes that provide an offset field
immediately following the frame index. An initializer from a non-stack
addressing could force the stack address to use a form that does not
provide an offset field.

llvm-svn: 330191

6 years ago[sanitizer] Remove low-hanging-fruit dead code
Kostya Kortchinsky [Tue, 17 Apr 2018 14:54:50 +0000 (14:54 +0000)]
[sanitizer] Remove low-hanging-fruit dead code

Summary:
Going through the dead code findings, the code removed in this CL appears to be
pretty straightforward to remove, and seems to be some leftover from previous
refactors.

Reviewers: alekseyshl, eugenis

Reviewed By: alekseyshl

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

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

llvm-svn: 330190

6 years ago[LLVM-C] [PR34633] Avoid calling ->dump() methods from LLVMDump*.
whitequark [Tue, 17 Apr 2018 14:52:43 +0000 (14:52 +0000)]
[LLVM-C] [PR34633] Avoid calling ->dump() methods from LLVMDump*.

LLVMDump* functions are available in Release builds too.

Patch by Brenton Bostick.

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

llvm-svn: 330189

6 years agoAdd modifiers for unsigned char and signed char field printing for __builtin_dump_struct.
Aaron Ballman [Tue, 17 Apr 2018 14:00:06 +0000 (14:00 +0000)]
Add modifiers for unsigned char and signed char field printing for __builtin_dump_struct.

Patch by Paul Semel.

llvm-svn: 330188

6 years ago[NEON] Fix the architecture condition for the crypto intrinsics
Ivan A. Kosarev [Tue, 17 Apr 2018 13:37:30 +0000 (13:37 +0000)]
[NEON] Fix the architecture condition for the crypto intrinsics

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

llvm-svn: 330187

6 years ago[PowerPC] Mark the BDNZ intrinsic as NoDuplicate
Nemanja Ivanovic [Tue, 17 Apr 2018 13:07:01 +0000 (13:07 +0000)]
[PowerPC] Mark the BDNZ intrinsic as NoDuplicate

Duplicating this intrinsic is not generally valid because it has the side-effect
of decrementing the CTR. Any passes that duplicate it would need to be taught to
keep the regions formed completely disjoint.
This patch should be NFC for typical uses as CTRLoops runs after the remaining
loop passes. It only affects situations where the loop passes are scheduled on
the IR after the codegen passes (as is the case with some JIT pipelines).

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

llvm-svn: 330186

6 years agoAdd checks for format specifiers used by __builtin_dump_struct and added a new specif...
Aaron Ballman [Tue, 17 Apr 2018 11:57:47 +0000 (11:57 +0000)]
Add checks for format specifiers used by __builtin_dump_struct and added a new specifier for null-terminated constant strings.

Patch by Paul Semel.

llvm-svn: 330185

6 years agoAdd some infuriatingly necessary comments to this test case.
Chandler Carruth [Tue, 17 Apr 2018 11:08:05 +0000 (11:08 +0000)]
Add some infuriatingly necessary comments to this test case.

Without these comments, by "luck" the contents of SomeKit's SKWidget.h
are precisely the same as SomeKitCore's SomeKitCore.h. This can create
havoc if anything canonicalizes on the inode and your filesystem assigns
a common inode to files with identical file content. Alternatively, if
your build system uses symlinks into a content-addressed-storage (as
Google's does), you end up with these files being symlinks to the same
file.

The end result is that Clang deduplicates them internally, and then
believes that the SomeKit framework includes the SomeKitCore.h header,
and does not include the SKWidget.h in SomeKit. This in turn results in
warnings in this test and eventually errors as Clang becomes confused
because the umbrella header for SomeKitCore has already been included
into another framework's module (SomeKit). Yay.

If anyone has a better idea about how to avoid this, I'm all ears.
Nothing other than causing the file content to change worked for me.

llvm-svn: 330184

6 years agoFix incorrect choice of callee-saved registers save/restore points
Momchil Velikov [Tue, 17 Apr 2018 08:37:38 +0000 (08:37 +0000)]
Fix incorrect choice of callee-saved registers save/restore points

Make the shrink wrapping pass pay attention to uses/defs of the stack pointer.

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

llvm-svn: 330183

6 years ago[clangd] Fix "fail to create file URI" warnings in FileIndexTest.
Haojian Wu [Tue, 17 Apr 2018 08:34:50 +0000 (08:34 +0000)]
[clangd] Fix "fail to create file URI" warnings in FileIndexTest.

Summary:
When running the FileIndexTest, it shows "Failed to create an URI
for file XXX: not a valid absolute file path" warnings, and the
generated Symbols is missing Location information.

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, jkorous-apple, MaskRay, cfe-commits

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

llvm-svn: 330182

6 years ago[NewPM] Update pass registration for the LLVM plugin interface
Philip Pfaffe [Tue, 17 Apr 2018 07:59:46 +0000 (07:59 +0000)]
[NewPM] Update pass registration for the LLVM plugin interface

Summary:
As of rL329273, LLVM has a mechanism to load new-pm plugins in opt. Use
this API in Polly.

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser, Meinersbur

Subscribers: lksbhm, bollu, pollydev, llvm-commits

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

llvm-svn: 330181

6 years agoRevert "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." again."
Michael Zolotukhin [Tue, 17 Apr 2018 07:31:27 +0000 (07:31 +0000)]
Revert "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." again."

This reverts r330175. There are still stage3/stage4 miscompares.

llvm-svn: 330180

6 years ago[X86] Add FP comparison scheduler classes
Simon Pilgrim [Tue, 17 Apr 2018 07:22:44 +0000 (07:22 +0000)]
[X86] Add FP comparison scheduler classes

Split VCMP/VMAX/VMIN instructions off to WriteFCmp and VCOMIS instructions off to WriteFCom instead of assuming they match WriteFAdd

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

llvm-svn: 330179

6 years ago[DAGCombiner] Fix for oss-fuzz bug
Gerolf Hoflehner [Tue, 17 Apr 2018 07:22:34 +0000 (07:22 +0000)]
[DAGCombiner] Fix for oss-fuzz bug

llvm-svn: 330178

6 years agoFix malformed table introduced by r330174
Duncan P. N. Exon Smith [Tue, 17 Apr 2018 05:48:36 +0000 (05:48 +0000)]
Fix malformed table introduced by r330174

http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/23573

llvm-svn: 330177

6 years ago[SSAUpdaterBulk] Add debug logging.
Michael Zolotukhin [Tue, 17 Apr 2018 04:45:40 +0000 (04:45 +0000)]
[SSAUpdaterBulk] Add debug logging.

llvm-svn: 330176

6 years agoReapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." again.
Michael Zolotukhin [Tue, 17 Apr 2018 04:45:22 +0000 (04:45 +0000)]
Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." again.

One more, hopefully the last, bug is fixed: when forming UsesToRewrite
we should ignore phi operands coming from edges that we want to delete.

This reverts r329910.

llvm-svn: 330175

6 years agoRemove GC-related warning terminology
Duncan P. N. Exon Smith [Tue, 17 Apr 2018 04:25:18 +0000 (04:25 +0000)]
Remove GC-related warning terminology

ObjC-GC isn't used any more; clean up this warning text.

rdar://problem/39049693

llvm-svn: 330174

6 years ago[IR] Upgrade comment token in objc retain release marker for asm call
Gerolf Hoflehner [Tue, 17 Apr 2018 04:02:24 +0000 (04:02 +0000)]
[IR] Upgrade comment token in objc retain release marker for asm call

Older compiler issued '#' instead of ';'

llvm-svn: 330173

6 years agoCOFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.
Peter Collingbourne [Tue, 17 Apr 2018 01:54:34 +0000 (01:54 +0000)]
COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.

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

llvm-svn: 330172

6 years agoCODE_OWNERS: Take ownership of C API.
whitequark [Tue, 17 Apr 2018 01:09:12 +0000 (01:09 +0000)]
CODE_OWNERS: Take ownership of C API.

llvm-svn: 330171

6 years ago[Statistics] Relax the test output a little bit.
Davide Italiano [Mon, 16 Apr 2018 23:59:01 +0000 (23:59 +0000)]
[Statistics] Relax the test output a little bit.

We don't really care about the order as this is a dictionary.
It should be more resilient to changes (adding/shuffling stats
around).

Pointed out by Jason Molenda in a post-commit review (thanks Jason).

llvm-svn: 330170

6 years ago[ARM] Compute a target feature which corresponds to the ARM version.
Eli Friedman [Mon, 16 Apr 2018 23:52:58 +0000 (23:52 +0000)]
[ARM] Compute a target feature which corresponds to the ARM version.

Currently, the interaction between the triple, the CPU, and the
supported features is a mess: the driver edits the triple to indicate
the supported architecture version, and the LLVM backend uses this to
figure out what instructions are legal.  This makes it difficult to
understand what's happening, and makes it impossible to LTO together two
modules with different computed architectures.

Instead of relying on triple rewriting to get the correct target
features, we should add the right target features explicitly.

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

llvm-svn: 330169

6 years ago[DebugInfo] Follow-up bug fix on "Fixing a couple of DI duplication bugs of CloneModule"
Roman Tereshin [Mon, 16 Apr 2018 23:39:44 +0000 (23:39 +0000)]
[DebugInfo] Follow-up bug fix on "Fixing a couple of DI duplication bugs of CloneModule"

Apparently, DebugInfoFinder::processCompileUnit doesn't process all
of the possible kinds of DIImportedEntit'ies, e.g. DIGlobalVariable's.

Previously introduced `llvm_unreachable` is therefore incorrect.
Removing it here.

llvm-svn: 330167

6 years ago[Availability] Improve availability to consider functions run at load time
Steven Wu [Mon, 16 Apr 2018 23:34:18 +0000 (23:34 +0000)]
[Availability] Improve availability to consider functions run at load time

Summary:
There are some functions/methods that run when the application launches
or the library loads. Those functions will run reguardless the OS
version as long as it satifies the minimum deployment target. Annotate
them with availability attributes doesn't really make sense because they
are essentially available on all targets since minimum deployment
target.

rdar://problem/36093384

Reviewers: arphaman, erik.pilkington

Reviewed By: erik.pilkington

Subscribers: erik.pilkington, cfe-commits

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

llvm-svn: 330166

6 years ago[Commands] Expose statistics through the SBAPI.
Davide Italiano [Mon, 16 Apr 2018 22:55:34 +0000 (22:55 +0000)]
[Commands] Expose statistics through the SBAPI.

The API is `SBStructuredData GetStatistics()`. This allows
the command to be used in scripts.

<rdar://problem/36555975>

llvm-svn: 330165

6 years agoRevert r329960 "Do not keep shared symbols created from garbage-collected eliminated...
Reid Kleckner [Mon, 16 Apr 2018 22:45:23 +0000 (22:45 +0000)]
Revert r329960 "Do not keep shared symbols created from garbage-collected eliminated DSOs."

This is causing large numbers of Chromium test executables to crash on
shutdown. The relevant symbol seems to be __cxa_finalize, which gets
removed from the dynamic symbol table for some of the support libraries.

llvm-svn: 330164

6 years agoMake sure deleting all breakpoints clears their sites first
Eugene Zemtsov [Mon, 16 Apr 2018 22:26:21 +0000 (22:26 +0000)]
Make sure deleting all breakpoints clears their sites first

Bug: https://bugs.llvm.org/show_bug.cgi?id=36430

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

llvm-svn: 330163

6 years ago[libc++abi] Replace __sync_* functions with __libcpp_atomic_* functions.
Eli Friedman [Mon, 16 Apr 2018 22:00:14 +0000 (22:00 +0000)]
[libc++abi] Replace __sync_* functions with __libcpp_atomic_* functions.

This is basically part 2 of r313694.

It's a little unfortunate that I had to copy-paste atomic_support.h,
but I don't really see any alternative.

The refstring.h changes are the same as the libcxx changes in r313694.

llvm-svn: 330162

6 years agoRevert "build: reserve `--color-diagnostics` for lld"
Saleem Abdulrasool [Mon, 16 Apr 2018 21:57:10 +0000 (21:57 +0000)]
Revert "build: reserve `--color-diagnostics` for lld"

This reverts SVN r330158.

Seems that there was a change to linker flags handling in SVN r316972.
That would alter the behaviour to correct the linker flag handling in
CMake (requiring CMake 3.4.3+).  Since that is already the minimum
version required for LLVM, hard coding the knowledge of the linker is
not required, which is a strictly better solution.

llvm-svn: 330161

6 years agoLimit types of builtins that can be redeclared.
Erich Keane [Mon, 16 Apr 2018 21:30:08 +0000 (21:30 +0000)]
Limit types of builtins that can be redeclared.

As reported here: https://bugs.llvm.org/show_bug.cgi?id=37033
Any usage of a builtin function that uses a va_list by reference
will cause an assertion when redeclaring it.

After discussion in the review, it was concluded that the correct
way of accomplishing this fix is to make attempts to redeclare certain
builtins an error. Unfortunately, doing this limitation for all builtins
is likely a breaking change, so this commit simply limits it to
types with custom type checking and those that take a reference.

Two tests needed to be updated to make this work.

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

llvm-svn: 330160

6 years agoDefer adding keywords to the identifier table until after the language options have...
Aaron Ballman [Mon, 16 Apr 2018 21:07:08 +0000 (21:07 +0000)]
Defer adding keywords to the identifier table until after the language options have been loaded from the AST file.

This fixes issues with "class" being reported as an identifier in "enum class" because the construct is not present when using default language options.

Patch by Johann Klähn.

llvm-svn: 330159

6 years agobuild: reserve `--color-diagnostics` for lld
Saleem Abdulrasool [Mon, 16 Apr 2018 21:05:56 +0000 (21:05 +0000)]
build: reserve `--color-diagnostics` for lld

When building out-of-tree compilers (e.g. swift), the linker check here
may yield incorrect values.  Ensure that we are using lld before we
attempt to use `--color-diagnostics` for the linker.  Other linkers (i.e
bfd, gold) do not support this flag and the test can pass in some cases
and then fail subsequently when building.

llvm-svn: 330158

6 years ago[PDB] Correctly use the target machine when writing DBI stream.
Zachary Turner [Mon, 16 Apr 2018 20:42:06 +0000 (20:42 +0000)]
[PDB] Correctly use the target machine when writing DBI stream.

Using Config->is64() will treat ARM64 as Amd64, which is incorrect.
Furthermore, there are more esoteric architectures that could
theoretically be encountered.  Just set it directly to the machine
type, which we already know anyway.

llvm-svn: 330157

6 years ago[OPENMP] Allow to use declare target variables in map clauses
Alexey Bataev [Mon, 16 Apr 2018 20:34:41 +0000 (20:34 +0000)]
[OPENMP] Allow to use declare target variables in map clauses

Global variables marked as declare target are allowed to be used in map
clauses. Patch fixes the crash of the compiler on the declare target
variables in map clauses.

llvm-svn: 330156

6 years ago[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
Akira Hatanaka [Mon, 16 Apr 2018 20:23:52 +0000 (20:23 +0000)]
[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
volatile array field is copied.

The crash occurs because method 'visitArray' passes a null FieldDecl to
method 'visit' and some of the methods called downstream expect a
non-null FieldDecl to be passed.

This reapplies r330151 with a fix to the test case.

rdar://problem/33599681

llvm-svn: 330155

6 years ago[OPENMP] General code improvements.
Alexey Bataev [Mon, 16 Apr 2018 20:16:21 +0000 (20:16 +0000)]
[OPENMP] General code improvements.

llvm-svn: 330154

6 years agoRevert "[CodeGen] Fix a crash that occurs when a non-trivial C struct with a"
Akira Hatanaka [Mon, 16 Apr 2018 19:53:59 +0000 (19:53 +0000)]
Revert "[CodeGen] Fix a crash that occurs when a non-trivial C struct with a"

This reverts commit r330151, which caused bots to fail.

llvm-svn: 330153

6 years agoUse export_as for autolinking frameworks
Bruno Cardoso Lopes [Mon, 16 Apr 2018 19:42:32 +0000 (19:42 +0000)]
Use export_as for autolinking frameworks

framework module SomeKitCore {
  ...
  export_as SomeKit
}

Given the module above, while generting autolink information during
codegen, clang should to emit '-framework SomeKitCore' only if SomeKit
was not imported in the relevant TU, otherwise it should use '-framework
SomeKit' instead.

rdar://problem/38269782

llvm-svn: 330152

6 years ago[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
Akira Hatanaka [Mon, 16 Apr 2018 19:38:00 +0000 (19:38 +0000)]
[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
volatile array field is copied.

The crash occurs because method 'visitArray' passes a null FieldDecl to
method 'visit' and some of the methods called downstream expect a
non-null FieldDecl to be passed.

rdar://problem/33599681

llvm-svn: 330151

6 years ago[Hexagon] Emit a warning when -fvectorize is given without -mhvx
Krzysztof Parzyszek [Mon, 16 Apr 2018 19:11:17 +0000 (19:11 +0000)]
[Hexagon] Emit a warning when -fvectorize is given without -mhvx

llvm-svn: 330150

6 years ago[lldb-private] Mark a function as inline to prevent multiple def errors.
Davide Italiano [Mon, 16 Apr 2018 19:07:14 +0000 (19:07 +0000)]
[lldb-private] Mark a function as inline to prevent multiple def errors.

llvm-svn: 330149

6 years ago[RISCV] Fix assert message operator
Mandeep Singh Grang [Mon, 16 Apr 2018 18:56:10 +0000 (18:56 +0000)]
[RISCV] Fix assert message operator

Summary:
Specifying assert message with an || operator makes the compiler interpret it
 as a bool. Changed it to &&.

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, llvm-commits

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

llvm-svn: 330148

6 years ago[Statistics] Move GetStatDescription to an header file.
Davide Italiano [Mon, 16 Apr 2018 18:25:57 +0000 (18:25 +0000)]
[Statistics] Move GetStatDescription to an header file.

In preparation for using it in the API.

<rdar://problem/36555975>

llvm-svn: 330147

6 years ago[sanitizer] Fix OSX build failure post D45457
Kostya Kortchinsky [Mon, 16 Apr 2018 18:17:22 +0000 (18:17 +0000)]
[sanitizer] Fix OSX build failure post D45457

Summary:
It looks like OSX's UBSan needs a "NoHooks" version of
`RTSanitizerCommonSymbolizer` to work build properly.

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

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

llvm-svn: 330146

6 years agoResubmit "Fix some incorrect fields in our generated PDBs."
Zachary Turner [Mon, 16 Apr 2018 18:17:13 +0000 (18:17 +0000)]
Resubmit "Fix some incorrect fields in our generated PDBs."

This fixes the failing tests.  They simply hadn't been updated
to match the new output resulting from this patch.

llvm-svn: 330145

6 years ago[X86] Remove unnecessary -mattr to enable avx512bw when the -mcpu already enabled...
Craig Topper [Mon, 16 Apr 2018 18:14:19 +0000 (18:14 +0000)]
[X86] Remove unnecessary -mattr to enable avx512bw when the -mcpu already enabled it. NFC

This makes the test similar to the arith-sub.ll and arith-mul.ll tests.

llvm-svn: 330144

6 years ago[SLP] Use getExtractWithExtendCost() to compute the scalar cost of extractelement...
Haicheng Wu [Mon, 16 Apr 2018 18:09:49 +0000 (18:09 +0000)]
[SLP] Use getExtractWithExtendCost() to compute the scalar cost of extractelement/ext pair

We use getExtractWithExtendCost to calculate the cost of extractelement and
s|zext together when computing the extract cost after vectorization, but we
calculate the cost of extractelement and s|zext separately when computing the
scalar cost which is larger than it should be.

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

llvm-svn: 330143

6 years ago[ORC] Add a MaterializationResponsibility class to track responsibility for
Lang Hames [Mon, 16 Apr 2018 18:05:24 +0000 (18:05 +0000)]
[ORC] Add a MaterializationResponsibility class to track responsibility for
materializing function definitions.

MaterializationUnit instances are responsible for resolving and finalizing
symbol definitions when their materialize method is called. By contract, the
MaterializationUnit must materialize all definitions it is responsible for and
no others. If it can not materialize all definitions (because of some error)
then it must notify the associated VSO about each definition that could not be
materialized. The MaterializationResponsibility class tracks this
responsibility, asserting that all required symbols are resolved and finalized,
and that no extraneous symbols are resolved or finalized. In the event of an
error it provides a convenience method for notifying the VSO about each
definition that could not be materialized.

llvm-svn: 330142

6 years ago[ORC] Merge VSO notifyResolutionFailed and notifyFinalizationFailed in to
Lang Hames [Mon, 16 Apr 2018 18:05:22 +0000 (18:05 +0000)]
[ORC] Merge VSO notifyResolutionFailed and notifyFinalizationFailed in to
notifyMaterializationFailed.

The notifyMaterializationFailed method can determine which error to raise by
looking at which queue the pending queries are in (resolution or finalization).

llvm-svn: 330141

6 years ago[OPENMP] General code improvements.
Alexey Bataev [Mon, 16 Apr 2018 17:59:34 +0000 (17:59 +0000)]
[OPENMP] General code improvements.

llvm-svn: 330140

6 years ago[Hexagon] Turn off flag enabling auto-vectorization
Krzysztof Parzyszek [Mon, 16 Apr 2018 17:35:30 +0000 (17:35 +0000)]
[Hexagon] Turn off flag enabling auto-vectorization

It was turned on for testing and was accidentally left on in the commit.

llvm-svn: 330139

6 years ago[NFC] Move verificaiton check for f128 conversion into LowerINT_TO_FP()
Lei Huang [Mon, 16 Apr 2018 17:30:24 +0000 (17:30 +0000)]
[NFC] Move verificaiton check for f128 conversion into LowerINT_TO_FP()

Move veriication check for legal conversions to f128 into LowerINT_TO_FP()
and fix some indentations to match other sections of the code for readability.

llvm-svn: 330138

6 years ago[InstCombine] simplify code in SimplifyAssociativeOrCommutative; NFCI
Sanjay Patel [Mon, 16 Apr 2018 17:15:13 +0000 (17:15 +0000)]
[InstCombine] simplify code in SimplifyAssociativeOrCommutative; NFCI

llvm-svn: 330137

6 years ago[Attributes] Fix a bug in AttributeList::get so it can handle a mix of FunctionIndex...
Craig Topper [Mon, 16 Apr 2018 17:05:01 +0000 (17:05 +0000)]
[Attributes] Fix a bug in AttributeList::get so it can handle a mix of FunctionIndex and ReturnIndex/arg indices at the same time

The code uses the index of the last element in the sorted array to determine the maximum size needed for the vector. But if the last index is a FunctionIndex(~0), attrIdxToArrayIdx will return 0 and the vector will have size 1. If there are any indices before FunctionIndex, those values would return a value larger than 0 from attrIdxToArrayIdx. So in this case we need to look in front of the FunctionIndex to get the true size needed.

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

llvm-svn: 330136

6 years agoRemove faulty assertion in llvm-pdbutil
Adrian McCarthy [Mon, 16 Apr 2018 17:01:18 +0000 (17:01 +0000)]
Remove faulty assertion in llvm-pdbutil

If a class's first data member is an instance of an empty class, then an
assertion in the PrettyClassLayoutGraphicalDumper would fail. The
storage is reserved, but it's not marked as in use.

As far as I understand, it's the assertion that's faulty, so I removed it
and updated the nearby comment.

Found by running llvm-pdbutil against its own PDB, and this assertion would
fail on HashAdjusters, which is a HashTable whose first data member is a
TraitsT, which is a PdbHashTraits<T>, which is an empty struct. (The struct
has a specialization for uint32_t, but that specialization doesn't apply
here because the T is actually ulittle32_t.)

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

llvm-svn: 330135

6 years ago[sanitizer] Build failures fixes post D45457
Kostya Kortchinsky [Mon, 16 Apr 2018 16:58:34 +0000 (16:58 +0000)]
[sanitizer] Build failures fixes post D45457

Summary: Adding a couple missed RTSanitizerCommonSymbolizer in makefiles.

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

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

llvm-svn: 330134

6 years agoRevert "Fix some incorrect fields in our generated PDBs."
Zachary Turner [Mon, 16 Apr 2018 16:55:41 +0000 (16:55 +0000)]
Revert "Fix some incorrect fields in our generated PDBs."

There are a couple of failing tests which slipped under my radar
so I'm reverting this while I attempt to fix.

llvm-svn: 330133

6 years ago[CodeView] Initial support for emitting S_THUNK32 symbols for compiler...
Brock Wyma [Mon, 16 Apr 2018 16:53:57 +0000 (16:53 +0000)]
[CodeView] Initial support for emitting S_THUNK32 symbols for compiler...

When emitting CodeView debug information, compiler-generated thunk routines
should be emitted using S_THUNK32 symbols instead of S_GPROC32_ID symbols so
Visual Studio can properly step into the user code.  This initial support only
handles standard thunk ordinals.

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

llvm-svn: 330132