platform/upstream/llvm.git
6 years ago[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.
Craig Topper [Mon, 14 May 2018 04:05:06 +0000 (04:05 +0000)]
[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.

If we're using default rounding mode we can let __builtin_convertvector to generate an fpextend. This matches 128 and 256 bit.

If we're using the version that takes an explicit rounding mode argument we would need to look at the immediate to see if its CUR_DIRECTION.

llvm-svn: 332210

6 years ago[XRay][compiler-rt] Fixup: Avoid C++11 narrowing in non-x86_64
Dean Michael Berris [Mon, 14 May 2018 03:55:12 +0000 (03:55 +0000)]
[XRay][compiler-rt] Fixup: Avoid C++11 narrowing in non-x86_64

This should fix non-x86_64 builds where size_t != atomic_uint64_t::Type.

Follow-up to D46574.

llvm-svn: 332209

6 years ago[XRay][compiler-rt] Support in-memory processing of FDR mode logs
Dean Michael Berris [Mon, 14 May 2018 03:35:01 +0000 (03:35 +0000)]
[XRay][compiler-rt] Support in-memory processing of FDR mode logs

Summary:
This change allows for handling the in-memory data associated with the
FDR mode implementation through the new `__xray_log_process_buffers`
API. With this change, we can now allow users to process the data
in-memory of the process instead of through writing files.

This for example allows users to stream the data of the FDR logging
implementation through network sockets, or through other mechanisms
instead of saving them to local files.

We introduce an FDR-specific flag, for "no_file_flush" which lets the
flushing logic skip opening/writing to files.

This option can be defaulted to `true` when building the compiler-rt
XRay runtime through the `XRAY_FDR_OPTIONS` preprocessor macro.

Reviewers: kpw, echristo, pelikan, eizan

Subscribers: llvm-commits

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

llvm-svn: 332208

6 years ago[X86] Cleanup a multiclass that doesn't need as many parameters after recent intrinsi...
Craig Topper [Mon, 14 May 2018 00:17:52 +0000 (00:17 +0000)]
[X86] Cleanup a multiclass that doesn't need as many parameters after recent intrinsic removals.

llvm-svn: 332207

6 years ago[X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use uitofp+insertelement instead.
Craig Topper [Mon, 14 May 2018 00:06:49 +0000 (00:06 +0000)]
[X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use uitofp+insertelement instead.

llvm-svn: 332206

6 years ago[X86] Add patterns for combining movss+uint_to_fp into the intrinsic instructions...
Craig Topper [Sun, 13 May 2018 23:24:21 +0000 (23:24 +0000)]
[X86] Add patterns for combining movss+uint_to_fp into the intrinsic instructions under AVX512.

This matches what we do for sint_to_fp.

llvm-svn: 332205

6 years ago[X86] Add fast-isel test cases for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and...
Craig Topper [Sun, 13 May 2018 23:24:19 +0000 (23:24 +0000)]
[X86] Add fast-isel test cases for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu64_ss.

llvm-svn: 332204

6 years ago[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu6...
Craig Topper [Sun, 13 May 2018 23:03:30 +0000 (23:03 +0000)]
[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu64_ss.

We can use direct C code for these that will use uitofp and insertelement instructions.

For the versions that take an explicit rounding mode we can't do this.

llvm-svn: 332203

6 years ago[X86] Extend instcombine folds for pclmuldq intrinsics to the 256 and 512 bit version.
Craig Topper [Sun, 13 May 2018 21:56:32 +0000 (21:56 +0000)]
[X86] Extend instcombine folds for pclmuldq intrinsics to the 256 and 512 bit version.

llvm-svn: 332202

6 years agoUse const_iterator in DWARFUnit
Jan Kratochvil [Sun, 13 May 2018 19:04:17 +0000 (19:04 +0000)]
Use const_iterator in DWARFUnit

Function DWARFUnit::GetDIE is using m_die_array only for reading so it can use
DWARFDebugInfoEntry::const_iterator.

llvm-svn: 332201

6 years agoRevert "Protect DWARFCompileUnit::m_die_array by a new mutex"
Jan Kratochvil [Sun, 13 May 2018 18:38:28 +0000 (18:38 +0000)]
Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"

Pavel Labath found this patch is incomplete and racy.  I think there needs to
be some more mutexes even before considering DW_TAG_partial_unit.

This reverts commit 331229 which was: https://reviews.llvm.org/D40470

llvm-svn: 332200

6 years ago[X86] Add missing test for the InstCombines of pclmulqdq.
Craig Topper [Sun, 13 May 2018 18:26:06 +0000 (18:26 +0000)]
[X86] Add missing test for the InstCombines of pclmulqdq.

Apparently this test was lost when r293151 was committed. It was present in the review, but not the commit.

llvm-svn: 332199

6 years ago[X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.
Craig Topper [Sun, 13 May 2018 18:03:59 +0000 (18:03 +0000)]
[X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.

llvm-svn: 332198

6 years agoFollow-up to rL332176 by adding a test case for PR37264.
Dimitry Andric [Sun, 13 May 2018 14:32:23 +0000 (14:32 +0000)]
Follow-up to rL332176 by adding a test case for PR37264.

Noticed by Simon Pilgrim.

llvm-svn: 332197

6 years agoAMDGPU: Rename OpenCL lowering pass to be R600 specific.
Matt Arsenault [Sun, 13 May 2018 10:04:48 +0000 (10:04 +0000)]
AMDGPU: Rename OpenCL lowering pass to be R600 specific.

This pass is
  a) broken.
  b) r600 specific.

Fixing (a) is a bit more non-trivial, but fixing (b)
is easy. Move this pass to being R600 only for now.

This pass does pass all the unit tests, however clang
no longer generates code that looks like the unit test
input, so fixing the pass requires fixing the tests and
the pass as one, and checking it works with clang still.

Patch by Dave Airlie

llvm-svn: 332196

6 years agoAMDGPU: Make undef legal for v2i16/v2f16
Matt Arsenault [Sun, 13 May 2018 10:04:38 +0000 (10:04 +0000)]
AMDGPU: Make undef legal for v2i16/v2f16

This is apparently necessary to stop undef from being
turned into a build_vector of 0s.

llvm-svn: 332195

6 years agoAdded atomic_fetch_min, max, umin, umax intrinsics to clang.
Elena Demikhovsky [Sun, 13 May 2018 07:45:58 +0000 (07:45 +0000)]
Added atomic_fetch_min, max, umin, umax intrinsics to clang.

These intrinsics work exactly as all other atomic_fetch_* intrinsics and allow to create *atomicrmw* with ordering.
Updated the clang-extensions document.

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

llvm-svn: 332193

6 years agoFixing build bot error: adding const qualifiers to std::sort lambda.
Puyan Lotfi [Sun, 13 May 2018 06:50:55 +0000 (06:50 +0000)]
Fixing build bot error: adding const qualifiers to std::sort lambda.

Errors were not reproducible on clang-6.0 on ubuntu 16.04.

llvm-svn: 332192

6 years ago[NFC] MIR-Canon: switching to a stable string sorting of instructions.
Puyan Lotfi [Sun, 13 May 2018 06:07:20 +0000 (06:07 +0000)]
[NFC] MIR-Canon: switching to a stable string sorting of instructions.

llvm-svn: 332191

6 years ago[sanitizer] Replace #if SANITIZER_NETBSD with #if SANITIZER_INTERCEPT___LIBC_MUTEX
Vitaly Buka [Sun, 13 May 2018 05:55:45 +0000 (05:55 +0000)]
[sanitizer] Replace #if SANITIZER_NETBSD with #if SANITIZER_INTERCEPT___LIBC_MUTEX

llvm-svn: 332190

6 years ago[X86] Add some load folding patterns for cvtsi2ss/sd into intrinsic instructions.
Craig Topper [Sun, 13 May 2018 01:54:33 +0000 (01:54 +0000)]
[X86] Add some load folding patterns for cvtsi2ss/sd into intrinsic instructions.

llvm-svn: 332189

6 years ago[X86] Remove some unused CHECK lines from tests.
Craig Topper [Sun, 13 May 2018 00:58:23 +0000 (00:58 +0000)]
[X86] Remove some unused CHECK lines from tests.

llvm-svn: 332188

6 years ago[X86] Remove an autoupgrade legacy cvtss2sd intrinsics.
Craig Topper [Sun, 13 May 2018 00:29:40 +0000 (00:29 +0000)]
[X86] Remove an autoupgrade legacy cvtss2sd intrinsics.

llvm-svn: 332187

6 years ago[X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what clang has...
Craig Topper [Sat, 12 May 2018 23:14:39 +0000 (23:14 +0000)]
[X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what clang has used for a very long time.

llvm-svn: 332186

6 years ago[x86] Remove a comment obviated by r330269. Should have deleted the
Chandler Carruth [Sat, 12 May 2018 21:28:53 +0000 (21:28 +0000)]
[x86] Remove a comment obviated by r330269. Should have deleted the
comment in the same revision but missed it.

Thanks to Dimitry Andric for catching this!

llvm-svn: 332177

6 years agoClear converters map after X86 Domain Reassignment to avoid crashes
Dimitry Andric [Sat, 12 May 2018 19:59:54 +0000 (19:59 +0000)]
Clear converters map after X86 Domain Reassignment to avoid crashes

Summary:
As reported in PR37264, in some cases the X86 Domain Reassignment
`runOnMachineFunction()` is called twice.  Because it only deletes the
`.second` members of its `InstrConverterBaseMap`, and does not clean up
the map itself, this can lead to double frees and crashes.

Use `DeleteContainerSeconds()` instead, so the `Converters` map can
safely be reinitialized and its members re-deleted for each X86 Domain
Reassignment pass.

Reviewers: guyblank, craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

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

llvm-svn: 332176

6 years ago[NFC] Remove inaccurate comment
JF Bastien [Sat, 12 May 2018 19:39:34 +0000 (19:39 +0000)]
[NFC] Remove inaccurate comment

Summary:
r271558 moved getManagedStaticMutex's mutex from a function-local
static to using call_once, but left a comment added in r211424. That comment is
now erroneous, remove it.

Reviewers: zturner, chandlerc

Subscribers: aheejin, llvm-commits

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

llvm-svn: 332175

6 years agollc: don't call llvm_shutdown twice
JF Bastien [Sat, 12 May 2018 19:38:44 +0000 (19:38 +0000)]
llc: don't call llvm_shutdown twice

Summary:
InitLLVM already calls llvm_shutdown, but llc registers for shutdown
with llvm_shutdown_obj so it gets called twice. It's not hurting anything, but
it's also not useful, so don't do it.

Reviewers: ruiu

Subscribers: aheejin, llvm-commits

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

llvm-svn: 332174

6 years ago[X86] Add WriteFCMOV scheduler class for x87 CMOVs
Simon Pilgrim [Sat, 12 May 2018 18:07:07 +0000 (18:07 +0000)]
[X86] Add WriteFCMOV scheduler class for x87 CMOVs

llvm-svn: 332173

6 years ago[mips] Initialize the long branch pass for testing purposes
Simon Dardis [Sat, 12 May 2018 16:57:26 +0000 (16:57 +0000)]
[mips] Initialize the long branch pass for testing purposes

llvm-svn: 332172

6 years ago[sanitizer] Fix typo in macro name
Vitaly Buka [Sat, 12 May 2018 03:23:55 +0000 (03:23 +0000)]
[sanitizer] Fix typo in macro name

llvm-svn: 332171

6 years ago[X86] Remove some unused masked conversion intrinsics that can be replaced with an...
Craig Topper [Sat, 12 May 2018 02:34:28 +0000 (02:34 +0000)]
[X86] Remove some unused masked conversion intrinsics that can be replaced with an older intrinsic and a select.

This is what clang already uses.

llvm-svn: 332170

6 years agoCOFF: ICF a section and its associated sections as a unit.
Peter Collingbourne [Sat, 12 May 2018 02:12:40 +0000 (02:12 +0000)]
COFF: ICF a section and its associated sections as a unit.

This is needed to avoid merging two functions with identical
instructions but different xdata. It also reduces binary size by
deduplicating identical pdata sections.

Fixes PR35337.

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

llvm-svn: 332169

6 years agoReapply "[PR16756] Use SSAUpdaterBulk in JumpThreading."
Michael Zolotukhin [Sat, 12 May 2018 01:52:36 +0000 (01:52 +0000)]
Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading."

Stage3/stage4 bootstrap miscompares should be fixed by a non-determinism
fix in IDF (r332167).

This reverts commit r330446.

llvm-svn: 332168

6 years ago[IDF] Enforce the returned blocks to be sorted.
Michael Zolotukhin [Sat, 12 May 2018 01:44:32 +0000 (01:44 +0000)]
[IDF] Enforce the returned blocks to be sorted.

Summary:
Currently the order of blocks returned by `IDF::calculate` can be
non-deterministic. This was discovered in several attempts to enable
SSAUpdaterBulk for JumpThreading (which led to miscompare in bootstrap between
stage 3 and stage4). Originally, the blocks were put into a priority queue with
a depth level as their key, and this patch adds a DFSIn number as a second key
to specify a deterministic order across blocks from one level.

The solution was suggested by Daniel Berlin.

Reviewers: dberlin, davide

Subscribers: llvm-commits

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

llvm-svn: 332167

6 years ago[AMDGPU] Fix amdgpu-waves-per-eu accounting in scheduler
Stanislav Mekhanoshin [Sat, 12 May 2018 01:41:56 +0000 (01:41 +0000)]
[AMDGPU] Fix amdgpu-waves-per-eu accounting in scheduler

We cannot query this attribute from a subtarget given a machine function.
At this point attribute itself is already unavailable and can only be
obtained through MFI.

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

llvm-svn: 332166

6 years agoRevert "[LLDB] Support GNU-style compressed debug sections (.zdebug)"
Davide Italiano [Sat, 12 May 2018 01:25:48 +0000 (01:25 +0000)]
Revert "[LLDB] Support GNU-style compressed debug sections (.zdebug)"

This reverts commit r332162 as it breaks the bots (Ubuntu 14.04)
with the following message:

Build Command Output:
objcopy: option '--compress-debug-sections' doesn't allow an argument

llvm-svn: 332165

6 years agoAdd requirement of x86 target for test.
Douglas Yung [Sat, 12 May 2018 00:39:17 +0000 (00:39 +0000)]
Add requirement of x86 target for test.

llvm-svn: 332164

6 years ago[LanguageRuntime/ObjC] Turn off ISA logging once and for all.
Davide Italiano [Sat, 12 May 2018 00:33:12 +0000 (00:33 +0000)]
[LanguageRuntime/ObjC] Turn off ISA logging once and for all.

On behalf of Jim, who's out today.

llvm-svn: 332163

6 years ago[LLDB] Support GNU-style compressed debug sections (.zdebug)
Davide Italiano [Sat, 12 May 2018 00:29:25 +0000 (00:29 +0000)]
[LLDB] Support GNU-style compressed debug sections (.zdebug)

Patch by Erik Welander!

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

llvm-svn: 332162

6 years agoRequirements can have & in them!
Chris Matthews [Sat, 12 May 2018 00:13:54 +0000 (00:13 +0000)]
Requirements can have & in them!

Lets escape those so the XML is valid!

llvm-svn: 332161

6 years agoForce the PS4 clang ABI version to 6.
Douglas Yung [Sat, 12 May 2018 00:06:59 +0000 (00:06 +0000)]
Force the PS4 clang ABI version to 6.

The PS4 requires clang ABI version 6 for compatibility reasons. This change forces this and if the user specifies a different version when the PS4 target is specified, the compiler emits a warning that the specified version is being ignored.

Reviewers: probinson

Subscribers: cfe-commits

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

llvm-svn: 332160

6 years ago[libcxx] [test] Update msvc_stdlib_force_include.hpp.
Stephan T. Lavavej [Fri, 11 May 2018 23:57:32 +0000 (23:57 +0000)]
[libcxx] [test] Update msvc_stdlib_force_include.hpp.

llvm-svn: 332159

6 years ago[sanitizer] Allow Fuchsia symbolizer to be reused by Myriad RTEMS
Walter Lee [Fri, 11 May 2018 23:52:19 +0000 (23:52 +0000)]
[sanitizer] Allow Fuchsia symbolizer to be reused by Myriad RTEMS

Like Fuchsia, Myriad RTEMS uses an off-line symbolizer -- we just need
a custom backtrace frame string.  Move this definition to
sanitizer_fuchsia.h; the corresponding RTEMS one will be added when we
add sanitizer_rtems.h.

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

llvm-svn: 332157

6 years agoAdd the message attribute to skipped
Chris Matthews [Fri, 11 May 2018 23:15:11 +0000 (23:15 +0000)]
Add the message attribute to skipped

JUnit xml allows for a message attribute to be displayed on skips. Lets
populate that with an analysis of why we skipped the test.

llvm-svn: 332156

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