platform/upstream/llvm.git
6 years ago[InstCombine] add tests for casted sign-bit cmp (PR36682); NFC
Sanjay Patel [Sun, 11 Mar 2018 16:45:31 +0000 (16:45 +0000)]
[InstCombine] add tests for casted sign-bit cmp (PR36682); NFC

llvm-svn: 327243

6 years ago[X86][AVX] createVariablePermute - use PSHUFB+PCMPGT+SELECT for v32i8 variable permutes
Simon Pilgrim [Sun, 11 Mar 2018 16:28:11 +0000 (16:28 +0000)]
[X86][AVX] createVariablePermute - use PSHUFB+PCMPGT+SELECT for v32i8 variable permutes

Same as the VPERMILPS/VPERMILPD approach for v8f32/v4f64 cases, rely on PSHUFB using bits[3:0] for indexing - we can ignore the sign bit (zero element) as those index vector values are considered undefined. The select between the lo/hi permute results based on the index size.

llvm-svn: 327242

6 years agoFix for buildbots which didn't like makeArrayRef with initializer lists.
Simon Pilgrim [Sun, 11 Mar 2018 14:31:55 +0000 (14:31 +0000)]
Fix for buildbots which didn't like makeArrayRef with initializer lists.

llvm-svn: 327241

6 years ago[X86][SSE] Generalized SplitBinaryOpsAndApply to SplitOpsAndApply to support any...
Simon Pilgrim [Sun, 11 Mar 2018 14:04:53 +0000 (14:04 +0000)]
[X86][SSE] Generalized SplitBinaryOpsAndApply to SplitOpsAndApply to support any number of ops.

I've kept SplitBinaryOpsAndApply as a wrapper to avoid a lot of makeArrayRef code.

llvm-svn: 327240

6 years ago[X86][AVX] createVariablePermute - use 2xVPERMIL+PCMPGT+SELECT for v8i32/v8f32 and...
Simon Pilgrim [Sun, 11 Mar 2018 11:52:26 +0000 (11:52 +0000)]
[X86][AVX] createVariablePermute - use 2xVPERMIL+PCMPGT+SELECT for v8i32/v8f32 and v4i64/v4f64 variable permutes

As VPERMILPS/VPERMILPD only selects elements based on the bits[1:0]/bit[1] then we can permute both the (repeated) lo/hi 128-bit vectors in each case and then select between these results based on whether the index was for for lo/hi.

For v4i64/v4f64 this avoids some rather nasty v4i64 multiples on the AVX2 implementation, which seems to be worse than the extra port5 pressure from the additional shuffles/blends.

llvm-svn: 327239

6 years ago[X86][AVX512] createVariablePermute - Non-VLX targets can widen v4i64/v8f64 variable...
Simon Pilgrim [Sun, 11 Mar 2018 11:19:19 +0000 (11:19 +0000)]
[X86][AVX512] createVariablePermute - Non-VLX targets can widen v4i64/v8f64 variable permutes to v8i64/v8f64

Permutes in the upper elements will be undefined, but they will be discarded anyway.

llvm-svn: 327238

6 years agofix a typo on the website
Sylvestre Ledru [Sun, 11 Mar 2018 10:53:40 +0000 (10:53 +0000)]
fix a typo on the website

llvm-svn: 327237

6 years ago[x86][SSE] Add widenSubVector helper. NFCI.
Simon Pilgrim [Sun, 11 Mar 2018 10:50:48 +0000 (10:50 +0000)]
[x86][SSE] Add widenSubVector helper. NFCI.

Helper function to insert a subvector into the bottom elements of a larger zero/undef vector with the same scalar type.

I've converted a couple of INSERT_SUBVECTOR calls to use it, there are plenty more although in some cases I was worried it might make the code more ambiguous.

llvm-svn: 327236

6 years ago[MemorySSA] Fix comment + remove redundant dyn_casts; NFC
George Burgess IV [Sun, 11 Mar 2018 04:16:12 +0000 (04:16 +0000)]
[MemorySSA] Fix comment + remove redundant dyn_casts; NFC

StartingAccess is already a MemoryUseOrDef.

llvm-svn: 327235

6 years agoTest commit - change comment slightly.
Michael Bedy [Sun, 11 Mar 2018 03:27:50 +0000 (03:27 +0000)]
Test commit - change comment slightly.

llvm-svn: 327234

6 years agoAdd REQUIRES: arm-registered-target to test using an arm-apple-ios triple.
Nico Weber [Sun, 11 Mar 2018 03:17:34 +0000 (03:17 +0000)]
Add REQUIRES: arm-registered-target to test using an arm-apple-ios triple.

Else, the test fails in LLVM_TARGETS_TO_BUILD=X86 builds like so:
bin/llvm-mc: : error: unable to get target for 'arm64-apple-ios7.0.0'

llvm-svn: 327233

6 years ago[WebAssembly] Improve logging and comments around relocations. NFC.
Sam Clegg [Sun, 11 Mar 2018 01:35:02 +0000 (01:35 +0000)]
[WebAssembly] Improve logging and comments around relocations. NFC.

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

llvm-svn: 327232

6 years ago[TargetSchedule] Minor refactor in computeInstrLatency. NFC
Andrea Di Biagio [Sun, 11 Mar 2018 00:51:33 +0000 (00:51 +0000)]
[TargetSchedule] Minor refactor in computeInstrLatency. NFC

The intent of revision r300311 was to add a check for invalid scheduling class
descriptors. However, it ended up adding a redundant call in a basic block that
should not be reachable.

llvm-svn: 327231

6 years agoRevert r327199: "Clean up a temp file on the buildbots"
George Burgess IV [Sat, 10 Mar 2018 23:22:46 +0000 (23:22 +0000)]
Revert r327199: "Clean up a temp file on the buildbots"

