platform/upstream/llvm.git
7 years agoCOFF: hoist a local variable
Saleem Abdulrasool [Sun, 21 Aug 2016 23:05:43 +0000 (23:05 +0000)]
COFF: hoist a local variable

Create a local variable for the rdata section.  NFC.

llvm-svn: 279407

7 years ago[CostModel][X86] Removed shift tests
Simon Pilgrim [Sun, 21 Aug 2016 19:56:02 +0000 (19:56 +0000)]
[CostModel][X86] Removed shift tests

There are more thorough tests found in vshift-*-cost.ll

llvm-svn: 279406

7 years ago[CostModel][X86] Added costs for vXi16 and vXi8 vectors for add/sub/mul/and/or/xor...
Simon Pilgrim [Sun, 21 Aug 2016 19:44:44 +0000 (19:44 +0000)]
[CostModel][X86] Added costs for vXi16 and vXi8 vectors for add/sub/mul/and/or/xor tests

llvm-svn: 279405

7 years ago[CostModel][X86] Replaced SSSE3 with SSE2 costs to create a better baseline
Simon Pilgrim [Sun, 21 Aug 2016 19:14:48 +0000 (19:14 +0000)]
[CostModel][X86] Replaced SSSE3 with SSE2 costs to create a better baseline

llvm-svn: 279404

7 years ago[CostModel][X86] Added fsqrt and fma costs
Simon Pilgrim [Sun, 21 Aug 2016 19:06:25 +0000 (19:06 +0000)]
[CostModel][X86] Added fsqrt and fma costs

llvm-svn: 279403

7 years ago[CostModel][X86] Split off float arithmetic cost tests
Simon Pilgrim [Sun, 21 Aug 2016 18:34:47 +0000 (18:34 +0000)]
[CostModel][X86] Split off float arithmetic cost tests

llvm-svn: 279402

