platform/upstream/llvm.git
6 years ago[DAG] add convenience function to propagate FMF; NFC
Sanjay Patel [Fri, 11 May 2018 23:13:36 +0000 (23:13 +0000)]
[DAG] add convenience function to propagate FMF; NFC

There's only one use of this currently, but that could
change with D46563. Either way, we shouldn't have to
update code outside of the flags struct when those
flag definitions change.

llvm-svn: 332155

6 years agoAMDGPU/GlobalISel: Implement select() for >32-bit G_STORE
Tom Stellard [Fri, 11 May 2018 23:12:49 +0000 (23:12 +0000)]
AMDGPU/GlobalISel: Implement select() for >32-bit G_STORE

Reviewers: arsenm, nhaehnle

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

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

llvm-svn: 332154

6 years ago[MemorySSA] getIncomingValueForBlock should return a MemoryAccess.
Alina Sbirlea [Fri, 11 May 2018 22:59:37 +0000 (22:59 +0000)]
[MemorySSA] getIncomingValueForBlock should return a MemoryAccess.

Summary: getIncomingValueForBlock is just a wrapper API that should return a MemoryAccess, instead of a generic Value.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 332153

6 years ago[clang-tidy] Fixing fuchsia-restrict-includes-headers test
Julie Hockett [Fri, 11 May 2018 22:58:45 +0000 (22:58 +0000)]
[clang-tidy] Fixing fuchsia-restrict-includes-headers test

Removing filepaths so windows tests pass.

llvm-svn: 332152

6 years ago[CodeExtractor] Allow extracting blocks with exception handling
Sergey Dmitriev [Fri, 11 May 2018 22:49:49 +0000 (22:49 +0000)]
[CodeExtractor] Allow extracting blocks with exception handling

This is a CodeExtractor improvement which adds support for extracting blocks
which have exception handling constructs if that is legal to do. CodeExtractor
performs validation checks to ensure that extraction is legal when it finds
invoke instructions or EH pads (landingpad, catchswitch, or cleanuppad) in
blocks to be extracted.

I have also added an option to allow extraction of blocks with alloca
instructions, but no validation is done for allocas. CodeExtractor caller has
to validate it himself before allowing alloca instructions to be extracted.
By default allocas are still not allowed in extraction blocks.

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

llvm-svn: 332151

6 years ago[DAG] clean up flag propagation for binops; NFCI
Sanjay Patel [Fri, 11 May 2018 22:45:22 +0000 (22:45 +0000)]
[DAG] clean up flag propagation for binops; NFCI

llvm-svn: 332150

6 years agoCOFF: Add a flag for disabling string tail merging.
Peter Collingbourne [Fri, 11 May 2018 22:21:36 +0000 (22:21 +0000)]
COFF: Add a flag for disabling string tail merging.