"I'll revert this tomorrow," I said yesterday. This should've reached
all the bots it can by now.

llvm-svn: 327230

6 years ago[CodeGen] Eagerly emit lifetime.end markers for calls
George Burgess IV [Sat, 10 Mar 2018 23:06:31 +0000 (23:06 +0000)]
[CodeGen] Eagerly emit lifetime.end markers for calls

In C, we'll wait until the end of the scope to clean up aggregate
temporaries used for returns from calls. This means in cases like:

{
  // Assuming that `Bar` is large enough to warrant indirect returns
  struct Bar b = {};
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
}

...We'll allocate space for 5 Bars on the stack (`b`, and 4
temporaries). This becomes painful in things like large switch
statements.

If cleaning up sooner is trivial, we should do it.

llvm-svn: 327229

6 years ago[demangler] Simplify printing of structured bindings.
Erik Pilkington [Sat, 10 Mar 2018 22:33:49 +0000 (22:33 +0000)]
[demangler] Simplify printing of structured bindings.

Thanks to Richard Smith for the post-commit review!

llvm-svn: 327228

6 years ago[demangler] Support for sequence numbers on lifetime extended temporaries.
Erik Pilkington [Sat, 10 Mar 2018 21:31:22 +0000 (21:31 +0000)]
[demangler] Support for sequence numbers on lifetime extended temporaries.

llvm-svn: 327227

6 years ago[demangler] Support for structured bindings.
Erik Pilkington [Sat, 10 Mar 2018 21:31:15 +0000 (21:31 +0000)]
[demangler] Support for structured bindings.

llvm-svn: 327226

6 years ago[X86] Add comments to the end of FMA3 instructions to make the operation clear
Craig Topper [Sat, 10 Mar 2018 21:30:46 +0000 (21:30 +0000)]
[X86] Add comments to the end of FMA3 instructions to make the operation clear

Summary:
There are 3 different operand orders for FMA instructions so figuring out the exact operation being performed requires a lot of thought.

This patch adds a comment to the end of the assembly line to print the exact operation.

I think I've got all the instructions in here except the ones with builtin rounding.

I didn't update all tests, but I assume we can get them as we regenerate tests in the future.

Reviewers: spatel, v_klochkov, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 327225

6 years ago[lldb] Unbreak lldb builds due to r327219
Mandeep Singh Grang [Sat, 10 Mar 2018 21:13:55 +0000 (21:13 +0000)]
[lldb] Unbreak lldb builds due to r327219

Summary:
r327219 adds wrappers to sort which shuffle the container before sorting.
This causes lldb bots to break as the call to sort is now ambiguous:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/20725/steps/ninja%20build%20local/logs/stdio

So we need use llvm::sort instead of sort to avoid ambiguity with std::sort.

Note: This patch is just to unbreak the bots. I plan to have subsequent patches which will convert all
calls to std::sort to llvm::sort.

Reviewers: RKSimon, k8stone, jingham, labath, zturner

Subscribers: andreadb, lldb-commits

Tags: #lldb

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

llvm-svn: 327224

6 years ago[llvm-mca] Fix use-of-uninitialized-value error reported by the MemorySanitizer.
Andrea Di Biagio [Sat, 10 Mar 2018 20:52:59 +0000 (20:52 +0000)]
[llvm-mca] Fix use-of-uninitialized-value error reported by the MemorySanitizer.

This should make the buildbots green again.

llvm-svn: 327223

6 years ago[X86][XOP] createVariablePermute - use VPERMIL2 for v8i32/v4i64 variable permutes
Simon Pilgrim [Sat, 10 Mar 2018 19:49:59 +0000 (19:49 +0000)]
[X86][XOP] createVariablePermute - use VPERMIL2 for v8i32/v4i64 variable permutes

llvm-svn: 327222

6 years agoRevert untested changes in SCEVAffinator
Tobias Grosser [Sat, 10 Mar 2018 19:15:23 +0000 (19:15 +0000)]
Revert untested changes in SCEVAffinator

llvm-svn: 327221

6 years ago[AArch64] Implement native TLS for Windows
Martin Storsjo [Sat, 10 Mar 2018 19:05:21 +0000 (19:05 +0000)]
[AArch64] Implement native TLS for Windows

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

llvm-svn: 327220

6 years ago[ADT] Shuffle containers before sorting to uncover non-deterministic behavior
Mandeep Singh Grang [Sat, 10 Mar 2018 18:59:14 +0000 (18:59 +0000)]
[ADT] Shuffle containers before sorting to uncover non-deterministic behavior

Summary:
std::sort and array_pod_sort both use non-stable sorting algorithms.
This means that the relative order of elements with the same key is
undefined. This patch is an attempt to uncover such scenarios by
randomly shuffling all containers before sorting, if EXPENSIVE_CHECKS
is enabled.

Here's the bugzilla for this: https://bugs.llvm.org/show_bug.cgi?id=35135

Reviewers: dblaikie, dexonsmith, chandlerc, efriedma, RKSimon

Reviewed By: RKSimon

Subscribers: fhahn, davide, RKSimon, vsk, mgorny, llvm-commits

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

llvm-svn: 327219

6 years ago[X86][XOP] createVariablePermute - use VPPERM for v16i16 variable permutes
Simon Pilgrim [Sat, 10 Mar 2018 18:33:29 +0000 (18:33 +0000)]
[X86][XOP] createVariablePermute - use VPPERM for v16i16 variable permutes

llvm-svn: 327218

6 years ago[X86][SSE] createVariablePermute - create index scaling helper. NFCI.
Simon Pilgrim [Sat, 10 Mar 2018 18:12:35 +0000 (18:12 +0000)]
[X86][SSE] createVariablePermute - create index scaling helper. NFCI.