7 years ago[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vector...
Sanjay Patel [Sun, 21 Aug 2016 17:10:07 +0000 (17:10 +0000)]
[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vectors, part 4

This concludes the fixes for icmp+shl in this series:
https://reviews.llvm.org/rL279339
https://reviews.llvm.org/rL279398
https://reviews.llvm.org/rL279399

llvm-svn: 279401

7 years agoremove FIXME comment; fixed by previous commit
Sanjay Patel [Sun, 21 Aug 2016 16:40:42 +0000 (16:40 +0000)]
remove FIXME comment; fixed by previous commit

llvm-svn: 279400

7 years ago[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vector...
Sanjay Patel [Sun, 21 Aug 2016 16:35:34 +0000 (16:35 +0000)]
[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vectors, part 3

This is a partial enablement (move the ConstantInt guard down).

llvm-svn: 279399

7 years ago[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vector...
Sanjay Patel [Sun, 21 Aug 2016 16:28:22 +0000 (16:28 +0000)]
[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vectors, part 2

This is a partial enablement (move the ConstantInt guard down).

llvm-svn: 279398

7 years ago[X86][AVX] Dropped combineShuffle256 - this can now be performed by EltsFromConsecuti...
Simon Pilgrim [Sun, 21 Aug 2016 15:39:45 +0000 (15:39 +0000)]
[X86][AVX] Dropped combineShuffle256 - this can now be performed by EltsFromConsecutiveLoads

llvm-svn: 279397

7 years ago[InstCombine] use APInt instead of ConstantInt in isSignBitCheck(); NFCI
Sanjay Patel [Sun, 21 Aug 2016 15:07:45 +0000 (15:07 +0000)]
[InstCombine] use APInt instead of ConstantInt in isSignBitCheck(); NFCI

The callers still have ConstantInt guards, so there is no functional change
intended from this change. But relaxing the callers will allow more folds
for vector types.

llvm-svn: 279396

7 years agoAdd a flag to dump SCoP optimized with the IslScheduleOptimizer pass
Roman Gareev [Sun, 21 Aug 2016 11:20:39 +0000 (11:20 +0000)]
Add a flag to dump SCoP optimized with the IslScheduleOptimizer pass

Dump polyhedral descriptions of Scops optimized with the isl scheduling
optimizer and the set of post-scheduling transformations applied
on the schedule tree to be able to check the work of the IslScheduleOptimizer
pass at the polyhedral level.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D23740

llvm-svn: 279395

7 years agoSimplify AccFuncMap to vector<> AccessFunctions
Roman Gareev [Sun, 21 Aug 2016 11:09:19 +0000 (11:09 +0000)]
Simplify AccFuncMap to vector<> AccessFunctions

getAccessFunctions() is dead code and the 'BB' argument
of getOrCreateAccessFunctions() is not used. This patch deletes
getAccessFunctions and transforms AccFuncMap into
a std::vector<std::unique_ptr<MemoryAccess>> AccessFunctions.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D23759

llvm-svn: 279394

7 years ago[AVX512][FastISel] Do not use K registers in TEST instructions
Guy Blank [Sun, 21 Aug 2016 08:02:27 +0000 (08:02 +0000)]
[AVX512][FastISel] Do not use K registers in TEST instructions

In some cases, FastIsel was emitting TEST instruction with K reg input, which is illegal.
Changed to using KORTEST when dealing with K regs.

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

llvm-svn: 279393

7 years ago[X86][AVX512F] minor fix of the parameter names
Asaf Badouh [Sun, 21 Aug 2016 07:56:47 +0000 (07:56 +0000)]
[X86][AVX512F] minor fix of the parameter names
add "__" prefix

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

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

llvm-svn: 279392

7 years agoARM: Avoid dereferencing end() in ARMFrameLowering::emitEpilogue
Duncan P. N. Exon Smith [Sun, 21 Aug 2016 00:08:10 +0000 (00:08 +0000)]
ARM: Avoid dereferencing end() in ARMFrameLowering::emitEpilogue

This fixes the crash from PR29072, where the MachineBasicBlock::iterator
wasn't being properly checked against MachineBasicBlock::end() before
iterating.  This was another bug exposed by the new
ilist::iterator::operator*() assertion from r279314.

This testcase is poor quality.  bugpoint couldn't reduce any further,
and I haven't had time to dig into what's going on so I can't invent a
better one.  I didn't even get good CHECK lines in: this is just a
crasher.

I'm committing anyway since this is a real crash with an obvious fix,
but I'll leave PR29072 open and ask an ARM maintainer to help improve
the testcase.

llvm-svn: 279391

7 years agoFix broken macOS LLDB Xcode build from r279314
Todd Fiala [Sat, 20 Aug 2016 23:24:02 +0000 (23:24 +0000)]
Fix broken macOS LLDB Xcode build from r279314

llvm-svn: 279390

7 years ago[X86][SSE] Regenerate 32-bit buildvector test
Simon Pilgrim [Sat, 20 Aug 2016 23:09:57 +0000 (23:09 +0000)]
[X86][SSE] Regenerate 32-bit buildvector test

llvm-svn: 279389

7 years ago[X86][SSE] Regenerate subvector extraction widening test
Simon Pilgrim [Sat, 20 Aug 2016 22:00:53 +0000 (22:00 +0000)]
[X86][SSE] Regenerate subvector extraction widening test

llvm-svn: 279388

7 years ago[X86] Regenerate fp truncate tests
Simon Pilgrim [Sat, 20 Aug 2016 21:56:33 +0000 (21:56 +0000)]
[X86] Regenerate fp truncate tests

llvm-svn: 279387

7 years agoRegenerate test
Simon Pilgrim [Sat, 20 Aug 2016 21:37:30 +0000 (21:37 +0000)]
Regenerate test

llvm-svn: 279386

7 years agoRegenerate test
Simon Pilgrim [Sat, 20 Aug 2016 21:35:45 +0000 (21:35 +0000)]
Regenerate test

llvm-svn: 279385

7 years ago[X86][XOP] Tweak vpermil2pd test to stop it being combined away
Simon Pilgrim [Sat, 20 Aug 2016 21:07:41 +0000 (21:07 +0000)]
[X86][XOP] Tweak vpermil2pd test to stop it being combined away

llvm-svn: 279384

7 years ago[asan] Minimize code size by using __asan_set_shadow_* for large blocks
Vitaly Buka [Sat, 20 Aug 2016 20:23:50 +0000 (20:23 +0000)]
[asan] Minimize code size by using __asan_set_shadow_* for large blocks

Summary:
We can insert function call instead of multiple store operation.
Current default is blocks larger than 64 bytes.
Changes are hidden behind -asan-experimental-poisoning flag.

PR27453

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

llvm-svn: 279383

7 years agoWdocumentation fix
Simon Pilgrim [Sat, 20 Aug 2016 20:21:27 +0000 (20:21 +0000)]
Wdocumentation fix

llvm-svn: 279382

7 years agoUse SDValue::getOpcode() helper instead of via SDValue::getNode()
Simon Pilgrim [Sat, 20 Aug 2016 20:04:18 +0000 (20:04 +0000)]
Use SDValue::getOpcode() helper instead of via SDValue::getNode()

llvm-svn: 279381

7 years ago[asan] Initialize __asan_set_shadow_* callbacks
Vitaly Buka [Sat, 20 Aug 2016 18:34:39 +0000 (18:34 +0000)]
[asan] Initialize __asan_set_shadow_* callbacks

Summary:
Callbacks are not being used yet.

PR27453

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 279380

7 years ago[asan] Optimize store size in FunctionStackPoisoner::poisonRedZones
Vitaly Buka [Sat, 20 Aug 2016 18:34:36 +0000 (18:34 +0000)]
[asan] Optimize store size in FunctionStackPoisoner::poisonRedZones

Summary: Reduce store size to avoid leading and trailing zeros.

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 279379

7 years ago[analyzer] Use faster hashing (MD5) in CloneDetector.
Artem Dergachev [Sat, 20 Aug 2016 17:35:53 +0000 (17:35 +0000)]
[analyzer] Use faster hashing (MD5) in CloneDetector.

This replaces the old approach of fingerprinting every AST node into a string,
which avoided collisions and was simple to implement, but turned out to be
extremely ineffective with respect to both performance and memory.

The collisions are now dealt with in a separate pass, which no longer causes
performance problems because collisions are rare.

Patch by Raphael Isemann!

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

llvm-svn: 279378

7 years ago[asan] Rename asan-instrument-allocas -> asan-instrument-dynamic-allocas
Vitaly Buka [Sat, 20 Aug 2016 17:22:36 +0000 (17:22 +0000)]
[asan] Rename asan-instrument-allocas -> asan-instrument-dynamic-allocas

Summary: Depends on D23707.

Subscribers: kubabrecka

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

llvm-svn: 279377

7 years ago[asan] Cleanup instrumentation of dynamic allocas
Vitaly Buka [Sat, 20 Aug 2016 17:22:27 +0000 (17:22 +0000)]
[asan] Cleanup instrumentation of dynamic allocas

Summary:
Extract instrumenting dynamic allocas into separate method.
Rename asan-instrument-allocas -> asan-instrument-dynamic-allocas

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

llvm-svn: 279376

7 years ago[X86][SSE] Added vector interleave test (PR21281)
Simon Pilgrim [Sat, 20 Aug 2016 17:07:38 +0000 (17:07 +0000)]
[X86][SSE] Added vector interleave test (PR21281)

llvm-svn: 279375

7 years ago[Sema] Don't crash on scanf on forward-declared enums.
Benjamin Kramer [Sat, 20 Aug 2016 16:51:33 +0000 (16:51 +0000)]
[Sema] Don't crash on scanf on forward-declared enums.

This is valid in GNU C, which allows pointers to incomplete enums. GCC
just pretends that the underlying type is 'int' in those cases, follow
that behavior.

llvm-svn: 279374

7 years ago[asan] Add support of lifetime poisoning into ComputeASanStackFrameLayout
Vitaly Buka [Sat, 20 Aug 2016 16:48:24 +0000 (16:48 +0000)]
[asan] Add support of lifetime poisoning into ComputeASanStackFrameLayout

Summary:
We are going to combine poisoning of red zones and scope poisoning.

PR27453

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 279373

7 years agoMove unittests/Support/IteratorTest.cpp to unittests/ADT/
Duncan P. N. Exon Smith [Sat, 20 Aug 2016 14:58:31 +0000 (14:58 +0000)]
Move unittests/Support/IteratorTest.cpp to unittests/ADT/

This testing stuff from ADT, not Support.  Fix the file location.

llvm-svn: 279372

7 years agoPR28423: Compare primary declaration contexts.
Vassil Vassilev [Sat, 20 Aug 2016 14:50:22 +0000 (14:50 +0000)]
PR28423: Compare primary declaration contexts.

In certain cases (mostly coming from modules), Sema's idea of the StdNamespace
does not point to the first declaration of namespace std.

Patch by Cristina Cristescu!

Reviewed by Richard Smith.

llvm-svn: 279371

7 years agoReapply "[SLP] Initialize VectorizedValue when gathering"
Matthew Simpson [Sat, 20 Aug 2016 14:49:02 +0000 (14:49 +0000)]
Reapply "[SLP] Initialize VectorizedValue when gathering"

The test case included in r279125 exposed existing undefined behavior in the
SLP vectorizer that it did not introduce. This patch reapplies the original
patch, but modifies the test case to avoid hitting the undefined behavior. This
allows us to close PR28330 while keeping the UBSan bot happy. The undefined
behavior the original test uncovered will be addressed in a follow-on patch.

Reference: https://llvm.org/bugs/show_bug.cgi?id=28330
llvm-svn: 279370

7 years ago[SLP] Add command line option for minimum tree size (NFC)
Matthew Simpson [Sat, 20 Aug 2016 14:10:06 +0000 (14:10 +0000)]
[SLP] Add command line option for minimum tree size (NFC)

llvm-svn: 279369

7 years agoAdd R_386_TLS_LE as a relocation having an implicit addend.
Ed Schouten [Sat, 20 Aug 2016 10:54:51 +0000 (10:54 +0000)]
Add R_386_TLS_LE as a relocation having an implicit addend.

TLS on i386 in non-PIE/PIC code seems broken right now, because we don't
properly add the addend encoded in the instruction to the resulting
offset when processing R_386_TLS_LE relocations.

Extend one of the existing tests for TLS on i686 to use an addend.

PR: https://llvm.org/bugs/show_bug.cgi?id=29068
Reviewed by: ruiu
Differential Revision: https://reviews.llvm.org/D23741

llvm-svn: 279368

7 years ago[analyzer] Make CloneDetector consider macro expansions.
Artem Dergachev [Sat, 20 Aug 2016 10:06:59 +0000 (10:06 +0000)]
[analyzer] Make CloneDetector consider macro expansions.

So far macro-generated code was treated by the CloneDetector as normal code.
This caused that some macros where reported as false-positive clones because
large chunks of code coming from otherwise concise macro expansions were treated
as copy-pasted code.

This patch ensures that macros are treated in the same way as literals/function
calls. This prevents macros that expand into multiple statements
from being reported as clones.

Patch by Raphael Isemann!

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

llvm-svn: 279367

7 years ago[analyzer] Make CloneDetector consider template arguments.
Artem Dergachev [Sat, 20 Aug 2016 09:57:21 +0000 (09:57 +0000)]
[analyzer] Make CloneDetector consider template arguments.

For example, code samples `isa<Stmt>(S)' and `isa<Expr>(S)'
are no longer considered to be clones.

Patch by Raphael Isemann!

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

llvm-svn: 279366

7 years agoRevert "[SLP] Initialize VectorizedValue when gathering" to fix ubsan bot.
Vitaly Buka [Sat, 20 Aug 2016 07:09:39 +0000 (07:09 +0000)]
Revert "[SLP] Initialize VectorizedValue when gathering" to fix ubsan bot.

This reverts commit r279125.

https://reviews.llvm.org/D23410

llvm-svn: 279363

7 years ago[CMake/ASan] Skip using libedit if ASan is enabled -- it leaks memory.
Chandler Carruth [Sat, 20 Aug 2016 07:05:13 +0000 (07:05 +0000)]
[CMake/ASan] Skip using libedit if ASan is enabled -- it leaks memory.

Note that you'll have to clear this variable from your CMake cache for
it to take effect.

llvm-svn: 279362

7 years ago[Profile] add test with large counts
Xinliang David Li [Sat, 20 Aug 2016 05:28:42 +0000 (05:28 +0000)]
[Profile] add test with large counts

llvm-svn: 279361

7 years ago[PM] Introduce an abstraction for all the analyses over a particular IR
Chandler Carruth [Sat, 20 Aug 2016 04:57:28 +0000 (04:57 +0000)]
[PM] Introduce an abstraction for all the analyses over a particular IR
unit for use in the PreservedAnalyses set.

This doesn't have any important functional change yet but it cleans
things up and makes the analysis substantially more efficient by
avoiding querying through the type erasure for every analysis.

I also think it makes it much easier to reason about how analyses are
preserved when walking across pass managers and across IR unit
abstractions.

Thanks to Sean and Mehdi both for the comments and suggestions.

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

llvm-svn: 279360

7 years agoamdgpu: Fix default case value for get_local_size
Matt Arsenault [Sat, 20 Aug 2016 04:17:17 +0000 (04:17 +0000)]
amdgpu: Fix default case value for get_local_size

llvm-svn: 279359

7 years agoRevert r279351 and r279357 due to bot failures
Manman Ren [Sat, 20 Aug 2016 03:00:54 +0000 (03:00 +0000)]
Revert r279351 and r279357 due to bot failures

llvm-svn: 279358

7 years agoFix windows bot
Manman Ren [Sat, 20 Aug 2016 02:28:15 +0000 (02:28 +0000)]
Fix windows bot

llvm-svn: 279357

7 years ago[gold/ThinLTO] Restore ThinLTO file management in gold plugin
Teresa Johnson [Sat, 20 Aug 2016 01:24:07 +0000 (01:24 +0000)]
[gold/ThinLTO] Restore ThinLTO file management in gold plugin

Summary:
The gold-plugin changes added along with the new LTO API in r278338 had
the effect of removing the management of the PluginInputFile that
ensured the files weren't released back to gold until the backend
threads were complete. Add back the old file handling.

Fixes PR29020.

Reviewers: mehdi_amini

Subscribers: mehdi_amini, llvm-commits, hjl.tools

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

llvm-svn: 279356

7 years ago[gold] Fix new gold test to specify emulation mode
Teresa Johnson [Sat, 20 Aug 2016 01:22:10 +0000 (01:22 +0000)]
[gold] Fix new gold test to specify emulation mode

Add emulation mode option for new test added in r279023.

llvm-svn: 279355

7 years agoadded Xcode lldb-gtest-for-debugging target
Todd Fiala [Sat, 20 Aug 2016 00:54:03 +0000 (00:54 +0000)]
added Xcode lldb-gtest-for-debugging target

The lldb-gtest target is for CI and runs the tests as
part of the build phase.  It does not support debugging
the gtests from Xcode, though, due to the run happening
during the build phase.

This change adds a lldb-gtest-for-debugging target that
can be used to debug gtests.

llvm-svn: 279354

7 years agoAdd logic to the ObjC runtime in LLDB to extract the pointer values of the two single...
Enrico Granata [Sat, 20 Aug 2016 00:48:11 +0000 (00:48 +0000)]
Add logic to the ObjC runtime in LLDB to extract the pointer values of the two singleton (pairtons?) instances of __NSCFBoolean that represent true and false

This is useful because that knowledge will in turn allow no-code-running formatting of boolean NSNumbers; but that's a commit that will have to wait Monday..

llvm-svn: 279353

7 years ago[msan] Disable prlimit test on glibc < 2.13.
Evgeniy Stepanov [Sat, 20 Aug 2016 00:38:55 +0000 (00:38 +0000)]
[msan] Disable prlimit test on glibc < 2.13.

llvm-svn: 279352

7 years ago[NFC] Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.
Manman Ren [Sat, 20 Aug 2016 00:04:21 +0000 (00:04 +0000)]
[NFC] Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.

This is in preparation of adding a new type class ObjCTypeParamType that
can take protocol qualifiers. ObjCProtocolQualifiers will be shared between
ObjCObjectType and ObjCTypeParamType.

rdar://24619481
rdar://25060179

Differential Revision: http://reviews.llvm.org/D23078

llvm-svn: 279351

7 years agoamdgcn: Fix get_local_size IR return type
Matt Arsenault [Sat, 20 Aug 2016 00:01:21 +0000 (00:01 +0000)]
amdgcn: Fix get_local_size IR return type

llvm-svn: 279350

7 years ago[LTO] Add the ability to test -thinlto-emit-imports-files through llvm-lto2
Mehdi Amini [Fri, 19 Aug 2016 23:54:40 +0000 (23:54 +0000)]
[LTO] Add the ability to test -thinlto-emit-imports-files through llvm-lto2

Summary:
Start bringing llvm-lto2 to a level where we can test the LTO API
a bit deeper.

Reviewers: tejohnson

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 279349

7 years ago[Driver] Remove unused #include of llvm/Support/config.h
Vedant Kumar [Fri, 19 Aug 2016 23:15:35 +0000 (23:15 +0000)]
[Driver] Remove unused #include of llvm/Support/config.h

This is a follow-up to r279112 (which removed the need for the header)
and in the same spirit as r279035 (which attempted to un-break
out-of-tree builds).

llvm-svn: 279348

7 years agoMachineFunction: Add llvm_unreachable for missing properties
Matthias Braun [Fri, 19 Aug 2016 23:03:28 +0000 (23:03 +0000)]
MachineFunction: Add llvm_unreachable for missing properties

Most compilers should give you a warning anyway though.

llvm-svn: 279346

7 years agoRemove a test that depends on knowing all compiler's register allocation schemes.
Jim Ingham [Fri, 19 Aug 2016 22:58:26 +0000 (22:58 +0000)]
Remove a test that depends on knowing all compiler's register allocation schemes.

This test was using a condition that would compare a variable against the register that would hold
it.  It was failing with clang on arm64 because clang put the variable on the stack.

This is not a supportable way to write tests.

llvm-svn: 279345

7 years agoReset "undef" flag when coalescing subregister into whole register
Krzysztof Parzyszek [Fri, 19 Aug 2016 22:57:23 +0000 (22:57 +0000)]
Reset "undef" flag when coalescing subregister into whole register

llvm-svn: 279344

7 years agoamdgcn: Correct return types to be size_t
Matt Arsenault [Fri, 19 Aug 2016 22:49:39 +0000 (22:49 +0000)]
amdgcn: Correct return types to be size_t

llvm-svn: 279343

7 years agoGlobalISel: support legalization of G_FCONSTANTs
Tim Northover [Fri, 19 Aug 2016 22:40:08 +0000 (22:40 +0000)]
GlobalISel: support legalization of G_FCONSTANTs

llvm-svn: 279341

7 years agoGlobalISel: teach legalizer how to handle integer constants.
Tim Northover [Fri, 19 Aug 2016 22:40:00 +0000 (22:40 +0000)]
GlobalISel: teach legalizer how to handle integer constants.

llvm-svn: 279340

7 years ago[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vector...
Sanjay Patel [Fri, 19 Aug 2016 22:33:26 +0000 (22:33 +0000)]
[InstCombine] use m_APInt to allow icmp (shl X, Y), C folds for splat constant vectors, part 1

This is a partial enablement (move the ConstantInt guard down) because there are many
different folds here and one of the later ones will require reworking 'isSignBitCheck'.

llvm-svn: 279339

7 years agoMachineFunction: Cleanup/simplify MachineFunctionProperties::print()
Matthias Braun [Fri, 19 Aug 2016 22:31:45 +0000 (22:31 +0000)]
MachineFunction: Cleanup/simplify MachineFunctionProperties::print()

- Always compile print() regardless of LLVM_ENABLE_DUMP. (We usually
  only gard dump() functions with that).
- Only show the set properties to reduce output clutter.
- Remove the unused variant that even shows the unset properties.
- Fix comments

llvm-svn: 279338

7 years agoMachineFunction: Make LastProperty an alias of the last property
Matthias Braun [Fri, 19 Aug 2016 22:31:42 +0000 (22:31 +0000)]
MachineFunction: Make LastProperty an alias of the last property

This avoids unnecessary cases in switch statements covering all
properties.

llvm-svn: 279337

7 years ago[CMake] Support building on OS X without Xcode installation
Chris Bieneman [Fri, 19 Aug 2016 22:22:35 +0000 (22:22 +0000)]
[CMake] Support building on OS X without Xcode installation

This should resolve PR23162. This patch has two parts.

First we need to check the error code from xcodebuild when querying for SDKs, second if the OS X SDK is not discovered, we ensure that /usr/include exists and use / as the OS X sysroot.

llvm-svn: 279336

7 years agoPartially revert 279331, as we modify this instruction in the loop
Daniel Berlin [Fri, 19 Aug 2016 22:18:38 +0000 (22:18 +0000)]
Partially revert 279331, as we modify this instruction in the loop

llvm-svn: 279335

7 years ago[CMake] Add check-compiler-rt target for runtimes build
Chris Bieneman [Fri, 19 Aug 2016 22:17:48 +0000 (22:17 +0000)]
[CMake] Add check-compiler-rt target for runtimes build

Durning standalone builds (which includes runtimes builds) we want to create a target named check-compiler-rt. Additionally we also create check-all if it doesn't already exist as a convienence target that depends on check-compiler-rt.

This allows us to generate a single check target that invokes lit for all test suites in the runtimes projects, while avoiding name collision of check-all and not breaking existing workflows.

llvm-svn: 279334

7 years ago[CMake] Add top-level install-compiler-rt target
Chris Bieneman [Fri, 19 Aug 2016 22:17:46 +0000 (22:17 +0000)]
[CMake] Add top-level install-compiler-rt target

This is a wrapper target of all the component install targets. This wrapper target will be used by the new LLVM runtimes directory to connect top-level targets to the runtime project target.

llvm-svn: 279333

7 years agoRevert "[asan] Add support of lifetime poisoning into ComputeASanStackFrameLayout"
Vitaly Buka [Fri, 19 Aug 2016 22:12:58 +0000 (22:12 +0000)]
Revert "[asan] Add support of lifetime poisoning into ComputeASanStackFrameLayout"

This reverts commit r279020.

Speculative revert in hope to fix asan test on arm.

llvm-svn: 279332

7 years agoConvert some depth first traversals to depth_first
Daniel Berlin [Fri, 19 Aug 2016 22:06:23 +0000 (22:06 +0000)]
Convert some depth first traversals to depth_first

llvm-svn: 279331

7 years ago[www] Add nullability questions to analyzer FAQ.
Devin Coughlin [Fri, 19 Aug 2016 22:04:45 +0000 (22:04 +0000)]
[www] Add nullability questions to analyzer FAQ.

llvm-svn: 279330

7 years ago[CallGraph] Use decltype instead of pointer_to_unary_function. NFC.
Tim Shen [Fri, 19 Aug 2016 21:52:42 +0000 (21:52 +0000)]
[CallGraph] Use decltype instead of pointer_to_unary_function. NFC.

Reviewers: dblaikie

Subscribers: cfe-commits

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

llvm-svn: 279329

7 years ago[CallGraph] Use decltype instead of pointer_to_unary_function. NFC.
Tim Shen [Fri, 19 Aug 2016 21:52:34 +0000 (21:52 +0000)]
[CallGraph] Use decltype instead of pointer_to_unary_function. NFC.

Reviewers: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 279328

7 years ago[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB
Lang Hames [Fri, 19 Aug 2016 21:27:16 +0000 (21:27 +0000)]
[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB
expression evaluation.

OrcMCJITReplacement is a reimplementation of MCJIT using ORC components, and
provides an easy upgrade path to ORC for existing MCJIT clients. There should be
no functional changes resulting from this switch.

llvm-svn: 279327

7 years ago[GraphTraits] Make nodes_iterator dereference to NodeType*/NodeRef
Tim Shen [Fri, 19 Aug 2016 21:20:13 +0000 (21:20 +0000)]
[GraphTraits] Make nodes_iterator dereference to NodeType*/NodeRef

Currently nodes_iterator may dereference to a NodeType* or a NodeType&. Make them all dereference to NodeType*, which is NodeRef later.

Differential Revision: https://reviews.llvm.org/D23704
Differential Revision: https://reviews.llvm.org/D23705

llvm-svn: 279326

7 years ago[Packetizer] Add debugging code to stop packetization after N instructions
Krzysztof Parzyszek [Fri, 19 Aug 2016 21:12:52 +0000 (21:12 +0000)]
[Packetizer] Add debugging code to stop packetization after N instructions

llvm-svn: 279325

7 years ago[Hexagon] Avoid register dependencies on indirect branches in packetizer
Krzysztof Parzyszek [Fri, 19 Aug 2016 21:07:35 +0000 (21:07 +0000)]
[Hexagon] Avoid register dependencies on indirect branches in packetizer

Do not packetize the instruction setting the branch address with the
indirect branch itself.

llvm-svn: 279324

7 years ago[ADT] add pointer_iterator, the opposite of pointee_iterator
Tim Shen [Fri, 19 Aug 2016 21:04:45 +0000 (21:04 +0000)]
[ADT] add pointer_iterator, the opposite of pointee_iterator

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

llvm-svn: 279323

7 years agoRevert "[lldb][cmake] Remove libclang as an lldbBase dependency (NFCI)"
Vedant Kumar [Fri, 19 Aug 2016 21:00:40 +0000 (21:00 +0000)]
Revert "[lldb][cmake] Remove libclang as an lldbBase dependency (NFCI)"

This reverts commit r279296. Including LLDBDependencies breaks the
netbsd lldb bot because it exposes LLDB_USED_LIBS, which causes
lldb_link_common_libs to run to completion in unintended sites, which
results in a malformed call to target_link_libraries.

  http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd7/builds/5989

Thanks to Chris Bieneman for figuring this out!

llvm-svn: 279322

7 years ago[libFuzzer] fix the non-debug build warnings
Kostya Serebryany [Fri, 19 Aug 2016 20:57:09 +0000 (20:57 +0000)]
[libFuzzer] fix the non-debug build warnings

llvm-svn: 279321

7 years agoGlobalISel: translate floating-point round/extend
Tim Northover [Fri, 19 Aug 2016 20:48:23 +0000 (20:48 +0000)]
GlobalISel: translate floating-point round/extend

llvm-svn: 279320

7 years agoGlobalISel: translate floating-point comparisons
Tim Northover [Fri, 19 Aug 2016 20:48:16 +0000 (20:48 +0000)]
GlobalISel: translate floating-point comparisons

llvm-svn: 279319

7 years ago[asan] Temporarily mark test as broken on Windows
Vitaly Buka [Fri, 19 Aug 2016 20:48:09 +0000 (20:48 +0000)]
[asan] Temporarily mark test as broken on Windows

llvm-svn: 279318

7 years ago[NVPTX] Switch nvptx-use-infer-addrspace to true.
Justin Lebar [Fri, 19 Aug 2016 20:46:45 +0000 (20:46 +0000)]
[NVPTX] Switch nvptx-use-infer-addrspace to true.

Summary:
This switches us to use a different, more powerful algorithm for address
space inference.  I've tested this locally and it seems to work great.
Once we're more confident in it, we can remove the old pass altogether.

Reviewers: jingyue

Subscribers: llvm-commits, tra, jholewinski

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

llvm-svn: 279317

7 years agoReverted premature changes to .clang-format
Kate Stone [Fri, 19 Aug 2016 20:46:37 +0000 (20:46 +0000)]
Reverted premature changes to .clang-format

llvm-svn: 279316

7 years agoMoved #include for lldb-python.h to a distinct group with a reminder comment
Kate Stone [Fri, 19 Aug 2016 20:44:07 +0000 (20:44 +0000)]
Moved #include for lldb-python.h to a distinct group with a reminder comment
declaring that it must be first.  Failure to do so results in build failures
on macOS due to subtle header conflicts.

llvm-svn: 279315

7 years agoReapply "ADT: Remove UB in ilist (and use a circular linked list)"
Duncan P. N. Exon Smith [Fri, 19 Aug 2016 20:40:12 +0000 (20:40 +0000)]
Reapply "ADT: Remove UB in ilist (and use a circular linked list)"

This reverts commit r279053, reapplying r278974 after fixing PR29035
with r279104.

Note that r279312 has been committed in the meantime, and this has been
rebased on top of that.  Otherwise it's identical to r278974.

Note for maintainers of out-of-tree code (that I missed in the original
message): if the new isKnownSentinel() assertion is firing from
ilist_iterator<>::operator*(), this patch has identified a bug in your
code.  There are a few common patterns:
- Some IR-related APIs htake an IRUnit* that might be nullptr, and pass
  in an incremented iterator as an insertion point.  Some old code was
  using "&*++I", which in the case of end() only worked by fluke.  If
  the IRUnit in question inherits from ilist_node_with_parent<>, you can
  use "I->getNextNode()".  Otherwise, use "List.getNextNode(*I)".
- In most other cases, crashes on &*I just need to check for I==end()
  before dereferencing.
- There's also occasional code that sends iterators into a function, and
  then starts calling I->getOperand() (or other API).  Either check for
  end() before the entering the function, or early exit.

Note for if the static_assert with HasObsoleteCustomization is firing
for you:
- r278513 has examples of how to stop using custom sentinel traits.
- r278532 removed ilist_nextprev_traits since no one was using it.  See
  lld's r278469 for the only migration I needed to do.

Original commit message follows.

----

This removes the undefined behaviour (UB) in ilist/ilist_node/etc.,
mainly by removing (gutting) the ilist_sentinel_traits customization
point and canonicalizing on a single, efficient memory layout.  This
fixes PR26753.

The new ilist is a doubly-linked circular list.
- ilist_node_base has two ilist_node_base*: Next and Prev.  Size-of: two
  pointers.
- ilist_node<T> (size-of: two pointers) is a type-safe wrapper around
  ilist_node_base.
- ilist_iterator<T> (size-of: two pointers) operates on an
  ilist_node<T>*, and downcasts to T* on dereference.
- ilist_sentinel<T> (size-of: two pointers) is a wrapper around
  ilist_node<T> that has some extra API for list management.
- ilist<T> (size-of: two pointers) has an ilist_sentinel<T>, whose
  address is returned for end().

The new memory layout matches ilist_half_embedded_sentinel_traits<T>
exactly.  The Head pointer that previously lived in ilist<T> is
effectively glued to the ilist_half_node<T> that lived in
ilist_half_embedded_sentinel_traits<T>, becoming the Next and Prev in
the ilist_sentinel_node<T>, respectively.  sizeof(ilist<T>) is now the
size of two pointers, and there is never any additional storage for a
sentinel.

This is a much simpler design for a doubly-linked list, removing most of
the corner cases of list manipulation (add, remove, etc.).  In follow-up
commits, I intend to move as many algorithms as possible into a
non-templated base class (ilist_base) to reduce code size.

Moreover, this fixes the UB in ilist_iterator/getNext/getPrev
operations.  Previously, ilist_iterator<T> operated on a T*, even when
the sentinel was not of type T (i.e., ilist_embedded_sentinel_traits and
ilist_half_embedded_sentinel_traits).  This added UB to all operations
involving end().   Now, ilist_iterator<T> operates on an ilist_node<T>*,
and only downcasts when the full type is guaranteed to be T*.

What did we lose?  There used to be a crash (in some configurations) on
++end().  Curiously (via UB), ++end() would return begin() for users of
ilist_half_embedded_sentinel_traits<T>, but otherwise ++end() would
cause a nice dependable nullptr dereference, crashing instead of a
possible infinite loop.  Options:
 1. Lose that behaviour.
 2. Keep it, by stealing a bit from Prev in asserts builds.
 3. Crash on dereference instead, using the same technique.

Hans convinced me (because of the number of problems this and r278532
exposed on Windows) that we really need some assertion here, at least in
the short term.  I've opted for #3 since I think it catches more bugs.

I added only a couple of unit tests to root out specific bugs I hit
during bring-up, but otherwise this is tested implicitly via the
extensive usage throughout LLVM.

Planned follow-ups:
- Remove ilist_*sentinel_traits<T>.  Here I've just gutted them to
  prevent build failures in sub-projects.  Once I stop referring to them
  in sub-projects, I'll come back and delete them.
- Add ilist_base and move algorithms there.
- Check and fix move construction and assignment.

Eventually, there are other interesting directions:
- Rewrite reverse iterators, so that rbegin().getNodePtr()==&*rbegin().
  This allows much simpler logic when erasing elements during a reverse
  traversal.
- Remove ilist_traits::createNode, by deleting the remaining API that
  creates nodes.  Intrusive lists shouldn't be creating nodes
  themselves.
- Remove ilist_traits::deleteNode, by (1) asserting that lists are empty
  on destruction and (2) changing API that calls it to take a Deleter
  functor (intrusive lists shouldn't be in the memory management
  business).
- Reconfigure the remaining callback traits (addNodeToList, etc.) to be
  higher-level, pulling out a simple_ilist<T> that is much easier to
  read and understand.
- Allow tags (e.g., ilist_node<T,tag1> and ilist_node<T,tag2>) so that T
  can be a member of multiple intrusive lists.

llvm-svn: 279314

7 years agoRevert "[SimplifyCFG] Rewrite SinkThenElseCodeToEnd"
Reid Kleckner [Fri, 19 Aug 2016 20:22:39 +0000 (20:22 +0000)]
Revert "[SimplifyCFG] Rewrite SinkThenElseCodeToEnd"

This reverts commit r279229. It breaks intrinsic function calls in
diamonds.

llvm-svn: 279313

7 years agoReapply "ADT: Tidy up ilist_traits static asserts, NFC"
Duncan P. N. Exon Smith [Fri, 19 Aug 2016 20:17:23 +0000 (20:17 +0000)]
Reapply "ADT: Tidy up ilist_traits static asserts, NFC"

This spiritually reapplies r279012 (reverted in r279052) without the
r278974 parts.  The differences:

  - Only the HasGetNext trait exists here, so I've only cleaned up (and
    tested) it.  I still added HasObsoleteCustomization since I know
    this will be expanding when r278974 is reapplied.

  - I changed the unit tests to use static_assert to catch problems
    earlier in the build.

  - I added negative tests for the type traits.

Original commit message follows.

----

Change the ilist traits to use decltype instead of sizeof, and add
HasObsoleteCustomization so that additions to this list don't
need to be added in two places.

I suspect this will now work with MSVC, since the trait tested in
r278991 seems to work.  If for some reason it continues to fail on
Windows I'll follow up by adding back the #ifndef _MSC_VER.

llvm-svn: 279312

7 years agoGlobalISel: translate floating-point constants
Tim Northover [Fri, 19 Aug 2016 20:09:15 +0000 (20:09 +0000)]
GlobalISel: translate floating-point constants

llvm-svn: 279311

7 years agoGlobalISel: translate float/int conversion instructions.
Tim Northover [Fri, 19 Aug 2016 20:09:11 +0000 (20:09 +0000)]
GlobalISel: translate float/int conversion instructions.

llvm-svn: 279310

7 years agoGlobalISel: support translating select instructions.
Tim Northover [Fri, 19 Aug 2016 20:09:07 +0000 (20:09 +0000)]
GlobalISel: support translating select instructions.

llvm-svn: 279309

7 years agoGlobalISel: fix insert/extract to work on ConstantExprs too.
Tim Northover [Fri, 19 Aug 2016 20:09:03 +0000 (20:09 +0000)]
GlobalISel: fix insert/extract to work on ConstantExprs too.

No tests yet unfortunately (ConstantFolding reduces all supported constants to
ConstantInts before we get to translation). Soon.

llvm-svn: 279308

7 years agoGlobalISel: fix stale comment
Tim Northover [Fri, 19 Aug 2016 20:09:01 +0000 (20:09 +0000)]
GlobalISel: fix stale comment

llvm-svn: 279307

7 years agoGlobalISel: translate insertvalue instructions.
Tim Northover [Fri, 19 Aug 2016 20:08:55 +0000 (20:08 +0000)]
GlobalISel: translate insertvalue instructions.

This adds a G_INSERT instruction, which technically makes G_SEQUENCE redundant
(it's equivalent to a G_INSERT into an IMPLICIT_DEF). We'll leave G_SEQUENCE
for now though: it's likely to be far more common as it's a fundamental part of
legalization, so avoiding the mess and bloat of the extra IMPLICIT_DEFs is
probably worthwhile.

llvm-svn: 279306

7 years agoMachineScheduler: Add constructor functions for the DAGMutations
Tom Stellard [Fri, 19 Aug 2016 19:59:18 +0000 (19:59 +0000)]
MachineScheduler: Add constructor functions for the DAGMutations

Summary: This way they can be re-used by target-specific schedulers.

Reviewers: atrick, MatzeB, kparzysz

Subscribers: kparzysz, llvm-commits, MatzeB

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

llvm-svn: 279305

7 years ago[Hexagon] Add RUN line to test
Krzysztof Parzyszek [Fri, 19 Aug 2016 19:36:35 +0000 (19:36 +0000)]
[Hexagon] Add RUN line to test

llvm-svn: 279304