We discovered (crbug.com/838449#c24) that string tail merging can
negatively affect compressed binary size, so provide a flag to turn
it off for users who care more about compressed size than uncompressed
size.

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

llvm-svn: 332149

6 years agoOverhaul unicode handling in xunit output
Chris Matthews [Fri, 11 May 2018 22:18:22 +0000 (22:18 +0000)]
Overhaul unicode handling in xunit output

I have seen a lot of errors where the xunit does not encode unicode
test output correctly.  Handle that explicitly now.

llvm-svn: 332148

6 years agoAMDGPU/SI: Don't promote alloca to vector for AddrSpaceCast instruction.
Changpeng Fang [Fri, 11 May 2018 22:17:57 +0000 (22:17 +0000)]
AMDGPU/SI: Don't promote alloca to vector for AddrSpaceCast instruction.

Summary:
  We have no logic to promote alloca to vector for an AddrSpaceCast instruction.

Reviewer:
  arsenm

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

llvm-svn: 332147

6 years ago[X86] Remove and autoupgrade a bunch of FMA instrinsics that are no longer used by...
Craig Topper [Fri, 11 May 2018 21:59:34 +0000 (21:59 +0000)]
[X86] Remove and autoupgrade a bunch of FMA instrinsics that are no longer used by clang.

llvm-svn: 332146

6 years ago[libFuzzer] [NFC] Split fuzzer.test into smaller tests
George Karpenkov [Fri, 11 May 2018 21:29:53 +0000 (21:29 +0000)]
[libFuzzer] [NFC] Split fuzzer.test into smaller tests

Keeping fuzzer.test together as a gigantic test has no advantages and multiple disadvantages:

 - Worse test parallelization (fuzzer.test is always blocking the test
run on a machine with many cores)
 - Debugging test failures is made more difficult (not clear what fails
from fuzzer.test failing)
 - Makes porting tests to new platforms more difficult (whenever
fuzzer.test fails have to inspect the output to figure out what is going
on, and then restart all of it)
 - Hides dead code (in our case, "Done1000000" FileCheck variable was
never used, DISABLED: not %t-UninstrumentedTest-Uninstrumented was never
compiled, and there was small amount of duplication vs. simple-cmp.test)
 - Makes correspondence between LIT .test files and .cpp files less
straightforward

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

llvm-svn: 332145

6 years ago[libFuzzer] [NFC] Prefix all run lines with %run
George Karpenkov [Fri, 11 May 2018 21:29:51 +0000 (21:29 +0000)]
[libFuzzer] [NFC] Prefix all run lines with %run

This patch does not do anything, but paves the way for future changes,
where %run command will be expanded into a script performing the testing
on device.

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

llvm-svn: 332144

6 years ago[clang-tidy] Cleaning up test output (fuchsia-restrict-system-includes)
Julie Hockett [Fri, 11 May 2018 21:28:34 +0000 (21:28 +0000)]
[clang-tidy] Cleaning up test output (fuchsia-restrict-system-includes)

This should fix the break in the fuchsia-restrict-system-includes-headers
test.

llvm-svn: 332143

6 years ago[Split GEP] handle trunc() in separate-const-offset-from-gep pass.
Artem Belevich [Fri, 11 May 2018 21:13:19 +0000 (21:13 +0000)]
[Split GEP] handle trunc() in separate-const-offset-from-gep pass.

Let separate-const-offset-from-gep pass handle trunc() when it calculates
constant offset relative to base. The pass itself may insert trunc()
instructions when it canonicalises array indices to pointer-size integers
and needs to handle trunc() in order to evaluate the offset.

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

llvm-svn: 332142

6 years agoReland "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"
Julie Hockett [Fri, 11 May 2018 21:08:59 +0000 (21:08 +0000)]
Reland "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"

This relands r332125 with a fixed test.

llvm-svn: 332141

6 years agoConditionally compile a Darwin-only test.
Adrian Prantl [Fri, 11 May 2018 21:05:32 +0000 (21:05 +0000)]
Conditionally compile a Darwin-only test.

llvm-svn: 332140

6 years agoUpdate input file in test
Rumeet Dhindsa [Fri, 11 May 2018 20:50:27 +0000 (20:50 +0000)]
Update input file in test

llvm-svn: 332139

6 years ago[Driver] Only use -lc++ on Fuchsia
Petr Hosek [Fri, 11 May 2018 20:42:31 +0000 (20:42 +0000)]
[Driver] Only use -lc++ on Fuchsia

The fact that libc++ depends on libc++abi and libunwind is an internal
detail that's captured by the libc++.so linker script.

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

llvm-svn: 332138

6 years ago[AMDGPU] Fix compilation failure when IR contains comdat
Yaxun Liu [Fri, 11 May 2018 20:40:14 +0000 (20:40 +0000)]
[AMDGPU] Fix compilation failure when IR contains comdat

Remove a useless SwitchSection which also causes compilation failure
when IR contains comdat.

The SwitchSection is useless because the current section is already
correct text section for the function therefore no need to switch.

It causes compilation failure for comdat because functions with comdat
has specific text section, not the default .text section.

Since HIP uses comdat, this bug caused failures for HIP.

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

llvm-svn: 332137

6 years ago[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker
George Karpenkov [Fri, 11 May 2018 20:39:19 +0000 (20:39 +0000)]
[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker

llvm-svn: 332136

6 years ago[analyzer] Fix the filename for the exploration_order test.
George Karpenkov [Fri, 11 May 2018 20:38:39 +0000 (20:38 +0000)]
[analyzer] Fix the filename for the exploration_order test.

Ensures that the test is being run.

llvm-svn: 332135

6 years agoUpdate test to not check for output file
Rumeet Dhindsa [Fri, 11 May 2018 20:28:45 +0000 (20:28 +0000)]
Update test to not check for output file

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

llvm-svn: 332134

6 years ago[DAG] reduce code duplication; NFCI
Sanjay Patel [Fri, 11 May 2018 20:08:23 +0000 (20:08 +0000)]
[DAG] reduce code duplication; NFCI

llvm-svn: 332133

6 years ago[InstCombine] Handle atomic memset in the same way as regular memset
Daniel Neilson [Fri, 11 May 2018 20:04:50 +0000 (20:04 +0000)]
[InstCombine] Handle atomic memset in the same way as regular memset

Summary:
This change adds handling of the atomic memset intrinsic to the
code path that simplifies the regular memset. In practice this means
that we will now also expand a small constant-length atomic memset
into a single unordered atomic store.

Reviewers: apilipenko, skatkov, mkazantsev, anna, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

llvm-svn: 332132

6 years agoRevert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"
Julie Hockett [Fri, 11 May 2018 20:03:22 +0000 (20:03 +0000)]
Revert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"

This reverts commit r332125 for a failing test.

llvm-svn: 332131

6 years ago[libclang] Stop assuming that the internal C++ ABI ExceptionSpecificationType enumera...
Richard Smith [Fri, 11 May 2018 19:46:31 +0000 (19:46 +0000)]
[libclang] Stop assuming that the internal C++ ABI ExceptionSpecificationType enumeration is the same as CXCursor_ExceptionSpecificationKind.

llvm-svn: 332130

6 years ago[OPENMP, NVPTX] Do not use SPMD mode for target simd and target teams
Alexey Bataev [Fri, 11 May 2018 19:45:14 +0000 (19:45 +0000)]
[OPENMP, NVPTX] Do not use SPMD mode for target simd and target teams
distribute simd directives.

Directives `target simd` and `target teams distribute simd` must be
executed in non-SPMD mode.

llvm-svn: 332129

6 years agoSplitting thinlto.ll test file and renaming other test files.
Rumeet Dhindsa [Fri, 11 May 2018 19:37:08 +0000 (19:37 +0000)]
Splitting thinlto.ll test file and renaming other test files.

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

llvm-svn: 332128

6 years ago[PPC64] isRelExpr should return true for the PPC Call Exprs.
Sean Fertile [Fri, 11 May 2018 19:31:19 +0000 (19:31 +0000)]
[PPC64] isRelExpr should return true for the PPC Call Exprs.

Both R_PPC_CALL and R_PPC_CALL_PLT Exprs map to the R_PPC64_REL24 relocation
which has the form Sym + addend - P.

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

llvm-svn: 332127

6 years agoYet another follow-up to r332111. This also handles the case where an
Adrian Prantl [Fri, 11 May 2018 19:29:25 +0000 (19:29 +0000)]
Yet another follow-up to r332111. This also handles the case where an
LLDB.framework is built inside the LLDB build directory (but not
inside an Xcode installation).

llvm-svn: 332126

6 years ago[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module
Julie Hockett [Fri, 11 May 2018 19:23:15 +0000 (19:23 +0000)]
[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module

Adding a check to restrict system includes to a whitelist. Given a list
of includes that are explicitly allowed, the check issues a fixit to
remove any system include not on that list from the source file.

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

llvm-svn: 332125

6 years agoMove standard library inclusions to after internal inclusions.
David Blaikie [Fri, 11 May 2018 19:21:40 +0000 (19:21 +0000)]
Move standard library inclusions to after internal inclusions.

llvm-svn: 332124

6 years ago[HIP] Set proper triple and offload kind for the toolchain
Yaxun Liu [Fri, 11 May 2018 19:21:39 +0000 (19:21 +0000)]
[HIP] Set proper triple and offload kind for the toolchain

Also introduce --hip-link option to indicate HIP for linking.

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

llvm-svn: 332123

6 years ago[HIP] Diagnose unsupported host triple
Yaxun Liu [Fri, 11 May 2018 19:14:34 +0000 (19:14 +0000)]
[HIP] Diagnose unsupported host triple

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

llvm-svn: 332122

6 years ago[HIP] Let clang-offload-bundler support HIP
Yaxun Liu [Fri, 11 May 2018 19:02:18 +0000 (19:02 +0000)]
[HIP] Let clang-offload-bundler support HIP

When bundle/unbundle intermediate files for HIP, there may be multiple
sub archs, therefore BoundArch needs to be included in the target
and output file names for clang-offload-bundler.

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

llvm-svn: 332121

6 years agoFix a regression in r332111. The LLDB.framework path component is not
Adrian Prantl [Fri, 11 May 2018 19:00:58 +0000 (19:00 +0000)]
Fix a regression in r332111. The LLDB.framework path component is not
usually the last component.

llvm-svn: 332120

6 years ago[DAGCombiner] Set the right SDLoc on extended SETCC uses (7/N)
Vedant Kumar [Fri, 11 May 2018 18:40:10 +0000 (18:40 +0000)]
[DAGCombiner] Set the right SDLoc on extended SETCC uses (7/N)

ExtendSetCCUses updates SETCC nodes which use a load (OriginalLoad) to
reflect a simplification to the load (ExtLoad).

Based on my reading, ExtendSetCCUses may create new nodes to extend a
constant attached to a SETCC. It also creates fresh SETCC nodes which
refer to any updated operands.

ISTM that the location applied to the new constant and SETCC nodes
should be the same as the location of the ExtLoad.

This was suggested by Adrian in https://reviews.llvm.org/D45995.

Part of: llvm.org/PR37262

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

llvm-svn: 332119

6 years ago[DAGCombiner] Set the right SDLoc on a newly-created sextload (6/N)
Vedant Kumar [Fri, 11 May 2018 18:40:08 +0000 (18:40 +0000)]
[DAGCombiner] Set the right SDLoc on a newly-created sextload (6/N)

This teaches tryToFoldExtOfLoad to set the right location on a
newly-created extload. With that in place, the logic for performing a
certain ([s|z]ext (load ...)) combine becomes identical for sexts and
zexts, and we can get rid of one copy of the logic.

The test case churn is due to dependencies on IROrders inherited from
the wrong SDLoc.

Part of: llvm.org/PR37262

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

llvm-svn: 332118

6 years ago[DAGCombiner] Factor out duplicated logic for an extload combine, NFC (5/N)
Vedant Kumar [Fri, 11 May 2018 18:40:02 +0000 (18:40 +0000)]
[DAGCombiner] Factor out duplicated logic for an extload combine, NFC (5/N)

Part of the logic for combining (zext (load ...)) and (sext (load ...))
is duplicated. This creates problems because bugs in one version have to
be fixed again in the other version.

To address this, as a first step, I've extracted the duplicate logic
into a helper. I'll fix the debug location bug in the helper and
eliminate the copy of its logic in a followup.

Part of: llvm.org/PR37262

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

llvm-svn: 332117

6 years ago[LIT] replace output escapes wit a cdata block
Chris Matthews [Fri, 11 May 2018 18:38:02 +0000 (18:38 +0000)]
[LIT] replace output escapes wit a cdata block

CDATA blocks don't need to have XML stuff escaped. Makes sense to wrap
output in them instead of escaping.

llvm-svn: 332116

6 years agoAdd a lock to PlatformPOSIX::DoLoadImage
Frederic Riss [Fri, 11 May 2018 18:21:11 +0000 (18:21 +0000)]
Add a lock to PlatformPOSIX::DoLoadImage

Summary:
Multiple threads could be calling into DoLoadImage concurrently,
only one should be allowed to create the UtilityFunction.

Reviewers: jingham

Subscribers: emaste, lldb-commits

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

llvm-svn: 332115

6 years ago[MachO] Don't write test files to /tmp, remove them afterwards.
Martin Storsjo [Fri, 11 May 2018 18:19:02 +0000 (18:19 +0000)]
[MachO] Don't write test files to /tmp, remove them afterwards.

This matches what is done in MachONormalizedFileBinaryWriterTests.cpp
already.

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

llvm-svn: 332114

6 years agomake add_llvm_fuzzer calls slightly more consisten with other cmake
Nico Weber [Fri, 11 May 2018 17:58:52 +0000 (17:58 +0000)]
make add_llvm_fuzzer calls slightly more consisten with other cmake

llvm-svn: 332112

6 years agoHostInfoMacOSX: Share the clang resource directory with Swift.
Adrian Prantl [Fri, 11 May 2018 17:54:09 +0000 (17:54 +0000)]
HostInfoMacOSX: Share the clang resource directory with Swift.

Inside Xcode and in Xcode toolchains LLDB is always in lockstep
with the Swift compiler, so it can reuse its Clang resource
directory. This allows LLDB and the Swift compiler to share the
same Clang module cache.

rdar://problem/40039633

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

llvm-svn: 332111

6 years ago[InstCombine] snprintf optimizations
David Bolvansky [Fri, 11 May 2018 17:50:49 +0000 (17:50 +0000)]
[InstCombine] snprintf optimizations

Reviewers: spatel, efriedma, majnemer, rja, bkramer

Reviewed By: rja, bkramer

Subscribers: mstorsjo, rja, llvm-commits

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

llvm-svn: 332110

6 years ago[X86][BtVer2] Model ymm move as double pumped instructions
Simon Pilgrim [Fri, 11 May 2018 17:38:36 +0000 (17:38 +0000)]
[X86][BtVer2] Model ymm move as double pumped instructions

We still need to handle mmx/xmm moves as 'decode-only' no-pipe instructions

llvm-svn: 332109

6 years ago[X86] Fix the file header name on fmaintrin.h
Craig Topper [Fri, 11 May 2018 17:37:40 +0000 (17:37 +0000)]
[X86] Fix the file header name on fmaintrin.h

llvm-svn: 332108

6 years ago[RISCV] Support .option rvc and norvc assembler directives
Alex Bradbury [Fri, 11 May 2018 17:30:28 +0000 (17:30 +0000)]
[RISCV] Support .option rvc and norvc assembler directives

These directives allow the 'C' (compressed) extension to be enabled/disabled
within a single file.

Differential Revision: https://reviews.llvm.org/D45864
Patch by Kito Cheng

llvm-svn: 332107

6 years ago[Analysis] Validate the return type of s(n)printf like libcalls
Martin Storsjo [Fri, 11 May 2018 16:53:56 +0000 (16:53 +0000)]
[Analysis] Validate the return type of s(n)printf like libcalls

If the sprintf function is static (as on mingw-w64, where many stdio
functions are static inline wrappers), earlier optimization passes
could optimize out the return value altogether, and make it void,
which could break optimizations of this libcall that touch the
return value.

This fixes the issue discussed in PR37408 for the sprintf function.

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

llvm-svn: 332106

6 years ago[Hexagon] Implement checking arguments of builtin calls
Krzysztof Parzyszek [Fri, 11 May 2018 16:41:51 +0000 (16:41 +0000)]
[Hexagon] Implement checking arguments of builtin calls

llvm-svn: 332105

6 years ago[X86][MMX] Tag MMX Move/Load/Store as WriteVec schedule classes
Simon Pilgrim [Fri, 11 May 2018 16:38:59 +0000 (16:38 +0000)]
[X86][MMX] Tag MMX Move/Load/Store as WriteVec schedule classes

Fixes an issue on SLM/Btver2 where we had instructions were being treated as scalar loads/stores

llvm-svn: 332104

6 years ago[AArch64] Fix performPostLD1Combine to check for constant lane index.
Geoff Berry [Fri, 11 May 2018 16:25:06 +0000 (16:25 +0000)]
[AArch64] Fix performPostLD1Combine to check for constant lane index.

Summary:
performPostLD1Combine in AArch64ISelLowering looks for vector
insert_vector_elt of a loaded value which it can optimize into a single
LD1LANE instruction.  The code checking for the pattern was not checking
if the lane index was a constant which could cause two problems:

- an assert when lowering the LD1LANE ISD node since it assumes an
  constant operand

- an assert in isel if the lane index value depends on the
  post-incremented base register

Both of these issues are avoided by simply checking that the lane index
is a constant.

Fixes bug 35822.

Reviewers: t.p.northover, javed.absar

Subscribers: rengolin, kristof.beyls, mcrosier, llvm-commits

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

llvm-svn: 332103

6 years ago[mips] Rename Filler to MipsDelaySlotFiller and initialize the pass
Simon Dardis [Fri, 11 May 2018 16:13:53 +0000 (16:13 +0000)]
[mips] Rename Filler to MipsDelaySlotFiller and initialize the pass

llvm-svn: 332102

6 years agoUse iteration instead of recursion in CFIInserter
Sanjoy Das [Fri, 11 May 2018 15:54:46 +0000 (15:54 +0000)]
Use iteration instead of recursion in CFIInserter

Summary: This recursive step can overflow the stack.

Reviewers: djokov, petarj

Subscribers: mcrosier, jlebar, bixia, llvm-commits

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

llvm-svn: 332101

6 years ago[Reassociate] Prevent infinite loops when processing PHIs.
Davide Italiano [Fri, 11 May 2018 15:45:36 +0000 (15:45 +0000)]
[Reassociate] Prevent infinite loops when processing PHIs.

Phi nodes can reside in live blocks but one of their incoming
arguments can come from a dead block. Dead blocks and reassociate
don't play nice together. In fact, reassociate performs an RPO
as a first step to avoid processing dead blocks.

The reason why Reassociate might not fixpoint when examining
dead blocks is that the following:

  %xor0 = xor i16 %xor1, undef
  %xor1 = xor i16 %xor0, undef

is perfectly valid LLVM IR (if it appears in a dead block),
so the worklist algorithm keeps pushing the two instructions for
reexamination. Note that this is not Reassociate fault, at least
not entirely. It's llvm that has a weird definition of dominance.

Fixes PR37390.

llvm-svn: 332100

6 years agoRemove unused SyncExecutor and make it clearer that the whole file is only used if...
Nico Weber [Fri, 11 May 2018 15:25:38 +0000 (15:25 +0000)]
Remove unused SyncExecutor and make it clearer that the whole file is only used if LLVM_ENABLE_THREADS

llvm-svn: 332098

6 years ago[mips] Enable disassembly of fused (negative) multiply add/sub instructions
Simon Dardis [Fri, 11 May 2018 15:21:40 +0000 (15:21 +0000)]
[mips] Enable disassembly of fused (negative) multiply add/sub instructions

Reviewers: atanasyan, smaksimovic, abeserminji

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

llvm-svn: 332097

6 years ago[X86][SLM] Vector stores only use the MEC port.
Simon Pilgrim [Fri, 11 May 2018 15:16:15 +0000 (15:16 +0000)]
[X86][SLM] Vector stores only use the MEC port.

Confirmed by both Agner and Intel's AOM - the IEC/FPC are not required for pure load/stores (even if its a partial update).

Can't fix WriteStore until all RMW instructions are cleaned up though....

llvm-svn: 332096

6 years ago[winasan] Update GetInstructionSize for Win10 1803
David Major [Fri, 11 May 2018 14:31:14 +0000 (14:31 +0000)]
[winasan] Update GetInstructionSize for Win10 1803

In Windows version 1803, the first instruction of ntdll!strchr is:
8a01 mov al,byte ptr [rcx]

This is the only needed change for this version as far as I can tell.

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

llvm-svn: 332095

6 years ago[X86] Split WriteF/WriteVec Move/Load/Store scheduler classes by vector width
Simon Pilgrim [Fri, 11 May 2018 14:30:54 +0000 (14:30 +0000)]
[X86] Split WriteF/WriteVec Move/Load/Store scheduler classes by vector width

Fixes a SNB issue that was missing vlddqu/vmovntdqa ymm instructions

llvm-svn: 332094

6 years ago[InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer
Daniel Neilson [Fri, 11 May 2018 14:30:02 +0000 (14:30 +0000)]
[InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer

Summary:
This change reworks the handling of atomic memcpy within the instcombine pass.
Previously, a constant length atomic memcpy would be lowered into loads & stores
as long as no more than 16 load/store pairs are created. This is quite different
from the lowering done for a non-atomic memcpy; which only ever lowers into a single
load/store pair of no more than 8 bytes. Larger constant-sized memcpy calls are
expanded to load/stores in later passes, such as SelectionDAG lowering.

In this change the behaviour for atomic memcpy is unified with non-atomic memcpy;
atomic memcpy is now treated in the same was as non-atomic memcpy has always been.
We leave it to later passes to lower longer-length atomic memcpy calls.

Due to the structure of the pass's handling of memtransfer intrinsics, this change
also gives us handling of atomic memmove that we did not previously have.

Reviewers: apilipenko, skatkov, mkazantsev, anna, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

llvm-svn: 332093

6 years ago[ASan] Fix range check in AddrIsInHighShadow
David Major [Fri, 11 May 2018 14:23:39 +0000 (14:23 +0000)]
[ASan] Fix range check in AddrIsInHighShadow

This appears to be a copy/paste artifact from `AddrIsInHighMem`. It was caught by Firefox's jit-tests on Win64.

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

llvm-svn: 332092

6 years ago[X86] Assume alignment of movdir64b dst argument
Gabor Buella [Fri, 11 May 2018 14:22:04 +0000 (14:22 +0000)]
[X86] Assume alignment of movdir64b dst argument

Reviewers: craig.topper

Reviewed By: craig.topper

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

llvm-svn: 332091

6 years ago[X86] Added scheduler helper classes to split move/load/store by size
Simon Pilgrim [Fri, 11 May 2018 12:46:54 +0000 (12:46 +0000)]
[X86] Added scheduler helper classes to split move/load/store by size

Nothing uses this yet but this will allow us to specialize MMX/XMM/YMM/ZMM vector moves.

llvm-svn: 332090

6 years ago[clangd] Move helpers that convert Replacements to TextEdits to SourceCode.h
Eric Liu [Fri, 11 May 2018 12:12:08 +0000 (12:12 +0000)]
[clangd] Move helpers that convert Replacements to TextEdits to SourceCode.h

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, MaskRay, jkorous, cfe-commits

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

llvm-svn: 332089

6 years agoRemove custom path manipulation functions from FileSpec
Pavel Labath [Fri, 11 May 2018 11:55:34 +0000 (11:55 +0000)]
Remove custom path manipulation functions from FileSpec

Summary:
now that llvm supports host-agnostic path manipulation functions (and
most of their kinks have been ironed out), we can remove our copies of
the path parsing functions in favour of the llvm ones.

This should be NFC except for the slight difference in handling of the
"//" path, which is now normalized to "/" (this only applies to the
literal "//" path; "//net" and friends still get to keep the two
slashes).

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 332088

6 years ago[APFloat] Set losesInfo on no-op convert
Sven van Haastregt [Fri, 11 May 2018 09:45:42 +0000 (09:45 +0000)]
[APFloat] Set losesInfo on no-op convert

losesInfo would be left unset when no conversion needs to be done.  A
caller such as InstCombine's fitsInFPType would then branch on an
uninitialized value.

Caught using valgrind on an out-of-tree target.

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

llvm-svn: 332087

6 years ago[IRTests] Verify PDT instead of DT
Jakub Kuderski [Fri, 11 May 2018 09:30:29 +0000 (09:30 +0000)]
[IRTests] Verify PDT instead of DT

Summary: Fix two typos which result in verifying wrong data structures (DT) instead of PDT in DominatorTreeBatchUpdatesTest.

Reviewers: davide, kuhar, grosser, dberlin

Reviewed By: davide, kuhar, dberlin

Subscribers: llvm-commits

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

llvm-svn: 332086

6 years ago[ELF] - Revert of: r332038, r332054, r332060, r332061, r332062, r332063
George Rimar [Fri, 11 May 2018 08:11:25 +0000 (08:11 +0000)]
[ELF] - Revert of: r332038, r332054, r332060, r332061, r332062, r332063

This reverts "Mitigate relocation overflow [part 1 of 2]." and the following commits which
were trying to fix the bots.

At the moment of r332082, bots are still failing and we need to find the reason of test case breakages first of all.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/17042/steps/test/logs/stdio
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/29845/steps/test/logs/stdio

llvm-svn: 332085

6 years agoAMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI
Tom Stellard [Fri, 11 May 2018 05:44:16 +0000 (05:44 +0000)]
AMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI

Reviewers: arsenm, nhaehnle

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

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

llvm-svn: 332082

6 years ago[llvm-strip] Add support for -remove-section
Alexander Shaposhnikov [Fri, 11 May 2018 05:27:06 +0000 (05:27 +0000)]
[llvm-strip] Add support for -remove-section

This diff adds support for -remove-section to llvm-strip.

Test plan: make check-all

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

llvm-svn: 332081

6 years ago[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.
Craig Topper [Fri, 11 May 2018 04:33:18 +0000 (04:33 +0000)]
[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.

llvm-svn: 332079

6 years ago[llvm-objcopy] Update remove-section.test
Alexander Shaposhnikov [Fri, 11 May 2018 04:30:57 +0000 (04:30 +0000)]
[llvm-objcopy] Update remove-section.test

Verify that the input binary is not getting modified
and add an invocation which uses -remove-section instead of -R.

Test plan: make check-all

llvm-svn: 332078

6 years ago[Coroutines] PR34897: Fix incorrect elisions
Brian Gesiak [Fri, 11 May 2018 03:12:28 +0000 (03:12 +0000)]
[Coroutines] PR34897: Fix incorrect elisions

Summary:
https://bugs.llvm.org/show_bug.cgi?id=34897 demonstrates an incorrect
coroutine frame allocation elision in the coro-elide pass. The elision
is performed on the basis that the SSA variables from all llvm.coro.begin
are directly referenced in subsequent llvm.coro.destroy instructions.

However, this ignores the fact that the function may exit through paths
that do not run these destroy instructions. In the sample program from
PR34897, for example, the llvm.coro.destroy instruction is only
executed in exception handling code. When the coroutine function exits
normally, llvm.coro.destroy is not called. Eliding the allocation in
this case causes a subsequent reference to the coroutine handle from
outside of the function to access freed memory.

To fix the issue, when finding an llvm.coro.destroy for each llvm.coro.begin,
only consider llvm.coro.destroy that are executed along non-exceptional paths.

Test Plan:
1. Download the sample program from
   https://bugs.llvm.org/show_bug.cgi?id=34897, compile it with
   `clang++ -fcoroutines-ts -stdlib=libc++ -std=c++1z -O2`, and run it.
   It should print `"run1\ncheck1\nrun2\ncheck2"` and then exit
   successfully.
2. Compile https://godbolt.org/g/mCKfnr and confirm it is still
   optimized to a single instruction, 'return 1190'.
3. `check-llvm`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: andrewrk, lewissbaker, EricWF, llvm-commits

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

llvm-svn: 332077

6 years agoImprove diagnostics and error recovery for template name lookup.
Richard Smith [Fri, 11 May 2018 02:43:08 +0000 (02:43 +0000)]
Improve diagnostics and error recovery for template name lookup.

For 'x::template y', consistently give a "no member named 'y' in 'x'"
diagnostic if there is no such member, and give a 'template keyword not
followed by a template' name error if there is such a member but it's not a
template. In the latter case, add a note pointing at the non-template.

Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent
if the lookup of X::Y was actually not a dependent lookup and found only
non-templates.

llvm-svn: 332076

6 years ago[Support] Add docs for 'openFileFor{Write,Read}'
Brian Gesiak [Fri, 11 May 2018 01:47:27 +0000 (01:47 +0000)]
[Support] Add docs for 'openFileFor{Write,Read}'

Summary:
Add documentation for the LLVM Support functions `openFileForWrite` and
`openFileForRead`. The `openFileForRead` parameter `RealPath`, in
particular, I think warranted some explanation.

In addition, make the behavior of the functions more consistent across
platforms. Prior to this patch, Windows would set or not set the result
file descriptor based on the nature of the error, whereas Unix would
consistently set it to `-1` if the open failed. Make Windows
consistently set it to `-1` as well.

Test Plan:
1. `ninja check-llvm`
2. `ninja docs-llvm-html`

Reviewers: zturner, rnk, danielmartin, scanon

Reviewed By: danielmartin, scanon

Subscribers: scanon, danielmartin, llvm-commits

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

llvm-svn: 332075

6 years agoDon't propagate dllimport to base class template static data members
Reid Kleckner [Fri, 11 May 2018 01:26:11 +0000 (01:26 +0000)]
Don't propagate dllimport to base class template static data members

MSVC doesn't, so we shouldn't. Fixes PR37232.

llvm-svn: 332074

6 years ago[libFuzzer] refactor the implementation of -print_coverage
Kostya Serebryany [Fri, 11 May 2018 01:17:52 +0000 (01:17 +0000)]
[libFuzzer] refactor the implementation of -print_coverage

llvm-svn: 332073

6 years ago[sanitizer-coverage] don't instrument a function if it's entry block ends with 'unrea...
Kostya Serebryany [Fri, 11 May 2018 01:09:39 +0000 (01:09 +0000)]
[sanitizer-coverage] don't instrument a function if it's entry block ends with 'unreachable'

llvm-svn: 332072

6 years agoSupport XRay in the NetBSD driver
Kamil Rytarowski [Fri, 11 May 2018 01:00:38 +0000 (01:00 +0000)]
Support XRay in the NetBSD driver

Summary:
While there, perform a small cleanup, reducing delta
with drivers for other OSes.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, dberris

Reviewed By: dberris

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332071

6 years agoPermit -fxray-instrument for NetBSD/amd64
Kamil Rytarowski [Fri, 11 May 2018 00:58:55 +0000 (00:58 +0000)]
Permit -fxray-instrument for NetBSD/amd64

Summary:
Use the same branch as FreeBSD and OpenBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dberris, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, llvm-commits

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

llvm-svn: 332070

6 years agoRegister NetBSD/i386 in AddressSanitizer.cpp
Kamil Rytarowski [Fri, 11 May 2018 00:58:01 +0000 (00:58 +0000)]
Register NetBSD/i386 in AddressSanitizer.cpp

Summary:
Ship kNetBSD_ShadowOffset32 set to 1ULL << 30.

This is prepared for the amd64 kernel runtime.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, joerg, kcc

Reviewed By: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 332069

6 years ago[InstCombine] Add tests for cases where we don't recognize type promoted rotate idioms.
Craig Topper [Fri, 11 May 2018 00:46:09 +0000 (00:46 +0000)]
[InstCombine] Add tests for cases where we don't recognize type promoted rotate idioms.

These rotates take the form

(x << (n & mask)) | (x >> (-n & mask)) where mask is bitwidth - 1.

If x has been promoted to a wider type than its original bit width due to type promotion we fail to narrower it and therefore don't recognize it as a rotate.

llvm-svn: 332068

6 years agoRetrieve the deployment target when retrieving an object file's triple.
Adrian Prantl [Fri, 11 May 2018 00:41:20 +0000 (00:41 +0000)]
Retrieve the deployment target when retrieving an object file's triple.

Getting the deployment target can be significant information when
rebuilding clang modules since availability information could depend
on it.

rdar://problem/40039633

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

llvm-svn: 332067

6 years agoFix failing test due to incorrect use of noexcept
Eric Fiselier [Fri, 11 May 2018 00:33:20 +0000 (00:33 +0000)]
Fix failing test due to incorrect use of noexcept

llvm-svn: 332066

6 years agoSupport Unsupported Tests in xunit output
Chris Matthews [Fri, 11 May 2018 00:25:43 +0000 (00:25 +0000)]
Support Unsupported Tests in xunit output

We were reporting  "Unsupported" tests in xunit as passes, however since
they are not run, it make more sense to mark them as skipped. The Junit
xml standard has support for that, so lets use it.

llvm-svn: 332065

6 years agoRefactor xunit test case builder to not use as much str addition
Chris Matthews [Fri, 11 May 2018 00:25:42 +0000 (00:25 +0000)]
Refactor xunit test case builder to not use as much str addition

String concatenation in python is slow.  Refactor to not concatenate the
possibly large strings of test output and instead write them directly
to the output file.

llvm-svn: 332064

6 years ago[ELF] Fix test
Fangrui Song [Thu, 10 May 2018 23:57:38 +0000 (23:57 +0000)]
[ELF] Fix test

llvm-svn: 332063

6 years ago[ELF] Fix tests after rL332038
Fangrui Song [Thu, 10 May 2018 23:55:41 +0000 (23:55 +0000)]
[ELF] Fix tests after rL332038

llvm-svn: 332062

6 years ago[ELF] --warn-backref: don't report backref to weak symbols.
Fangrui Song [Thu, 10 May 2018 23:53:05 +0000 (23:53 +0000)]
[ELF] --warn-backref: don't report backref to weak symbols.

Summary:
Suppose we visit symbols in this order:

1. weak definition of foo in a lazy object
2. reference of foo
3 (optional). definition of foo

bfd/gold allows 123 but not 12.

Current --warn-backrefs implementation will report both cases as a backward reference. With this change, both 123 (intended) and 12 (unintended) are allowed. The usage of weak definitions usually imply there are also global definitions, so the trade-off is justified.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 332061

6 years ago[ELF] Fix two tests after D45788
Fangrui Song [Thu, 10 May 2018 23:51:37 +0000 (23:51 +0000)]
[ELF] Fix two tests after D45788

llvm-svn: 332060

6 years agoCOFF: Allow ICF on vtable sections.
Peter Collingbourne [Thu, 10 May 2018 23:31:58 +0000 (23:31 +0000)]
COFF: Allow ICF on vtable sections.

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

llvm-svn: 332059

6 years ago[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold
Wei Mi [Thu, 10 May 2018 23:02:27 +0000 (23:02 +0000)]
[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold

We found current sampleFDO had a performance issue when triaging a regression.
For a callsite with inline instance in the profile, even if hot callsite inliner
cannot inline it, it may still execute enough times and should not be treated as
cold in regular inliner later. However, currently if such callsite is not inlined
by hot callsite inliner, and the BB where the callsite locates doesn't get
samples from other instructions inside of it, the callsite will have no profile
metadata annotated. In regular inliner cost analysis, if the callsite has no
profile annotated and its caller has profile information, it will be treated as
cold.

The fix changes the isCallsiteHot check and chooses to compare
CallsiteTotalSamples with hot cutoff value computed by ProfileSummaryInfo.

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

llvm-svn: 332058

6 years ago[STLExtras] Add distance() for ranges, pred_size(), and succ_size()
Vedant Kumar [Thu, 10 May 2018 23:01:54 +0000 (23:01 +0000)]
[STLExtras] Add distance() for ranges, pred_size(), and succ_size()

This commit adds a wrapper for std::distance() which works with ranges.
As it would be a common case to write `distance(predecessors(BB))`, this
also introduces `pred_size()` and `succ_size()` helpers to make that
easier to write.

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

llvm-svn: 332057

6 years ago[LIT] Move xunit tests tests into their own location, and and add failures
Chris Matthews [Thu, 10 May 2018 22:51:28 +0000 (22:51 +0000)]
[LIT] Move xunit tests tests into their own location, and and add failures

Failures will increase coverage.

llvm-svn: 332056

6 years ago[InstCombine] Replace an 'if' that should always be true with an assert.
Craig Topper [Thu, 10 May 2018 22:45:28 +0000 (22:45 +0000)]
[InstCombine] Replace an 'if' that should always be true with an assert.

The bitwidth of the operation should always be wider than the result width of the truncate since we don't recurse through any width changing operations.

llvm-svn: 332055

6 years agoFix test cases failure caused by revision 332038.
Han Shen [Thu, 10 May 2018 22:32:39 +0000 (22:32 +0000)]
Fix test cases failure caused by revision 332038.

The previous CL changes the order of output sections, which causes address changes in test cases.

Review: https://reviews.llvm.org/D46730
llvm-svn: 332054

6 years ago[clang-cl] Make -f[no-]coverage-mapping available
Reid Kleckner [Thu, 10 May 2018 22:24:00 +0000 (22:24 +0000)]
[clang-cl] Make -f[no-]coverage-mapping available

llvm-svn: 332053

6 years ago[WebAssembly] Initial Disassembler.
Sam Clegg [Thu, 10 May 2018 22:16:44 +0000 (22:16 +0000)]
[WebAssembly] Initial Disassembler.

This implements a new table-gen emitter to create tables for
a wasm disassembler, and a dissassembler to use them.

Comes with 2 tests, that tests a few instructions manually. Is also able to
disassemble large .wasm files with objdump reasonably.

Not working so well, to be addressed in followups:
- objdump appears to be passing an incorrect starting point.
- since the disassembler works an instruction at a time, and it is
  disassembling stack instruction, it has no idea of pseudo register assignments.
  These registers are required for the instruction printing code that follows.
  For now, all such registers appear in the output as $0.

Patch by Wouter van Oortmerssen

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

llvm-svn: 332052

6 years agoEnable SANITIZER_INTERCEPTOR_HOOKS for NetBSD
Kamil Rytarowski [Thu, 10 May 2018 22:09:24 +0000 (22:09 +0000)]
Enable SANITIZER_INTERCEPTOR_HOOKS for NetBSD

Summary:
This feature is required for proper libFuzzer support.

Adding SI_NETBSD to the list of OSes, fixes breakage in several
libFuzzer tests. It has been debugged with aid from kcc@.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332051