This will help in some future changes for custom lowering.

llvm-svn: 327217

6 years agoAdd isl operator overloads for isl::pw_aff
Tobias Grosser [Sat, 10 Mar 2018 18:07:03 +0000 (18:07 +0000)]
Add isl operator overloads for isl::pw_aff

Piecewise affine expressions have directly corresponding mathematical
operators. Introduce these operators as overloads as this makes writing
code with isl::pw_aff expressions more directly readable.

We can now write:

  A = B + C    instead of    A = B.add(C)

llvm-svn: 327216

6 years ago[llvm-mca] BackendStatistics: early exit from method printSchedulerUsage if the
Andrea Di Biagio [Sat, 10 Mar 2018 17:40:25 +0000 (17:40 +0000)]
[llvm-mca] BackendStatistics: early exit from method printSchedulerUsage if the
no scheduler resources were consumed.

llvm-svn: 327215

6 years ago[llvm-mca] Views are now independent from resource masks. NFCI
Andrea Di Biagio [Sat, 10 Mar 2018 16:55:07 +0000 (16:55 +0000)]
[llvm-mca] Views are now independent from resource masks. NFCI

This change removes method Backend::getProcResourceMasks() and simplifies some
logic in the Views. This effectively removes yet another dependency between the
views and the Backend.
No functional change intended.

llvm-svn: 327214

6 years ago[X86][XOP] createVariablePermute - use VPPERM for v32i8 variable permutes
Simon Pilgrim [Sat, 10 Mar 2018 16:51:45 +0000 (16:51 +0000)]
[X86][XOP] createVariablePermute - use VPPERM for v32i8 variable permutes

llvm-svn: 327213

6 years ago[InstSimplify] fp_binop X, undef --> NaN
Sanjay Patel [Sat, 10 Mar 2018 16:51:28 +0000 (16:51 +0000)]
[InstSimplify] fp_binop X, undef --> NaN

The variable operand could be NaN, so it's always safe to propagate NaN.

llvm-svn: 327212

6 years ago[AMDGPU] fix tests to be independent of FP undef
Sanjay Patel [Sat, 10 Mar 2018 16:39:59 +0000 (16:39 +0000)]
[AMDGPU] fix tests to be independent of FP undef

llvm-svn: 327211

6 years ago[PowerPC] fix tests to be independent of FP undef
Sanjay Patel [Sat, 10 Mar 2018 16:14:05 +0000 (16:14 +0000)]
[PowerPC] fix tests to be independent of FP undef

llvm-svn: 327210

6 years agoAMDGPU: Fix crash when constant folding with physreg operand
Matt Arsenault [Sat, 10 Mar 2018 16:05:35 +0000 (16:05 +0000)]
AMDGPU: Fix crash when constant folding with physreg operand

llvm-svn: 327209

6 years ago[ConstantFold] fp_binop AnyConstant, undef --> NaN
Sanjay Patel [Sat, 10 Mar 2018 15:56:25 +0000 (15:56 +0000)]
[ConstantFold] fp_binop AnyConstant, undef --> NaN

With the updated LangRef ( D44216 / rL327138 ) in place, we can proceed with more constant folding.

I'm intentionally taking the conservative path here: no matter what the constant or the FMF, we can
always fold to NaN. This is because the undef operand can be chosen as NaN, and in our simplified
default FP env, nothing else happens - NaN just propagates to the result. If we find some way/need
to propagate undef instead, that can be added subsequently.

The tests show that we always choose the same quiet NaN constant (0x7FF8000000000000 in IR text).
There were suggestions to improve that with a 'NaN' string token or not always print a 64-bit hex
value, but those are independent changes. We might also consider setting/propagating the payload of
NaN constants as an enhancement.

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

llvm-svn: 327208

6 years ago[PartialInlining] Use isInlineViable to detect constructs preventing inlining.
Florian Hahn [Sat, 10 Mar 2018 14:53:44 +0000 (14:53 +0000)]
[PartialInlining] Use isInlineViable to detect constructs preventing inlining.

Use isInlineViable to prevent inlining of functions with non-inlinable
constructs, in case cost analysis is skipped.

Reviewers: efriedma, sfertile, davide, davidxl

Reviewed By: efriedma

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

llvm-svn: 327207

6 years ago[ObjC] Allow declaring __weak pointer fields in C structs in ARC.
Akira Hatanaka [Sat, 10 Mar 2018 06:36:08 +0000 (06:36 +0000)]
[ObjC] Allow declaring __weak pointer fields in C structs in ARC.

This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.

rdar://problem/33599681

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

llvm-svn: 327206

6 years ago[X86] Add a missing EVEX instruction to EmitAnyX86InstComments.
Craig Topper [Sat, 10 Mar 2018 06:05:13 +0000 (06:05 +0000)]
[X86] Add a missing EVEX instruction to EmitAnyX86InstComments.

The equivalent SSE and VEX instruction are already there.

llvm-svn: 327205

6 years ago[Driver] Pass Default=false to hasFlag.
Akira Hatanaka [Sat, 10 Mar 2018 05:55:21 +0000 (05:55 +0000)]
[Driver] Pass Default=false to hasFlag.

I forgot to do this in r326530.

llvm-svn: 327204

6 years ago[WebAssembly] Object: Add accessor for wasm symbols
Sam Clegg [Sat, 10 Mar 2018 05:34:04 +0000 (05:34 +0000)]
[WebAssembly] Object: Add accessor for wasm symbols

llvm-svn: 327203

6 years ago[X86] Move the AC_EVEX_2_VEX AsmComments enum to X86InstrInfo.h from X86InstComments.h.
Craig Topper [Sat, 10 Mar 2018 05:15:22 +0000 (05:15 +0000)]
[X86] Move the AC_EVEX_2_VEX AsmComments enum to X86InstrInfo.h from X86InstComments.h.

