platform/upstream/llvm.git
6 years agoReapply r325193
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:37:04 +0000 (02:37 +0000)]
Reapply r325193

llvm-svn: 325203

6 years ago[analyzer] Allow inlining constructors into return values.
Artem Dergachev [Thu, 15 Feb 2018 02:32:32 +0000 (02:32 +0000)]
[analyzer] Allow inlining constructors into return values.

This only affects the cfg-temporary-dtors mode - in this mode we begin inlining
constructors that are constructing function return values. These constructors
have a correct construction context since r324952.

Because temporary destructors are not only never inlined, but also don't have
the correct target region yet, this change is not entirely safe. But this
will be fixed in the subsequent commits, while this stays off behind the
cfg-temporary-dtors flag.

Lifetime extension for return values is still not modeled correctly.

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

llvm-svn: 325202

6 years ago[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.
Artem Dergachev [Thu, 15 Feb 2018 02:30:20 +0000 (02:30 +0000)]
[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.

In CFG, every DeclStmt has exactly one decl, which is always a variable.

It is also pointless to check that the initializer is the constructor because
that's how construction contexts work now.

llvm-svn: 325201

6 years agoRevert r325193 as it breaks buildbots
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:27:45 +0000 (02:27 +0000)]
Revert r325193 as it breaks buildbots

llvm-svn: 325200

6 years agoAdd new interceptor: lstat(2)
Kamil Rytarowski [Thu, 15 Feb 2018 02:17:06 +0000 (02:17 +0000)]
Add new interceptor: lstat(2)

Summary:
lstat - get file status

Use it on NetBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325199

6 years ago[X86] Regnerate test to show scheduling comments. NFC
Craig Topper [Thu, 15 Feb 2018 02:14:20 +0000 (02:14 +0000)]
[X86] Regnerate test to show scheduling comments. NFC

These must have not been printing the last time the test was re-generated.

llvm-svn: 325198

6 years ago[X86] Change 32 and 64 bit versions of LSL instruction have a 16-bit memory operand.
Craig Topper [Thu, 15 Feb 2018 01:21:53 +0000 (01:21 +0000)]
[X86] Change 32 and 64 bit versions of LSL instruction have a 16-bit memory operand.

This matches the Intel and AMD documentation and is consistent with the LAR instruction.

llvm-svn: 325197

6 years agoAMDGPU: Enable PIC by default for amdgcn
Konstantin Zhuravlyov [Thu, 15 Feb 2018 01:01:53 +0000 (01:01 +0000)]
AMDGPU: Enable PIC by default for amdgcn

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

llvm-svn: 325196

6 years agoAdd missing definition for class static after r325193.
Richard Smith [Thu, 15 Feb 2018 01:01:06 +0000 (01:01 +0000)]
Add missing definition for class static after r325193.

llvm-svn: 325195

6 years ago[sanitizer] Fix flakiness in the tests
Vitaly Buka [Thu, 15 Feb 2018 00:40:36 +0000 (00:40 +0000)]
[sanitizer] Fix flakiness in the tests

Seems tests fails if link already exists.
Also removed duplicated part of tests.

llvm-svn: 325194

6 years agoAMDGPU: Cleanup most of the macros
Konstantin Zhuravlyov [Thu, 15 Feb 2018 00:20:26 +0000 (00:20 +0000)]
AMDGPU: Cleanup most of the macros

- Insert __AMD__ macro
- Insert __AMDGPU__ macro
- Insert __devicename__ macro
- Add missing tests for arch macros

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

llvm-svn: 325193

6 years ago[X86] Dont' allow 'outs' and 'ins' in at&t syntax without suffixes.
Craig Topper [Wed, 14 Feb 2018 23:53:26 +0000 (23:53 +0000)]
[X86] Dont' allow 'outs' and 'ins' in at&t syntax without suffixes.

The match would be ambiguous, but at&t asm parsing doesn't support ambiguous matches and will just return the first.

llvm-svn: 325192

6 years ago[X86] Don't use 64 bit hex constants in a 32 bit assembler test.
Craig Topper [Wed, 14 Feb 2018 23:53:24 +0000 (23:53 +0000)]
[X86] Don't use 64 bit hex constants in a 32 bit assembler test.

llvm-svn: 325191

6 years ago[X86] Reverse the operand order of invlpga in at&t syntax to match gas.
Craig Topper [Wed, 14 Feb 2018 23:53:21 +0000 (23:53 +0000)]
[X86] Reverse the operand order of invlpga in at&t syntax to match gas.

llvm-svn: 325190

6 years ago[llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy
Jake Ehrlich [Wed, 14 Feb 2018 23:31:33 +0000 (23:31 +0000)]
[llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy

Some ELF files produced by lld may have zero-size segment placeholders as shown
below. Since GNU_STACK Offset is 0, the current code makes it the lowest used
offset, and relocates all the segments over the ELF header. The resulting
binary is total garbage.

This change fixes how llvm-objcopy handles PT_PHDR properlly by treating ELF
headers and the program header table as segments to allow the layout algorithm
decide where those should go.

Author: vit9696

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

llvm-svn: 325189

6 years agoSupply missing break in case statement.
Adrian McCarthy [Wed, 14 Feb 2018 23:16:36 +0000 (23:16 +0000)]
Supply missing break in case statement.

Summary:
All the tests pass without hitting the situation mentioned in the FIXME, so,
per Aaron Smith's suggestion, this case will now return unconditionally.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 325188

6 years ago[InstCombine] clean up fold for X / C -> X * (1.0/C); NFCI
Sanjay Patel [Wed, 14 Feb 2018 23:04:17 +0000 (23:04 +0000)]
[InstCombine] clean up fold for X / C -> X * (1.0/C); NFCI

This should work with vector constants too, but it's currently limited to scalar.

llvm-svn: 325187

6 years agoImprove documentation for attribute artificial
Erich Keane [Wed, 14 Feb 2018 23:00:31 +0000 (23:00 +0000)]
Improve documentation for attribute artificial

This patch is related to https://reviews.llvm.org/rC325081

The patch improves documentation for the attribute and removes reference to GCC
documentation.

Patch By: Elizabeth Andrews (eandrews)
Differential Revision: https://reviews.llvm.org/D43321

llvm-svn: 325186

6 years ago[WebAssebmly] Remove use of Optional to fix assertion in gcc
Sam Clegg [Wed, 14 Feb 2018 22:55:38 +0000 (22:55 +0000)]
[WebAssebmly] Remove use of Optional to fix assertion in gcc

This was causing GCC builds with fail with:
Symbols.h:240:3: error: static assertion failed: Symbol types must be
trivially destructible
  static_assert(std::is_trivially_destructible<T>(

The reason this is a gcc-only failure is that OptionalStorage has
as specialization for POD types that isn't built under GCC.

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

llvm-svn: 325185

6 years agoMoved CHECK in test closer to source code
Vitaly Buka [Wed, 14 Feb 2018 22:52:49 +0000 (22:52 +0000)]
Moved CHECK in test closer to source code

llvm-svn: 325184

6 years agoRevert r325158: Convert an assert to a static_assert. NFC.
Rui Ueyama [Wed, 14 Feb 2018 22:43:43 +0000 (22:43 +0000)]
Revert r325158: Convert an assert to a static_assert. NFC.

This reverts commit r325158 because it broke GCC builds.

llvm-svn: 325183

6 years ago[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK
Vitaly Buka [Wed, 14 Feb 2018 22:41:15 +0000 (22:41 +0000)]
[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK

Summary:
TypeID summaries are used by CFI and need to be serialized by ThinLTO
indexing for later use by LTO Backend.

Reviewers: tejohnson, pcc

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

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

llvm-svn: 325182

6 years agoRemove a failing static_assert.
Rui Ueyama [Wed, 14 Feb 2018 22:26:23 +0000 (22:26 +0000)]
Remove a failing static_assert.

This static_assert is legitimate, but it is failing on some build environments.
I'm removing it until it's fixed to unbreak the bots.

llvm-svn: 325181

6 years ago[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
Lang Hames [Wed, 14 Feb 2018 22:13:02 +0000 (22:13 +0000)]
[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
unified GetResources callback.

Having a single 'GetResources' callback will simplify adding new resources in
the future.

llvm-svn: 325180

6 years ago[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.
Lang Hames [Wed, 14 Feb 2018 22:12:56 +0000 (22:12 +0000)]
[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.

Queries need to stay alive until each owner has set the values they are
responsible for.

llvm-svn: 325179

6 years ago[X86] Don't swap argument on BOUND instruction in at&t syntax.
Craig Topper [Wed, 14 Feb 2018 21:54:58 +0000 (21:54 +0000)]
[X86] Don't swap argument on BOUND instruction in at&t syntax.

The bound instruction does not have reversed operands in gas.

Fixes PR27653.

Patch by Maya Madhavan.

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

llvm-svn: 325178

6 years agoChange the BugDriver to store the current module with std::unique_ptr.
Rafael Espindola [Wed, 14 Feb 2018 21:44:34 +0000 (21:44 +0000)]
Change the BugDriver to store the current module with std::unique_ptr.

While there, change a bunch of helper functions to take references to
avoid adding calls to get().

This should conclude the bugpoint yak shaving.

llvm-svn: 325177

6 years agoUse std::uniue_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:25:07 +0000 (21:25 +0000)]
Use std::uniue_ptr. NFC.

llvm-svn: 325176

6 years ago[Debug] Annotate compiler generated range-for loop variables.
Matt Davis [Wed, 14 Feb 2018 21:22:11 +0000 (21:22 +0000)]
[Debug] Annotate compiler generated range-for loop variables.

Summary:
This change aims to simplify debugging by annotating the range-for loop artificial variables (range, begin, end) with the scope depth.

Reviewers: rsmith, dblaikie

Reviewed By: dblaikie

Subscribers: dblaikie, cfe-commits

Tags: #debug-info

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

llvm-svn: 325175

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:17:36 +0000 (21:17 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325174

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:10:29 +0000 (21:10 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325173

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:59:39 +0000 (20:59 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325172

6 years agoClean up -fdiscard-value-name handling
Eric Fiselier [Wed, 14 Feb 2018 20:56:52 +0000 (20:56 +0000)]
Clean up -fdiscard-value-name handling

llvm-svn: 325171

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:53:38 +0000 (20:53 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325170

6 years ago[Hexagon] Split HVX vector pair loads/stores, expand unaligned loads
Krzysztof Parzyszek [Wed, 14 Feb 2018 20:46:06 +0000 (20:46 +0000)]
[Hexagon] Split HVX vector pair loads/stores, expand unaligned loads

llvm-svn: 325169

6 years agoRemoved superfluous semicolon to fix -Wpedantic gcc warning. NFCI.
Simon Pilgrim [Wed, 14 Feb 2018 20:43:47 +0000 (20:43 +0000)]
Removed superfluous semicolon to fix -Wpedantic gcc warning. NFCI.

llvm-svn: 325168

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:25:18 +0000 (20:25 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325167

6 years ago[CodeGen] Print predecessors, successors, then liveins in -debug printing
Francis Visoiu Mistrih [Wed, 14 Feb 2018 20:23:05 +0000 (20:23 +0000)]
[CodeGen] Print predecessors, successors, then liveins in -debug printing

Reorder them to match MIR.

Predecessors are only comments, and they're not usually printed in MIR.

llvm-svn: 325166

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:21:20 +0000 (20:21 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325165

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:13:01 +0000 (20:13 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325164

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:58:41 +0000 (19:58 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325163

6 years agoGlobalISel: Add templated functions and pattern matcher support for some more opcodes
Volkan Keles [Wed, 14 Feb 2018 19:58:36 +0000 (19:58 +0000)]
GlobalISel: Add templated functions and pattern matcher support for some more opcodes

Summary:
This patch adds templated functions to MachineIRBuilder for some opcodes
and adds pattern matcher support for G_AND and G_OR.

Reviewers: aditya_nandakumar

Reviewed By: aditya_nandakumar

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 325162

6 years ago[InstCombine] add tests and comments for fdiv X, C; NFC
Sanjay Patel [Wed, 14 Feb 2018 19:54:51 +0000 (19:54 +0000)]
[InstCombine] add tests and comments for fdiv X, C; NFC

llvm-svn: 325161

6 years agoPass a module reference to CloneModule.
Rafael Espindola [Wed, 14 Feb 2018 19:50:40 +0000 (19:50 +0000)]
Pass a module reference to CloneModule.

It can never be null and most callers were already using references or
std::unique_ptr.

llvm-svn: 325160

6 years ago[clang-format] Recognize percents as format specifiers in protos
Krasimir Georgiev [Wed, 14 Feb 2018 19:47:58 +0000 (19:47 +0000)]
[clang-format] Recognize percents as format specifiers in protos

Summary:
Frequently, a percent in protos denotes a formatting specifier for string replacement.
Thus it is desirable to keep the percent together with what follows after it.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 325159

6 years agoConvert an assert to a static_assert. NFC.
Sam Clegg [Wed, 14 Feb 2018 19:28:46 +0000 (19:28 +0000)]
Convert an assert to a static_assert. NFC.

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

llvm-svn: 325158

6 years agoUpdate examples for API change. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:23:27 +0000 (19:23 +0000)]
Update examples for API change. NFC.

llvm-svn: 325157

6 years agoUpdate for llvm change. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:11:37 +0000 (19:11 +0000)]
Update for llvm change. NFC.

llvm-svn: 325156

6 years agoPass a reference to a module to the bitcode writer.
Rafael Espindola [Wed, 14 Feb 2018 19:11:32 +0000 (19:11 +0000)]
Pass a reference to a module to the bitcode writer.

This simplifies most callers as they are already using references or
std::unique_ptr.

llvm-svn: 325155

6 years ago[Modules] Add more language features to be used with requires-declaration
Bruno Cardoso Lopes [Wed, 14 Feb 2018 19:01:03 +0000 (19:01 +0000)]
[Modules] Add more language features to be used with requires-declaration

Features added: c99, c11, c17, cplusplus14 and cplusplus17.

rdar://problem/36328787
rdar://problem/36668431

llvm-svn: 325154

6 years ago[RegisterClassInfo] Invalidate the register pressure set limit cache when reserved...
Craig Topper [Wed, 14 Feb 2018 18:53:29 +0000 (18:53 +0000)]
[RegisterClassInfo] Invalidate the register pressure set limit cache when reserved regs or callee saved regs change

Previously we only invalidated the pressure set limit cached when the TargetRegisterInfo pointer changes. But as reserved regs and callee saved regs are used as part of calculating the limits we should invalidate when those change too.

I encountered this when reverting a patch from the 6.0 branch. One of the x86 test files had a function that used rbp as a frame pointer, making it reserved. It was followed by another function which didn't use rbp but had the same TRI so the pressure set limit cache was not invalidated. If i removed the function that used rbp as a frame pointer from the file, the remaining function then got a different register pressure limit for the GR16 pressure set. This caused the machine scheduler to change the scheduling for the function. This was an unexpected change from just deleting a function.

I don't have a test case for trunk because the particular x86 test case is different enough from the 6.0 branch to not be affected now.

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

llvm-svn: 325153

6 years agoMake --export-dynamic-symbol to add undefined symbols even if --export-dynamic is...
Rui Ueyama [Wed, 14 Feb 2018 18:38:33 +0000 (18:38 +0000)]
Make --export-dynamic-symbol to add undefined symbols even if --export-dynamic is given.

This patch addresses a minor compatibility issue with GNU linkers.
Previously, --export-dynamic-symbol is completely ignored if you
pass --export-dynamic together.

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

llvm-svn: 325152

6 years agoMove llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC
David Green [Wed, 14 Feb 2018 18:34:53 +0000 (18:34 +0000)]
Move llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC

Move computeLoopSafetyInfo, defined in Transforms/Utils/LoopUtils.h,
into the corresponding LoopUtils.cpp, as opposed to LICM where it resides
at the moment. This will allow other functions from Transforms/Utils
to reference it.

llvm-svn: 325151

6 years ago[WebAssembly] Use a Symbol class heirarchy. NFC.
Sam Clegg [Wed, 14 Feb 2018 18:27:59 +0000 (18:27 +0000)]
[WebAssembly] Use a Symbol class heirarchy. NFC.

This brings wasm into line with ELF and COFF in terms of
symbol types are represented.

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

llvm-svn: 325150

6 years ago[X86][SSE] truncateVectorWithPACK - Use src type instead of dst to select between...
Simon Pilgrim [Wed, 14 Feb 2018 18:23:58 +0000 (18:23 +0000)]
[X86][SSE] truncateVectorWithPACK - Use src type instead of dst to select between PACK*SDW/PACK*SWB

Try to keep PACK*SDW/PACK*SWB as wide as possible, this helps ComputeNumSignBits as it can only peek through bitcasts to wider types, pre-AVX2 codegen was already doing this as it could peek through bitcasts/subvectors more easily than AVX2 could through shuffles.

This shouldn't affect existing results as calls to truncateVectorWithPACK ensure we have enough sign bits to pack to the same value, but it should make it possible to use truncateVectorWithPACK chains to perform saturation in combineTruncateWithSat with a future patch.

llvm-svn: 325149

6 years ago[InstCombine] Don't fold select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z,...
Craig Topper [Wed, 14 Feb 2018 18:08:33 +0000 (18:08 +0000)]
[InstCombine] Don't fold select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z, binop(Y, W)) if the binop is rem or div.

The select may have been preventing a division by zero or INT_MIN/-1 so removing it might not be safe.

Fixes PR36362.

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

llvm-svn: 325148

6 years agoAdd a catch for std::length_error for the case where the string can't handle 2GB...
Marshall Clow [Wed, 14 Feb 2018 18:05:25 +0000 (18:05 +0000)]
Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian)

llvm-svn: 325147

6 years ago[AMDGPU] Remove non-temporal flag from argument loads
Stanislav Mekhanoshin [Wed, 14 Feb 2018 18:05:14 +0000 (18:05 +0000)]
[AMDGPU] Remove non-temporal flag from argument loads

Kernel arguments likely read by all workitems and should not bypass
cache. Fixes performance hit in sub-dword argument loads.

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

llvm-svn: 325146

6 years ago[OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny
Alexey Bataev [Wed, 14 Feb 2018 17:38:47 +0000 (17:38 +0000)]
[OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny

Summary:
-ast-print prints omp pragmas with a trailing space.  While this
behavior is likely of little concern to most users, surely it's
unintentional, and it's annoying for some source-level work I'm
pursuing.  This patch focuses on omp pragmas, but it also fixes
init_seg and loop hint pragmas because they share implementation.

The testing strategy here is to add usually just one '{{$}}' per
relevant -ast-print test file.  This seems to achieve good code
coverage.  However, this strategy is probably easy to forget as the
tests evolve.  That's probably fine as this fix is far from critical.
The main goal of the testing is to aid the initial review.

This patch also adds a fixme for "#pragma unroll", which prints as
"#pragma unroll (enable)", which is invalid syntax.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

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

llvm-svn: 325145

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Wed, 14 Feb 2018 17:37:32 +0000 (17:37 +0000)]
[InstCombine] regenerate checks; NFC

llvm-svn: 325144

6 years ago[DWARF] Fix incorrect prologue end line record.
Paul Robinson [Wed, 14 Feb 2018 17:35:52 +0000 (17:35 +0000)]
[DWARF] Fix incorrect prologue end line record.

The prologue-end line record must be emitted after the last
instruction that is part of the function frame setup code and before
the instruction that marks the beginning of the function body.

Patch by Carlos Alberto Enciso!

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

llvm-svn: 325143

6 years ago[InstCombine] simplify isFMulOrFDivWithConstant(); NFCI
Sanjay Patel [Wed, 14 Feb 2018 17:16:33 +0000 (17:16 +0000)]
[InstCombine] simplify isFMulOrFDivWithConstant(); NFCI

llvm-svn: 325142

6 years ago[InstCombine] replace isa/cast with dyn_cast; NFC
Sanjay Patel [Wed, 14 Feb 2018 16:56:44 +0000 (16:56 +0000)]
[InstCombine] replace isa/cast with dyn_cast; NFC

llvm-svn: 325141

6 years ago[InstCombine] refactor folds for mul with negated operands; NFCI
Sanjay Patel [Wed, 14 Feb 2018 16:50:55 +0000 (16:50 +0000)]
[InstCombine] refactor folds for mul with negated operands; NFCI

This keeps with our current usage of 'match' and is easier to see that
the optional NSW only applies in the non-constant operand case.

llvm-svn: 325140

6 years agoStore defined macros in MCContext.
Rafael Espindola [Wed, 14 Feb 2018 16:34:27 +0000 (16:34 +0000)]
Store defined macros in MCContext.

So that macros defined in inline assembly blocks are available to the
whole file.

This provides a consistent behavior with other assembly directives,
since equations for example are already preserved between inline
assembly blocks.

PR: 36110

Patch by Roger!

llvm-svn: 325139

6 years ago[x86] add baseline vector compare tests for D42948; NFC
Sanjay Patel [Wed, 14 Feb 2018 16:15:15 +0000 (16:15 +0000)]
[x86] add baseline vector compare tests for D42948; NFC

llvm-svn: 325138

6 years agoRemove vestigial remnants of the test crash info hook
Pavel Labath [Wed, 14 Feb 2018 16:08:26 +0000 (16:08 +0000)]
Remove vestigial remnants of the test crash info hook

llvm-svn: 325137

6 years ago[CUDA] Allow external variables in separate compilation
Jonas Hahnfeld [Wed, 14 Feb 2018 16:04:03 +0000 (16:04 +0000)]
[CUDA] Allow external variables in separate compilation

According to the CUDA Programming Guide this is prohibited in
whole program compilation mode. This makes sense because external
references cannot be satisfied in that mode anyway. However,
such variables are allowed in separate compilation mode which
is a valid use case.

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

llvm-svn: 325136

6 years ago[SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV
Alexander Ivchenko [Wed, 14 Feb 2018 15:55:24 +0000 (15:55 +0000)]
[SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV

When creating high MachineMemOperand for MSTORE/MLOAD we supply
it with the original PointerInfo, while the pointer itself had been incremented.
The patch adds the proper offset to the PointerInfo.

llvm-svn: 325135

6 years ago[SLP] Allow vectorization of reversed loads.
Alexey Bataev [Wed, 14 Feb 2018 15:29:15 +0000 (15:29 +0000)]
[SLP] Allow vectorization of reversed loads.

Summary:
Reversed loads are handled as gathering. But we can just reshuffle
these values. Patch adds support for vectorization of reversed loads.

Reviewers: RKSimon, spatel, mkuper, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 325134

6 years agoRevert r324991 "Fix for PR32992. Static const classes not exported."
Hans Wennborg [Wed, 14 Feb 2018 15:19:46 +0000 (15:19 +0000)]
Revert r324991 "Fix for PR32992. Static const classes not exported."

This broke the Chromium build on Windows; see https://crbug.com/812231

> Fix for PR32992. Static const classes not exported.
>
> Patch by zahiraam!
>
> Differential Revision: https://reviews.llvm.org/D42968

llvm-svn: 325133

6 years ago[clangd] Fix data race in ClangdThreadingTest.StressTest
Ilya Biryukov [Wed, 14 Feb 2018 15:19:20 +0000 (15:19 +0000)]
[clangd] Fix data race in ClangdThreadingTest.StressTest

Prior to this patch, same instance of VFS was shared for concurrent
processing of the files in ClangdThreadingTest.StressTest.

It caused a data race as the same instance of InMemoryFileSystem was
mutated from multiple threads using setCurrentWorkingDirectory().

llvm-svn: 325132

6 years ago[OMPT][test] Correct warning about added wrapper functions
Jonas Hahnfeld [Wed, 14 Feb 2018 15:15:24 +0000 (15:15 +0000)]
[OMPT][test] Correct warning about added wrapper functions

This affects all outlined functions, not just tasks! Only show warning
when using Clang 5.0 or later.

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

llvm-svn: 325131

6 years ago[ARM] f16 stack spill/reloads
Sjoerd Meijer [Wed, 14 Feb 2018 15:09:09 +0000 (15:09 +0000)]
[ARM] f16 stack spill/reloads

This adds support for handling f16 stack spills/reloads.

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

llvm-svn: 325130

6 years agoFix GCC -Wlogical-op-parentheses warning. NFCI.
Simon Pilgrim [Wed, 14 Feb 2018 15:07:36 +0000 (15:07 +0000)]
Fix GCC -Wlogical-op-parentheses warning. NFCI.

llvm-svn: 325129

6 years ago[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346
Lama Saba [Wed, 14 Feb 2018 14:58:53 +0000 (14:58 +0000)]
[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346

If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Change-Id: Ic41aa9ade6512e0478db66e07e2fde41b4fb35f9
llvm-svn: 325128

6 years ago[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation
Simon Pilgrim [Wed, 14 Feb 2018 14:14:29 +0000 (14:14 +0000)]
[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation

While the AVX512 VTRUNCS/VTRUNCUS instructions require legal types, truncateVectorWithPACK handles cases with multiples of legal types through splitting/concatenation. So we just need to ensure that the src/dst scalar types are correct and leave truncateVectorWithPACK to handle the rest of it.

llvm-svn: 325127

6 years agoRecommit r325001: [CallSiteSplitting] Support splitting of blocks with instrs before...
Florian Hahn [Wed, 14 Feb 2018 13:59:12 +0000 (13:59 +0000)]
Recommit r325001: [CallSiteSplitting] Support splitting of blocks with instrs before call.

For basic blocks with instructions between the beginning of the block
and a call we have to duplicate the instructions before the call in all
split blocks and add PHI nodes for uses of the duplicated instructions
after the call.

Currently, the threshold for the number of instructions before a call
is quite low, to keep the impact on binary size low.

Reviewers: junbuml, mcrosier, davidxl, davide

Reviewed By: junbuml

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

llvm-svn: 325126

6 years ago[ELF] Add warnings for various symbols that cannot be ordered
James Henderson [Wed, 14 Feb 2018 13:36:22 +0000 (13:36 +0000)]
[ELF] Add warnings for various symbols that cannot be ordered

There are a number of different situations when symbols are requested
to be ordered in the --symbol-ordering-file that cannot be ordered for
some reason. To assist with identifying these symbols, and either
tidying up the order file, or the inputs, a number of warnings have
been added. As some users may find these warnings unhelpful, due to how
they use the symbol ordering file, a switch has also been added to
disable these warnings.

The cases where we now warn are:

 * Entries in the order file that don't correspond to any symbol in the input
 * Undefined symbols
 * Absolute symbols
 * Symbols imported from shared objects
 * Symbols that are discarded, due to e.g. --gc-sections or /DISCARD/ linker script sections
 * Multiple of the same entry in the order file

Reviewed by: rafael, ruiu

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

llvm-svn: 325125

6 years agoAdd make targets for running all lld tests
Nicholas Wilson [Wed, 14 Feb 2018 13:28:53 +0000 (13:28 +0000)]
Add make targets for running all lld tests

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

llvm-svn: 325124

6 years ago[AST] Fix passing large-array-init.cpp on builds without asserts
Ivan A. Kosarev [Wed, 14 Feb 2018 13:27:48 +0000 (13:27 +0000)]
[AST] Fix passing large-array-init.cpp on builds without asserts

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

llvm-svn: 325123

6 years ago[LoopInterchange] Incrementally update the dominator tree.
Florian Hahn [Wed, 14 Feb 2018 13:13:15 +0000 (13:13 +0000)]
[LoopInterchange] Incrementally update the dominator tree.

We can use incremental dominator tree updates to avoid re-calculating
the dominator tree after interchanging 2 loops.

Reviewers: dmgreen, kuhar

Reviewed By: kuhar

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

llvm-svn: 325122

6 years agoUse EXPECT_FALSE instead of EXPECT_EQ(false, ...
Momchil Velikov [Wed, 14 Feb 2018 13:11:56 +0000 (13:11 +0000)]
Use EXPECT_FALSE instead of EXPECT_EQ(false, ...

Commit https://reviews.llvm.org/rL324489 added

    EXPECT_EQ(false, N->isUnsigned());

which older GCC versions dislike for some reason. Anyway, it looks like the
proper GTest way is to use EXPECT_FALSE, etc.

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

llvm-svn: 325121

6 years ago[AST] Refine the condition for element-dependent array fillers
Ivan A. Kosarev [Wed, 14 Feb 2018 13:10:35 +0000 (13:10 +0000)]
[AST] Refine the condition for element-dependent array fillers

This patch fixes clang to not consider braced initializers for
aggregate elements of arrays to be potentially dependent on the
indices of the initialized elements. Resolves bug 18978:
initialize a large static array = clang oom?
https://bugs.llvm.org/show_bug.cgi?id=18978

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

llvm-svn: 325120

6 years ago[Utils] Salvage the debug info of DCE'ed 'and' instructions
Petar Jovanovic [Wed, 14 Feb 2018 13:10:35 +0000 (13:10 +0000)]
[Utils] Salvage the debug info of DCE'ed 'and' instructions

Preserve debug info from a dead 'and' instruction with a constant.

Patch by Djordje Todorovic.

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

llvm-svn: 325119

6 years agoQuick fix for 325116 buildbots: move template specialization into namespace
Aleksei Sidorin [Wed, 14 Feb 2018 11:39:33 +0000 (11:39 +0000)]
Quick fix for 325116 buildbots: move template specialization into namespace

llvm-svn: 325118

6 years ago[Sema] Fix decltype of static data members
Mikhail Maltsev [Wed, 14 Feb 2018 11:34:25 +0000 (11:34 +0000)]
[Sema] Fix decltype of static data members

Summary:
According to the C++11 standard [dcl.type.simple]p4:
  The type denoted by decltype(e) is defined as follows:
  - if e is an unparenthesized id-expression or an unparenthesized
    class member access (5.2.5), decltype(e) is the type of the entity
    named by e.

Currently Clang handles the 'member access' case incorrectly for
static data members (decltype returns T& instead of T). This patch
fixes the issue.

Reviewers: faisalv, rsmith, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, cfe-commits

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

llvm-svn: 325117

6 years ago[ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl
Aleksei Sidorin [Wed, 14 Feb 2018 11:18:00 +0000 (11:18 +0000)]
[ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl

Also minor refactoring in related functions was done.

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

llvm-svn: 325116

6 years agoRevert r325107 (case folding DJB hash) and subsequent build fix
Pavel Labath [Wed, 14 Feb 2018 11:06:39 +0000 (11:06 +0000)]
Revert r325107 (case folding DJB hash) and subsequent build fix

The "knownValuesUnicode" test in the patch fails on ppc64 and arm64
bots. Reverting while I investigate.

llvm-svn: 325115

6 years ago[clangd] Explicitly initialize all primitive fields in Protocol.h
Ilya Biryukov [Wed, 14 Feb 2018 10:52:04 +0000 (10:52 +0000)]
[clangd] Explicitly initialize all primitive fields in Protocol.h

Summary:
Some of the existing structs had primimtive fields that were
not explicitly initialized on construction.
After this commit every struct consistently sets a defined value for
every field when default-initialized.

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits, jkorous-apple

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

llvm-svn: 325113

6 years ago[IRMover] Move type name extraction to a separate function. NFC
Eugene Leviant [Wed, 14 Feb 2018 10:32:47 +0000 (10:32 +0000)]
[IRMover] Move type name extraction to a separate function. NFC

llvm-svn: 325110

6 years agoFix build broken by r325107
Pavel Labath [Wed, 14 Feb 2018 10:25:32 +0000 (10:25 +0000)]
Fix build broken by r325107

Older gcc versions need an extra pair of {}s to convert a string literal
into llvm::StringLiteral.

llvm-svn: 325109

6 years agoImplement a case-folding version of DJB hash
Pavel Labath [Wed, 14 Feb 2018 10:05:09 +0000 (10:05 +0000)]
Implement a case-folding version of DJB hash

Summary:
This patch implements a variant of the DJB hash function which folds the
input according to the algorithm in the Dwarf 5 specification (Section
6.1.1.4.5), which in turn references the Unicode Standard (Section 5.18,
"Case Mappings").

To achieve this, I have added a llvm::sys::unicode::foldCharSimple
function, which performs this mapping. The implementation of this
function was generated from the CaseMatching.txt file from the Unicode
spec using a python script (which is also included in this patch). The
script tries to optimize the function by coalescing adjecant mappings
with the same shift and stride (terms I made up). Theoretically, it
could be made a bit smarter and merge adjecant blocks that were
interrupted by only one or two characters with exceptional mapping, but
this would save only a couple of branches, while it would greatly
complicate the implementation, so I deemed it was not worth it.

Since we assume that the vast majority of the input characters will be
US-ASCII, the folding hash function has a fast-path for handling these,
and only whips out the full decode+fold+encode logic if we encounter a
character outside of this range. It might be possible to implement the
folding directly on utf8 sequences, but this would also bring a lot of
complexity for the few cases where we will actually need to process
non-ascii characters.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: mgorny, hintonda, echristo, clayborg, vleschuk, llvm-commits

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

llvm-svn: 325107

6 years agoTest commit access
Henry Wong [Wed, 14 Feb 2018 07:32:27 +0000 (07:32 +0000)]
Test commit access

llvm-svn: 325103

6 years agoAdding a width of the GEP index to the Data Layout.
Elena Demikhovsky [Wed, 14 Feb 2018 06:58:08 +0000 (06:58 +0000)]
Adding a width of the GEP index to the Data Layout.

Making a width of GEP Index, which is used for address calculation, to be one of the pointer properties in the Data Layout.
p[address space]:size:memory_size:alignment:pref_alignment:index_size_in_bits.
The index size parameter is optional, if not specified, it is equal to the pointer size.

Till now, the InstCombiner normalized GEPs and extended the Index operand to the pointer width.
It works fine if you can convert pointer to integer for address calculation and all registered targets do this.
But some ISAs have very restricted instruction set for the pointer calculation. During discussions were desided to retrieve information for GEP index from the Data Layout.
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120416.html

I added an interface to the Data Layout and I changed the InstCombiner and some other passes to take the Index width into account.
This change does not affect any in-tree target. I added tests to cover data layouts with explicitly specified index size.

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

llvm-svn: 325102

6 years ago[SelectionDAG] Remove duplicate code from TargetLowering::SimplifySetCC.
Craig Topper [Wed, 14 Feb 2018 06:51:57 +0000 (06:51 +0000)]
[SelectionDAG] Remove duplicate code from TargetLowering::SimplifySetCC.

This exact code already exists a little further up.

llvm-svn: 325101

6 years agoUse delete[] instead of free
Serge Pavlov [Wed, 14 Feb 2018 06:14:30 +0000 (06:14 +0000)]
Use delete[] instead of free

llvm-svn: 325100

6 years agoUse delete[] to deallocate array of chars
Serge Pavlov [Wed, 14 Feb 2018 05:14:31 +0000 (05:14 +0000)]
Use delete[] to deallocate array of chars

llvm-svn: 325099

6 years agoRefactor DisassembleInfo in MachODump.cpp
Serge Pavlov [Wed, 14 Feb 2018 03:26:27 +0000 (03:26 +0000)]
Refactor DisassembleInfo in MachODump.cpp

The change implements constructor of DisassembleInfo to avoid duplication
of initialization code and gets rid of malloc/free where possible.

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

llvm-svn: 325098

6 years ago[clangd] Configure clangd tracing with CLANGD_TRACE env instead of -trace flag
Sam McCall [Wed, 14 Feb 2018 03:20:07 +0000 (03:20 +0000)]
[clangd] Configure clangd tracing with CLANGD_TRACE env instead of -trace flag

llvm-svn: 325097