X86InstComments.h is used by tools that only have the MC layer. We shouldn't be importing a file from CodeGen into this.

X86InstrInfo.h isn't a great place, but I couldn't find a better one.

llvm-svn: 327202

6 years ago[AliasAnalysis] Shrink AliasResults; NFC
George Burgess IV [Sat, 10 Mar 2018 03:34:43 +0000 (03:34 +0000)]
[AliasAnalysis] Shrink AliasResults; NFC

We're persisting AliasResults in some places in MemorySSA, so the size
of these now matters a little bit (well, 8 regular-sized bits, to be
precise).

Do the same for ModRefInfo for consistency.

llvm-svn: 327201

6 years ago[X86] Rewrite printMasking code in X86InstComments to use TSFlags to determine whethe...
Craig Topper [Sat, 10 Mar 2018 03:12:00 +0000 (03:12 +0000)]
[X86] Rewrite printMasking code in X86InstComments to use TSFlags to determine whether the instruction is masked.

This should have been NFC, but it looks like we were missing PUNPCKLHQDQ/PUNPCKLQDQ instructions in there.

llvm-svn: 327200

6 years agoClean up a temp file on the buildbots.
George Burgess IV [Sat, 10 Mar 2018 02:51:10 +0000 (02:51 +0000)]
Clean up a temp file on the buildbots.

r327100 made us stop producing vecreduce-propagate-sd-flags.s, but it's
still sticking around on some bots. This makes the bots unhappy.

I'll revert this tomorrow.

llvm-svn: 327199

6 years agoGo back to sometimes assuming intristics are local.
Rafael Espindola [Sat, 10 Mar 2018 02:42:14 +0000 (02:42 +0000)]
Go back to sometimes assuming intristics are local.

This fixes pr36674.

While it is valid for shouldAssumeDSOLocal to return false anytime,
always returning false for intrinsics is not optimal on i386 and also
hits a bug in the backend.

To use a plt, the caller must first setup ebx to handle the case of
that file being linked into a PIE executable or shared library. In
those cases the generated PLT uses ebx.

Currently we can produce "calll expf@plt" without setting ebx. We
could fix that by correctly setting ebx, but this would produce worse
code for the case where the runtime library is statically linked. It
would also required other tools to handle R_386_PLT32.

llvm-svn: 327198

6 years agoRevert: r327172 "Correct load-op-store cycle detection analysis"
Nirav Dave [Sat, 10 Mar 2018 02:16:15 +0000 (02:16 +0000)]
Revert: r327172 "Correct load-op-store cycle detection analysis"
        r327171 "Improve Dependency analysis when doing multi-node Instruction Selection"
        r328170 "[DAG] Enforce stricter NodeId invariant during Instruction selection"

Reverting patch as NodeId invariant change is causing pathological
increases in compile time on PPC

llvm-svn: 327197

6 years ago[Fuzzer] When building for Fuchsia, add an explicit libc++ dependency
Petr Hosek [Sat, 10 Mar 2018 02:00:18 +0000 (02:00 +0000)]
[Fuzzer] When building for Fuchsia, add an explicit libc++ dependency

libFuzzer dependes on C++ library, when building for Fuchsia, we
need to ensure that libFuzzer is only being built after libc++
has been built, so we add an explicity dependency on it.

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

llvm-svn: 327196

6 years agoRevert r326946. It caused stack overflows by significantly increasing the size of...
Richard Smith [Sat, 10 Mar 2018 01:47:22 +0000 (01:47 +0000)]
Revert r326946. It caused stack overflows by significantly increasing the size of a CallArgList.

llvm-svn: 327195

6 years ago[CMake] Copy the generated __config header into build directory
Petr Hosek [Sat, 10 Mar 2018 01:20:11 +0000 (01:20 +0000)]
[CMake] Copy the generated __config header into build directory

When the generated __config file is being used, it is currently only
copied during installation process. However, that means that the file
that gets copied into LLVM build directory is the vanilla __config file,
and any parts of the build that depend on the just built toolchain like
sanitizers will get that instead of the generated version. To avoid this
issue, we need to copy the generated header into the LLVM build
directory as well.

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

llvm-svn: 327194

6 years agoRename clang.modules-cache-path to symbols.clang-modules-cache-path
Adrian Prantl [Sat, 10 Mar 2018 01:11:25 +0000 (01:11 +0000)]
Rename clang.modules-cache-path to symbols.clang-modules-cache-path

I want to extend the properties on ModuleList to also contain other
more general settings and renaming the settings category to symbols
seems to be the least bad of choices.

llvm-svn: 327193

6 years ago[CodeGen] Try to not call a dtor after lifetime.end
George Burgess IV [Sat, 10 Mar 2018 01:11:17 +0000 (01:11 +0000)]
[CodeGen] Try to not call a dtor after lifetime.end

If CodeGenFunction::EmitCall is:
- asked to emit a call with an indirectly returned value,
- given an invalid return value slot, and
- told the return value of the function it's calling is unused

then it'll make its own temporary, and add lifetime markers so that the
temporary's lifetime ends immediately after the call.

The early lifetime.end becomes problematic when we need to run a
destructor on the result of the function.

Instead of unconditionally saying that results of all calls are used
here (which would be correct, but would also cause us to never emit
lifetime markers for these temporaries), we just build our own temporary
to pass in when a dtor has to be run.

llvm-svn: 327192

6 years ago[libcxx][test] Reverting r327178 and r327190.
Mike Edwards [Sat, 10 Mar 2018 00:53:05 +0000 (00:53 +0000)]
[libcxx][test] Reverting r327178 and r327190.

Reverting changes made to iter_alloc_deduction.fail.cpp
as my changes seem to be making several Linux bots angry.

llvm-svn: 327191

6 years ago[libcxx][test] Marking libcpp-no-deduction-guides unsupported.
Mike Edwards [Sat, 10 Mar 2018 00:19:25 +0000 (00:19 +0000)]
[libcxx][test] Marking libcpp-no-deduction-guides unsupported.

This fixes linux bot failures with r327178.

llvm-svn: 327190

6 years ago[ARM] Add ARMv8.2-A FP16 vector intrinsic
Abderrazek Zaafrani [Fri, 9 Mar 2018 23:39:34 +0000 (23:39 +0000)]
[ARM] Add ARMv8.2-A FP16 vector intrinsic

Add the fp16 neon vector intrinsic for ARM as described in the ARM ACLE document.

Reviews in https://reviews.llvm.org/D43650

llvm-svn: 327189

6 years ago[TwoAddressInstructionPass] Improve tryInstructionCommute of X86 FMA and vpternlog...
Craig Topper [Fri, 9 Mar 2018 23:36:58 +0000 (23:36 +0000)]
[TwoAddressInstructionPass] Improve tryInstructionCommute of X86 FMA and vpternlog instructions

These instructions have 3 operands that can be commuted. The first commute we find may not be the best. So we should keep searching if we performed an aggressive commute. There may still be an operand that is killed or a physical register constraint that might be better.

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

llvm-svn: 327188

6 years ago[WebAssembly] Add EVT::getEVTString() for except_ref type
Heejin Ahn [Fri, 9 Mar 2018 23:29:06 +0000 (23:29 +0000)]
[WebAssembly] Add EVT::getEVTString() for except_ref type

Summary: This was missing in D43706 (rL326985).

Reviewers:

Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 327187

6 years ago[clang-tidy] Update run-clang-tidy.py with config arg
Julie Hockett [Fri, 9 Mar 2018 23:26:56 +0000 (23:26 +0000)]
[clang-tidy] Update run-clang-tidy.py with config arg

Updating the run-clang-tidy.py script to allow specification of the
config argument to the clang-tidy invocation.

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

llvm-svn: 327186

6 years ago[asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc`
Dan Liew [Fri, 9 Mar 2018 23:12:32 +0000 (23:12 +0000)]
[asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc`
by explicitly listing where we expect this test to work.

Because this test invokes undefined behaviour all sorts of things
can happen (e.g. crash, or on some bots asan manages to catch
something). The test seems to pass okay on Darwin (x86_64/x86_64/i386)
and on Linux (x86_64/i386) so explicitly require one of these platforms
to run the test.

llvm-svn: 327185

6 years ago[clangd-fuzzer] Update ClangdLSPServer constructor call.
Matt Morehouse [Fri, 9 Mar 2018 23:02:22 +0000 (23:02 +0000)]
[clangd-fuzzer] Update ClangdLSPServer constructor call.

Build was broken by r326719.

llvm-svn: 327184

6 years agotest: repair windows build after SVN r327105
Saleem Abdulrasool [Fri, 9 Mar 2018 23:00:29 +0000 (23:00 +0000)]
test: repair windows build after SVN r327105

Thanks to Nico Weber for pointing out the failure.  Add an explicit
target for the test.

llvm-svn: 327183

6 years ago[WebAssembly] Remove a second parameter from toString().
Rui Ueyama [Fri, 9 Mar 2018 22:59:34 +0000 (22:59 +0000)]
[WebAssembly] Remove a second parameter from toString().

toString(T) is a stringize function for an object of type T. Each type
that has that function defined should know how to stringize itself, and
there should be one string representation of an object. Passing a
"supplemental" argument to toString() breaks that princple. We shouldn't
add a second parameter to that function.

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

llvm-svn: 327182

6 years agoADT: Make MapVector::value_type and MapVector::size_type public. NFC.
Peter Collingbourne [Fri, 9 Mar 2018 22:52:22 +0000 (22:52 +0000)]
ADT: Make MapVector::value_type and MapVector::size_type public. NFC.

llvm-svn: 327180

6 years ago[TargetLowering] Remove redundant term in two ifs in SimplifySetCC. NFC
Craig Topper [Fri, 9 Mar 2018 22:24:12 +0000 (22:24 +0000)]
[TargetLowering] Remove redundant term in two ifs in SimplifySetCC. NFC

If we get into the right hand side of the OR, we know that isOpaque is true since the left hand size is just a check that it's false.

llvm-svn: 327179

6 years agoXFAIL: libcpp-no-deduction-guides in libcxx/test/std/strings/basic.string/string...
Mike Edwards [Fri, 9 Mar 2018 22:13:12 +0000 (22:13 +0000)]
XFAIL: libcpp-no-deduction-guides in libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp

Summary: Refactor the previous version method of marking each apple-clang version as UNSUPPORTED and just XFAIL'ing the libcpp-no-deduction-guides instead.  This brings this test inline with the same style as iter_alloc_deduction.pass.cpp

Reviewers: EricWF, dexonsmith

Reviewed By: EricWF

Subscribers: EricWF, vsapsai, vsk, cfe-commits

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

llvm-svn: 327178

6 years ago[ELF] Add elf64lppc emulation.
Fangrui Song [Fri, 9 Mar 2018 22:11:46 +0000 (22:11 +0000)]
[ELF] Add elf64lppc emulation.

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 327177

6 years agoRevert "[Debug] Retain both sets of debug intrinsics in HoistThenElseCodeToIf"
Ulrich Weigand [Fri, 9 Mar 2018 22:00:10 +0000 (22:00 +0000)]
Revert "[Debug] Retain both sets of debug intrinsics in HoistThenElseCodeToIf"

This reverts commit r327175 as problems in debug info generation were shown.

llvm-svn: 327176

6 years ago[Debug] Retain both sets of debug intrinsics in HoistThenElseCodeToIf
Ulrich Weigand [Fri, 9 Mar 2018 21:37:07 +0000 (21:37 +0000)]
[Debug] Retain both sets of debug intrinsics in HoistThenElseCodeToIf

When hoisting common code from the "then" and "else" branches of a condition
to before the "if", there is no need to require that debug intrinsics match
before moving them (and merging them).  Instead, we can simply always keep
all debug intrinsics from both sides of the "if".

This fixes PR36410, which describes a problem where as a result of the attempt
to merge debug locations for two debug intrinsics we end up with an invalid
intrinsic, where the scope indicated in the !dbg location no longer matches
the scope of the variable tracked by the intrinsic.

In addition, this has the benefit that we no longer throw away information
that is actually still valid, helping to generate better debug data.

Reviewed By: vsk

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

llvm-svn: 327175

6 years ago[Power9] Code Cleaup and adding Comments for Power 9 Scheduler
Stefan Pintilie [Fri, 9 Mar 2018 21:08:35 +0000 (21:08 +0000)]
[Power9] Code Cleaup and adding Comments for Power 9 Scheduler

Did some code cleanup up removing ItinRW that are not needed and resource types
that are no longer used.

Also added more comments to the td files related to the Power 9 sheduler model.

llvm-svn: 327174

6 years ago[NFC] Consolidate six getPointerOperand() utility functions into one place
Renato Golin [Fri, 9 Mar 2018 21:05:58 +0000 (21:05 +0000)]
[NFC] Consolidate six getPointerOperand() utility functions into one place

There are six separate instances of getPointerOperand() utility.
LoopVectorize.cpp has one of them,
and I don't want to create a 7th one while I'm trying to move
LoopVectorizationLegality into a separate file
(eventual objective is to move it to Analysis tree).

See http://lists.llvm.org/pipermail/llvm-dev/2018-February/120999.html
for llvm-dev discussions

Closes D43323.

Patch by Hideki Saito <hideki.saito@intel.com>.

llvm-svn: 327173

6 years agoCorrect load-op-store cycle detection analysis
Nirav Dave [Fri, 9 Mar 2018 20:58:07 +0000 (20:58 +0000)]
Correct load-op-store cycle detection analysis

Add missing cycle dependency checks in load-op-store fusion.

Fixes PR36274.

Reviewers: craig.topper, bogner

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 327172

6 years agoImprove Dependency analysis when doing multi-node Instruction Selection
Nirav Dave [Fri, 9 Mar 2018 20:57:42 +0000 (20:57 +0000)]
Improve Dependency analysis when doing multi-node Instruction Selection

Relanding after fixing NodeId Invariant.

Cleanup cycle/validity checks in ISel (IsLegalToFold,
HandleMergeInputChains) and X86 (isFusableLoadOpStore). Now do a full
search for cycles / dependencies pruning the search when topological
property of NodeId allows.

As part of this propogate the NodeId-based cutoffs to narrow
hasPreprocessorHelper searches.

Reviewers: craig.topper, bogner

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 327171

6 years ago[DAG] Enforce stricter NodeId invariant during Instruction selection
Nirav Dave [Fri, 9 Mar 2018 20:57:15 +0000 (20:57 +0000)]
[DAG] Enforce stricter NodeId invariant during Instruction selection

Instruction Selection makes use of the topological ordering of nodes
by node id (a node's operands have smaller node id than it) when doing
cycle detection.  During selection we may violate this property as a
selection of multiple nodes may induce a use dependence (and thus a
node id restriction) between two unrelated nodes. If a selected node
has an unselected successor this may allow us to miss a cycle in
detection an invalid selection.

This patch fixes this by marking all unselected successors of a
selected node have negated node id.  We avoid pruning on such negative
ids but still can reconstruct the original id for pruning.

In-tree targets have been updated to replace DAG-level replacements
with ISel-level ones which enforce this property.

This preemptively fixes PR36312 before triggering commit r324359 relands

Reviewers: craig.topper, bogner, jyknight

Subscribers: arsenm, nhaehnle, javed.absar, llvm-commits, hiraditya

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

llvm-svn: 327170

6 years agoMake early exit hasPredecessorHelper return true. NFCI.
Nirav Dave [Fri, 9 Mar 2018 20:56:51 +0000 (20:56 +0000)]
Make early exit hasPredecessorHelper return true. NFCI.

All uses conservatively assume in early exit case that it will be a
predecessor. Changing default removes checking code in all uses.

llvm-svn: 327169

6 years agocfi: Disable simple-pass.cpp on Darwin.
Peter Collingbourne [Fri, 9 Mar 2018 20:41:56 +0000 (20:41 +0000)]
cfi: Disable simple-pass.cpp on Darwin.

-mretpoline does not work yet on Darwin.

llvm-svn: 327168

6 years ago[sanitizer] Revert rCRT327145
Kostya Kortchinsky [Fri, 9 Mar 2018 20:17:12 +0000 (20:17 +0000)]
[sanitizer] Revert rCRT327145

Summary:
It breaks the Chromium toolchain due to:
```
lib/sanitizer_common/sanitizer_allocator_primary32.h:269:34: error: requested alignment is not an integer constant
   struct ALIGNED(kCacheLineSize) SizeClassInfo {
```

Reviewers: alekseyshl, thakis

Reviewed By: thakis

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

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

llvm-svn: 327167

6 years agoFix Clang test case.
Peter Collingbourne [Fri, 9 Mar 2018 19:37:28 +0000 (19:37 +0000)]
Fix Clang test case.

llvm-svn: 327166

6 years agoDon't use -pie in relocatable link.
Evgeniy Stepanov [Fri, 9 Mar 2018 19:35:16 +0000 (19:35 +0000)]
Don't use -pie in relocatable link.

Summary:
Android, in particular, got PIE enabled by default in r316606. It resulted in
relocatable links passing both -r and -pie to the linker, which is not allowed.

Reviewers: srhines

Subscribers: cfe-commits

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

llvm-svn: 327165

6 years ago[llvm-objdump] Support disassembling by symbol name
Rafael Auler [Fri, 9 Mar 2018 19:13:44 +0000 (19:13 +0000)]
[llvm-objdump] Support disassembling by symbol name

Summary:
Add a new option -df to llvm-objdump that takes function names
as arguments and instructs the disassembler to only dump those function
contents. Based on code originally written by Bill Nell.

Reviewers: espindola, JDevlieghere

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

llvm-svn: 327164

6 years agoUse branch funnels for virtual calls when retpoline mitigation is enabled.
Peter Collingbourne [Fri, 9 Mar 2018 19:11:44 +0000 (19:11 +0000)]
Use branch funnels for virtual calls when retpoline mitigation is enabled.

The retpoline mitigation for variant 2 of CVE-2017-5715 inhibits the
branch predictor, and as a result it can lead to a measurable loss of
performance. We can reduce the performance impact of retpolined virtual
calls by replacing them with a special construct known as a branch
funnel, which is an instruction sequence that implements virtual calls
to a set of known targets using a binary tree of direct branches. This
allows the processor to speculately execute valid implementations of the
virtual function without allowing for speculative execution of of calls
to arbitrary addresses.

This patch extends the whole-program devirtualization pass to replace
certain virtual calls with calls to branch funnels, which are
represented using a new llvm.icall.jumptable intrinsic. It also extends
the LowerTypeTests pass to recognize the new intrinsic, generate code
for the branch funnels (x86_64 only for now) and lay out virtual tables
as required for each branch funnel.

The implementation supports full LTO as well as ThinLTO, and extends the
ThinLTO summary format used for whole-program devirtualization to
support branch funnels.

For more details see RFC:
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120672.html

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

llvm-svn: 327163

6 years ago[SymbolFilePDB] Keep searching until the file name is found for the pdb compiland
Aaron Smith [Fri, 9 Mar 2018 18:50:19 +0000 (18:50 +0000)]
[SymbolFilePDB] Keep searching until the file name is found for the pdb compiland

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327162

6 years agoAvoid creating a Constant for each value in a ConstantDataSequential.
Alina Sbirlea [Fri, 9 Mar 2018 18:48:20 +0000 (18:48 +0000)]
Avoid creating a Constant for each value in a ConstantDataSequential.

Summary: We create a ConstantDataSequential (ConstantDataArray or ConstantDataVector) to avoid creating a Constant for each element in an array of constants. But them in AsmPrinter, we do create a ConstantFP for each element in the ConstantDataSequential. This triggers excessive memory use when generating large global FP constants.

Reviewers: bogner, lhames, t.p.northover

Subscribers: jlebar, sanjoy, llvm-commits

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

llvm-svn: 327161

6 years agoDelay creating an alias for @@@.
Rafael Espindola [Fri, 9 Mar 2018 18:42:25 +0000 (18:42 +0000)]
Delay creating an alias for @@@.

With this we only create an alias for @@@ once we know if it should
use @ or @@. This avoids last minutes renames and hacks to handle MS
names.

This only handles the ELF writer. LTO still has issues with @@@
aliases.

llvm-svn: 327160

6 years ago[X86][AVX] createVariablePermute - fix v2i64/v2f64 VPERMILPD index creation.
Simon Pilgrim [Fri, 9 Mar 2018 18:37:56 +0000 (18:37 +0000)]
[X86][AVX] createVariablePermute - fix v2i64/v2f64 VPERMILPD index creation.

The input indices vector will put the index in bit0, but VPERMILPD actually selects off bit1 - so we need to scale accordingly.

llvm-svn: 327159

6 years agoTableGen: Remove space at EOL in TGLexer.{h,cpp}
Nicolai Haehnle [Fri, 9 Mar 2018 18:32:04 +0000 (18:32 +0000)]
TableGen: Remove space at EOL in TGLexer.{h,cpp}

Change-Id: Ica5f39470174e85f173d3b6db95789033f75ce17
llvm-svn: 327158

6 years ago[X86][SSE] createVariablePermute - move source vector canonicalization to top of...
Simon Pilgrim [Fri, 9 Mar 2018 18:08:08 +0000 (18:08 +0000)]
[X86][SSE] createVariablePermute - move source vector canonicalization to top of function. NFCI.

This is to make it easier to return early from the switch statement with custom lowering.

llvm-svn: 327157

6 years ago[ELF] Convert {read,write}*be to endianness-aware read/write.
Fangrui Song [Fri, 9 Mar 2018 18:03:22 +0000 (18:03 +0000)]
[ELF] Convert {read,write}*be to endianness-aware read/write.

Subscribers: emaste, nemanjai, arichardson, kbarton, llvm-commits

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

llvm-svn: 327156

6 years ago[LV] Adding test for r327109
Renato Golin [Fri, 9 Mar 2018 18:02:36 +0000 (18:02 +0000)]
[LV] Adding test for r327109

llvm-svn: 327155

6 years agoELF: Do not create multiple thunks for the same virtual address.
Peter Collingbourne [Fri, 9 Mar 2018 17:54:43 +0000 (17:54 +0000)]
ELF: Do not create multiple thunks for the same virtual address.

This avoids creating multiple thunks for symbols with aliases or which
belong to ICF'd sections. This patch reduces the size of Chromium for
Android by 260KB (0.8% of .text).

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

llvm-svn: 327154

6 years ago[AMDGPU] Supported ds_read_b128 generation; Widened vector length for local address...
Farhana Aleen [Fri, 9 Mar 2018 17:41:39 +0000 (17:41 +0000)]
[AMDGPU] Supported ds_read_b128 generation; Widened vector length for local address-space.

Summary: Starting from GCN 2nd generation, ISA supports ds_read_b128 on top of ds_read_b64.
         This patch supports ds_read_b128 instruction pattern and generation of this instruction.
         In the vectorizer, this patch also widen the vector length so that vectorizer generates
         128 bit loads for local address-space which gets translated to ds_read_b128.
         Since the performance benefit is not clear; compiler generates ds_read_b128 under -amdgpu-ds128.

Author: FarhanaAleen

Reviewed By: rampitec, arsenm

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 327153

6 years ago[GISel]: Add helpers for easy building G_FCONSTANT along with matchers
Aditya Nandakumar [Fri, 9 Mar 2018 17:31:51 +0000 (17:31 +0000)]
[GISel]: Add helpers for easy building G_FCONSTANT along with matchers

Added helpers to build G_FCONSTANT, along with matching ConstantFP and
unit tests for the same.

Sample usage.

auto MIB = Builder.buildFConstant(s32, 0.5); // Build IEEESingle
For Matching the above

const ConstantFP* Tmp;
mi_match(DstReg, MRI, m_GFCst(Tmp));

https://reviews.llvm.org/D44128
reviewed by: volkan

llvm-svn: 327152

6 years ago[WebAssembly] Handle weak undefined functions with a synthetic stub
Nicholas Wilson [Fri, 9 Mar 2018 17:06:38 +0000 (17:06 +0000)]
[WebAssembly] Handle weak undefined functions with a synthetic stub

This error case is described in Linking.md. The operand for call requires
generation of a synthetic stub.

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

llvm-svn: 327151

6 years ago[JumpThreading] Don't restrict cast-traversal to i1
Chad Rosier [Fri, 9 Mar 2018 16:43:46 +0000 (16:43 +0000)]
[JumpThreading] Don't restrict cast-traversal to i1

In r263618, JumpThreading learned to look trough simple cast instructions, but
only if the source of those cast instructions was a phi/cmp i1 (in an effort to
limit compile time effects). I think this condition is too restrictive. For
switches with limited value range, InstCombine will readily introduce an extra
trunc instruction to a smaller integer type (e.g. from i8 to i2), leaving us in
the somewhat perverse situation that jump-threading would work before running
instcombine, but not after. Since instcombine produces this pattern, I think we
need to consider it canonical and support it in JumpThreading.  In general,
for limiting recursion, I think the existing restriction to phi and cmp nodes
should be sufficient to avoid looking through unprofitable chains of
instructions.

Patch by Keno Fischer!
Differential Revision: https://reviews.llvm.org/D42262

llvm-svn: 327150

6 years ago[WebAssembly] Refactor order of creation for SyntheticFunction
Nicholas Wilson [Fri, 9 Mar 2018 16:43:05 +0000 (16:43 +0000)]
[WebAssembly] Refactor order of creation for SyntheticFunction

Previously we created __wasm_call_ctors with null InputFunction, and
added the InputFunction later. Now we create the SyntheticFunction with
null body, and set the body later.

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

llvm-svn: 327149

6 years agoMove generic test to the Generic directory
Adrian Prantl [Fri, 9 Mar 2018 16:42:05 +0000 (16:42 +0000)]
Move generic test to the Generic directory

llvm-svn: 327148

6 years ago[AMDGPU] fix test to be independent of FP undef
Sanjay Patel [Fri, 9 Mar 2018 16:33:34 +0000 (16:33 +0000)]
[AMDGPU] fix test to be independent of FP undef

llvm-svn: 327147

6 years ago[WebAssembly] Disallow weak undefined globals in the object format
Nicholas Wilson [Fri, 9 Mar 2018 16:30:44 +0000 (16:30 +0000)]
[WebAssembly] Disallow weak undefined globals in the object format

This implements https://github.com/WebAssembly/tool-conventions/pull/47

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

llvm-svn: 327146

6 years ago[sanitizer] Align & pad the allocator structures to the cacheline size
Kostya Kortchinsky [Fri, 9 Mar 2018 16:18:38 +0000 (16:18 +0000)]
[sanitizer] Align & pad the allocator structures to the cacheline size

Summary:
Both `SizeClassInfo` structures for the 32-bit primary & `RegionInfo`
structures for the 64-bit primary can be used by different threads, and as such
they should be aligned & padded to the cacheline size to avoid false sharing.
The former was padded but the array was not aligned, the latter was not padded
but we lucked up as the size of the structure was 192 bytes, and aligned by
the properties of `mmap`.

I plan on adding a couple of fields to the `RegionInfo`, and some highly
threaded tests pointed out that without proper padding & alignment, performance
was getting a hit - and it is going away with proper padding.

This patch makes sure that we are properly padded & aligned for both. I used
a template to avoid padding if the size is already a multiple of the cacheline
size. There might be a better way to do this, I am open to suggestions.

Reviewers: alekseyshl, dvyukov

Reviewed By: alekseyshl

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

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

llvm-svn: 327145

6 years ago[InstSimplify] fix FP infinite hex constant values in tests; NFC
Sanjay Patel [Fri, 9 Mar 2018 16:14:02 +0000 (16:14 +0000)]
[InstSimplify] fix FP infinite hex constant values in tests; NFC

Really should improve this...

llvm-svn: 327144

6 years agoRevert "[PowerPC] LSR tunings for PowerPC"
Stefan Pintilie [Fri, 9 Mar 2018 16:08:55 +0000 (16:08 +0000)]
Revert "[PowerPC] LSR tunings for PowerPC"

Revert the rest of the LST tune commit.
It seems that the LSR tune commit breaks internal tests.
Reverting the commit.

llvm-svn: 327143