platform/upstream/llvm.git
7 years ago[InstCombine] Improve the expansion in SimplifyUsingDistributiveLaws to handle cases...
Craig Topper [Sat, 15 Jul 2017 21:49:49 +0000 (21:49 +0000)]
[InstCombine] Improve the expansion in SimplifyUsingDistributiveLaws to handle cases where one side doesn't simplify, but the other side resolves to an identity value

Summary:
If one side simplifies to the identity value for inner opcode, we can replace the value with just the operation that can't be simplified.

I've removed a couple now unneeded special cases in visitAnd and visitOr. There are probably other cases I missed.

Reviewers: spatel, majnemer, hfinkel, dberlin

Reviewed By: spatel

Subscribers: grandinj, llvm-commits, spatel

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

llvm-svn: 308111

7 years ago[X86][AVX] Regenerate tests with constant broadcast comments
Simon Pilgrim [Sat, 15 Jul 2017 21:17:35 +0000 (21:17 +0000)]
[X86][AVX] Regenerate tests with constant broadcast comments

llvm-svn: 308110

7 years ago[X86][AVX] Regenerate tests with constant broadcast comments
Simon Pilgrim [Sat, 15 Jul 2017 20:28:09 +0000 (20:28 +0000)]
[X86][AVX] Regenerate tests with constant broadcast comments

llvm-svn: 308109

7 years agoStrip trailing whitespace. NFCI
Simon Pilgrim [Sat, 15 Jul 2017 19:29:19 +0000 (19:29 +0000)]
Strip trailing whitespace. NFCI

llvm-svn: 308108

7 years ago[CodeView] Dump BuildInfoSym and ProcSym type indices
Reid Kleckner [Sat, 15 Jul 2017 18:10:39 +0000 (18:10 +0000)]
[CodeView] Dump BuildInfoSym and ProcSym type indices

I need to print the type index in hex so that I can match it in
FileCheck for a test I'm writing.

llvm-svn: 308107

7 years agoFix mis-use of std::lower_bound
Reid Kleckner [Sat, 15 Jul 2017 18:10:15 +0000 (18:10 +0000)]
Fix mis-use of std::lower_bound

Binary search in C++ is such a PITA. =/

llvm-svn: 308106

7 years ago[InstCombine] improve (1 << x) & 1 --> zext(x == 0) folding
Sanjay Patel [Sat, 15 Jul 2017 17:26:01 +0000 (17:26 +0000)]
[InstCombine] improve (1 << x) & 1 --> zext(x == 0) folding

1. Add a one-use check to prevent increasing instruction count.
2. Generalize the pattern matching to include vector types.

llvm-svn: 308105

7 years ago[InstCombine] Add test cases for (X & (Y | ~X)) -> (X & Y) where the not is an invert...
Craig Topper [Sat, 15 Jul 2017 17:09:23 +0000 (17:09 +0000)]
[InstCombine] Add test cases for (X & (Y | ~X)) -> (X & Y) where the not is an inverted compare. NFC

Do the same for (X | (Y & ~X)) -> (X | Y)

llvm-svn: 308104

7 years ago[InstCombine] Move 4 test cases from a test that didn't use FileCheck and merge them...
Craig Topper [Sat, 15 Jul 2017 17:09:22 +0000 (17:09 +0000)]
[InstCombine] Move 4 test cases from a test that didn't use FileCheck and merge them into a existing test file. NFC

llvm-svn: 308103

7 years ago[InstCombine] add tests for (1 << x) & 1 --> zext(x == 0) ; NFC
Sanjay Patel [Sat, 15 Jul 2017 15:55:07 +0000 (15:55 +0000)]
[InstCombine] add tests for (1 << x) & 1 --> zext(x == 0) ; NFC

This fold hit the trifecta:
1. It was untested.
2. It oversteps (multiuse is not checked, so increases instruction count).
3. It is incomplete (doesn't work for vectors).

llvm-svn: 308102

7 years ago[cxx_status] Fix typos.
Richard Smith [Sat, 15 Jul 2017 15:51:59 +0000 (15:51 +0000)]
[cxx_status] Fix typos.

llvm-svn: 308101

7 years ago[wasm] Update two tests for r308025 which causes scheduling changes due
Chandler Carruth [Sat, 15 Jul 2017 15:44:36 +0000 (15:44 +0000)]
[wasm] Update two tests for r308025 which causes scheduling changes due
to the newly improved AA information.

llvm-svn: 308100

7 years ago[cxx_status] Add approved Toronto WG21 motions.
Richard Smith [Sat, 15 Jul 2017 15:42:36 +0000 (15:42 +0000)]
[cxx_status] Add approved Toronto WG21 motions.

llvm-svn: 308099

7 years ago[InstCombine] allow (0 - x) & 1 --> x & 1 for vectors
Sanjay Patel [Sat, 15 Jul 2017 15:29:47 +0000 (15:29 +0000)]
[InstCombine] allow (0 - x) & 1 --> x & 1 for vectors

llvm-svn: 308098

7 years agoUpdate issues moved in Toronto
Marshall Clow [Sat, 15 Jul 2017 15:22:21 +0000 (15:22 +0000)]
Update issues moved in Toronto

llvm-svn: 308097

7 years ago[InstCombine] remove dead code/tests; NFCI
Sanjay Patel [Sat, 15 Jul 2017 15:01:33 +0000 (15:01 +0000)]
[InstCombine] remove dead code/tests; NFCI

These patterns and tests were added to InstSimplify with:
https://reviews.llvm.org/rL303004

llvm-svn: 308096

7 years agoRevert r308078 (and subsequent tweak in r308079) which introduces a test
Chandler Carruth [Sat, 15 Jul 2017 13:50:26 +0000 (13:50 +0000)]
Revert r308078 (and subsequent tweak in r308079) which introduces a test
that appears to exhibit non-determinism and is flaking on the bots
pretty consistently.

r308078: [ThinLTO] Ensure we always select the same function copy to import
r308079: Require asserts in new test that uses debug flag
llvm-svn: 308095

7 years ago[LoopInterchange] Add some optimization remarks.
Florian Hahn [Sat, 15 Jul 2017 13:13:19 +0000 (13:13 +0000)]
[LoopInterchange] Add some optimization remarks.

Reviewers: anemet, karthikthecool, blitz.opensource

Reviewed By: anemet

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 308094

7 years ago[Polly] Translate Scop::DomainMap to islpp
Tobias Grosser [Sat, 15 Jul 2017 12:41:32 +0000 (12:41 +0000)]
[Polly] Translate Scop::DomainMap to islpp

Reviewers: grosser, Meinersbur, bollu

Subscribers: pollydev

Tags: #polly

Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35453

llvm-svn: 308093

7 years agoUse ARC parsing rules for ns_returns_retained in MRC so that code can
John McCall [Sat, 15 Jul 2017 11:06:46 +0000 (11:06 +0000)]
Use ARC parsing rules for ns_returns_retained in MRC so that code can
be shared without warnings.  Build AttributedTypes to leave breadcrumbs
for tools like the static analyzer.  Warn about attempting to use the
attribute with incompatible return types.

llvm-svn: 308092

7 years ago[Bash-autocompletion] Fixed a bug on bash
Yuka Takahashi [Sat, 15 Jul 2017 09:09:51 +0000 (09:09 +0000)]
[Bash-autocompletion] Fixed a bug on bash

Summary: Maybe I mismerged when merging previous commits by hand.

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

llvm-svn: 308091

7 years ago[docs] AliasAnalysis: clarify that PartialAlias doesn't enforce
Nuno Lopes [Sat, 15 Jul 2017 09:09:24 +0000 (09:09 +0000)]
[docs] AliasAnalysis: clarify that PartialAlias doesn't enforce
objects to start at the same address

As discussed on the ML, there's consensus that this is what the implementations
do and it seems sensible.

llvm-svn: 308090

7 years ago[Polly] Use Isl c++ for InvalidDomainMap
Tobias Grosser [Sat, 15 Jul 2017 09:01:31 +0000 (09:01 +0000)]
[Polly] Use Isl c++ for InvalidDomainMap

Reviewers: grosser, Meinersbur, bollu

Subscribers: maxf, pollydev

Tags: #polly

Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35308

llvm-svn: 308089

7 years ago[PM/LCG] Teach the LazyCallGraph to maintain reference edges from every
Chandler Carruth [Sat, 15 Jul 2017 08:08:19 +0000 (08:08 +0000)]
[PM/LCG] Teach the LazyCallGraph to maintain reference edges from every
function to every defined function known to LLVM as a library function.

LLVM can introduce calls to these functions either by replacing other
library calls or by recognizing patterns (such as memset_pattern or
vector math patterns) and replacing those with calls. When these library
functions are actually defined in the module, we need to have reference
edges to them initially so that we visit them during the CGSCC walk in
the right order and can effectively rebuild the call graph afterward.

This was discovered when building code with Fortify enabled as that is
a common case of both inline definitions of library calls and
simplifications of code into calling them.

This can in extreme cases of LTO-ing with libc introduce *many* more
reference edges. I discussed a bunch of different options with folks but
all of them are unsatisfying. They either make the graph operations
substantially more complex even when there are *no* defined libfuncs, or
they introduce some other complexity into the callgraph. So this patch
goes with the simplest possible solution of actual synthetic reference
edges. If this proves to be a memory problem, I'm happy to implement one
of the clever techniques to save memory here.

llvm-svn: 308088

7 years ago[mips] Handle the `long-calls` feature flags in the MIPS backend
Simon Atanasyan [Sat, 15 Jul 2017 07:14:25 +0000 (07:14 +0000)]
[mips] Handle the `long-calls` feature flags in the MIPS backend

If the `long-calls` feature flags is enabled, disable use of the `jal`
instruction. Instead of that call a function by by first loading its
address into a register, and then using the contents of that register.

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

llvm-svn: 308087

7 years agoSystemZCodeGen: Update libdeps. r308024 introduced LoopDataPrefetchPass.
NAKAMURA Takumi [Sat, 15 Jul 2017 06:32:12 +0000 (06:32 +0000)]
SystemZCodeGen: Update libdeps. r308024 introduced LoopDataPrefetchPass.

llvm-svn: 308086

7 years agoClangApplyReplacementsTests: Add clangBasic in libdeps.
NAKAMURA Takumi [Sat, 15 Jul 2017 06:32:10 +0000 (06:32 +0000)]
ClangApplyReplacementsTests: Add clangBasic in libdeps.

r308015 introduced clangBasic to instantiate Diagnostics &c,

llvm-svn: 308085

7 years agoclang/test/FixIt/format.m: Tweak for i686, where ssize_t is int. (r308067)
NAKAMURA Takumi [Sat, 15 Jul 2017 06:14:47 +0000 (06:14 +0000)]
clang/test/FixIt/format.m: Tweak for i686, where ssize_t is int. (r308067)

llvm-svn: 308084

7 years agobpf: fix a compilation bug due to unused variable for release build
Yonghong Song [Sat, 15 Jul 2017 06:08:08 +0000 (06:08 +0000)]
bpf: fix a compilation bug due to unused variable for release build

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 308083

7 years agoAMDGPU: Return correct type during argument lowering
Matt Arsenault [Sat, 15 Jul 2017 05:52:59 +0000 (05:52 +0000)]
AMDGPU: Return correct type during argument lowering

The type needs to be casted back to the original argument type.
Fixes an assert that for some reason is only run when
using -debug.

Includes an additional combine to avoid test regressions
from having conversions mixed with multiple Assert[SZ]ext
nodes. On subtargets where i16 is legal, this was producing an i32
register with an i16 AssertZExt, truncated to i16 with another i8
AssertZExt.

t2: i32,ch = CopyFromReg t0, Register:i32 %vreg0
t3: i16 = truncate t2
t5: i16 = AssertZext t3, ValueType:ch:i8
t6: i8 = truncate t5
t7: i32 = zero_extend t6
llvm-svn: 308082

7 years ago[SLPVectorizer] Add an extra parameter to tryScheduleBundle function, NFCI.
Dinar Temirbulatov [Sat, 15 Jul 2017 05:43:54 +0000 (05:43 +0000)]
[SLPVectorizer] Add an extra parameter to tryScheduleBundle function, NFCI.

llvm-svn: 308081

7 years agobpf: generate better lowering code for certain select/setcc instructions
Yonghong Song [Sat, 15 Jul 2017 05:41:42 +0000 (05:41 +0000)]
bpf: generate better lowering code for certain select/setcc instructions

Currently, for code like below,
===
  inner_map = bpf_map_lookup_elem(outer_map, &port_key);
  if (!inner_map) {
    inner_map = &fallback_map;
  }
===
the compiler generates (pseudo) code like the below:
===
  I1: r1 = bpf_map_lookup_elem(outer_map, &port_key);
  I2: r2 = 0
  I3: if (r1 == r2)
  I4:   r6 = &fallback_map
  I5: ...
===

During kernel verification process, After I1, r1 holds a state
map_ptr_or_null. If I3 condition is not taken
(path [I1, I2, I3, I5]), supposedly r1 should become map_ptr.
Unfortunately, kernel does not recognize this pattern
and r1 remains map_ptr_or_null at insn I5. This will cause
verificaiton failure later on.

Kernel, however, is able to recognize pattern "if (r1 == 0)"
properly and give a map_ptr state to r1 in the above case.

LLVM here generates suboptimal code which causes kernel verification
failure. This patch fixes the issue by changing BPF insn pattern
matching and lowering to generate proper codes if the righthand
parameter of the above condition is a constant. A test case
is also added.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 308080

7 years agoRequire asserts in new test that uses debug flag
Teresa Johnson [Sat, 15 Jul 2017 05:27:57 +0000 (05:27 +0000)]
Require asserts in new test that uses debug flag

This should fix bot failures from r308078.

llvm-svn: 308079

7 years ago[ThinLTO] Ensure we always select the same function copy to import
Teresa Johnson [Sat, 15 Jul 2017 04:53:05 +0000 (04:53 +0000)]
[ThinLTO] Ensure we always select the same function copy to import

Summary:
Check if the first eligible callee is under the instruction threshold.
Checking this on the first eligible callee ensures that we don't end
up selecting different callees to import when we invoke this routine
with different thresholds due to reaching the callee via paths that
are shallower or hotter (when there are multiple copies, i.e. with
weak or linkonce linkage). We don't want to leave the decision of which
copy to import up to the backend.

Reviewers: mehdi_amini

Subscribers: inglorion, fhahn, llvm-commits

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

llvm-svn: 308078

7 years ago[ODRHash] Revert r307743 which reverted r307720
Richard Trieu [Sat, 15 Jul 2017 02:55:13 +0000 (02:55 +0000)]
[ODRHash] Revert r307743 which reverted r307720

Reapply r307720 to allow processing of constructors and destructors.  Reuse
the diagnostics for CXXMethodDecl for them.

llvm-svn: 308077

7 years ago[TTI] Refine the cost of EXT in getUserCost()
Haicheng Wu [Sat, 15 Jul 2017 02:12:16 +0000 (02:12 +0000)]
[TTI] Refine the cost of EXT in getUserCost()

Now, getUserCost() only checks the src and dst types of EXT to decide it is free
or not. This change first checks the types, then calls isExtFreeImpl(), and
check if EXT can form ExtLoad at last. Currently, only AArch64 has customized
implementation of isExtFreeImpl() to check if EXT can be folded into its use.

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

llvm-svn: 308076

7 years ago[libFuzzer] remove stale code
Kostya Serebryany [Sat, 15 Jul 2017 01:31:40 +0000 (01:31 +0000)]
[libFuzzer] remove stale code

llvm-svn: 308075

7 years ago[Dominators] Fix reachable visitation and reenable a unit test
Jakub Kuderski [Sat, 15 Jul 2017 01:27:16 +0000 (01:27 +0000)]
[Dominators] Fix reachable visitation and reenable a unit test

This fixes a minor bug in insertion to a reachable node that caused
DominatorTree.InsertDeleteExhaustive flakiness. The patch also adds
a new testcase for this exact failure.

llvm-svn: 308074

7 years ago[clang] Fix format test
Alexander Shaposhnikov [Sat, 15 Jul 2017 01:06:59 +0000 (01:06 +0000)]
[clang] Fix format test

This diff makes the test FixIt/format.m more robust.
The issue was caught by the build bot clang-cmake-thumbv7-a15.

Test plan: make check-all

llvm-svn: 308073

7 years ago[compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so
George Karpenkov [Sat, 15 Jul 2017 00:30:46 +0000 (00:30 +0000)]
[compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so

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

llvm-svn: 308072

7 years agoTry to fix modules build
Matthias Braun [Sat, 15 Jul 2017 00:29:25 +0000 (00:29 +0000)]
Try to fix modules build

Module builds somehow report an ambiguity between clang::Diagnostic and
clang::Tooling::Diagnostic. It seems as if one of the additional headers
brought in by the module brings the clang namespace to the toplevel. I
could not find out the reason for that, so for now I go with the simple
fix to bring the build back to green.

rdar://33321397

llvm-svn: 308071

7 years ago[Dominators] Temporarily disable a flaky unit test
Jakub Kuderski [Fri, 14 Jul 2017 23:49:12 +0000 (23:49 +0000)]
[Dominators] Temporarily disable a flaky unit test

The DominatorTree.InsertDeleteExhaustive uses a RNG with a
constant seed to generate different sequences of updates. The test
fails on some buildbots and this patch disables it for now.

llvm-svn: 308070

7 years ago[libFuzzer] Allow non-fuzzer args after -ignore_remaining_args=1
Justin Bogner [Fri, 14 Jul 2017 23:33:04 +0000 (23:33 +0000)]
[libFuzzer] Allow non-fuzzer args after -ignore_remaining_args=1

With this change, libFuzzer will ignore any arguments after a sigil
argument, but it will preserve these arguments at the end of the
command line when launching subprocesses. Using this, its possible to
handle positional and single-dash arguments to the program under test
by discarding everything up to -ignore_remaining_args=1 in
LLVMFuzzerInitialize.

llvm-svn: 308069

7 years agoAdd missing space to comment
Adrian Prantl [Fri, 14 Jul 2017 23:23:58 +0000 (23:23 +0000)]
Add missing space to comment

llvm-svn: 308068

7 years ago[clang] Fix handling of "%zd" format specifier
Alexander Shaposhnikov [Fri, 14 Jul 2017 22:57:00 +0000 (22:57 +0000)]
[clang] Fix handling of "%zd" format specifier

This diff addresses FIXME in lib/Analysis/PrintfFormatString.cpp
and makes PrintfSpecifier::getArgType return the correct type.
In particular, this change enables Clang to emit a warning on
incorrect using of "%zd"/"%zn" format specifiers.

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

Test plan: make check-all

llvm-svn: 308067

7 years agoAvoid using OutputSections::Sections.
Rafael Espindola [Fri, 14 Jul 2017 22:26:16 +0000 (22:26 +0000)]
Avoid using OutputSections::Sections.

This code runs after clearOutputSections.

llvm-svn: 308066

7 years ago[Dominators] Remove an extra semicolon and add a missing include.
Jakub Kuderski [Fri, 14 Jul 2017 22:24:15 +0000 (22:24 +0000)]
[Dominators] Remove an extra semicolon and add a missing include.

llvm-svn: 308065

7 years ago[Sanitizers] ASan and LSan allocator set errno on failure.
Alex Shlyapnikov [Fri, 14 Jul 2017 22:23:47 +0000 (22:23 +0000)]
[Sanitizers] ASan and LSan allocator set errno on failure.

Summary:
Set proper errno code on alloction failures and change some
implementations to satisfy their man-specified requirements:

LSan: valloc and memalign
ASan: pvalloc, memalign and posix_memalign

Changing both allocators in one patch since LSan depends on ASan allocator in some configurations.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 308064

7 years ago[Sanitizers] LSan allocator set errno on failure.
Alex Shlyapnikov [Fri, 14 Jul 2017 22:23:46 +0000 (22:23 +0000)]
[Sanitizers] LSan allocator set errno on failure.

Set proper errno code on alloction failures and change valloc and
memalign implementations to satisfy their man-specified requirements.

llvm-svn: 308063

7 years ago[Dominators] Implement incremental deletions
Jakub Kuderski [Fri, 14 Jul 2017 21:58:53 +0000 (21:58 +0000)]
[Dominators] Implement incremental deletions

Summary:
This patch implements incremental edge deletions.

It also makes DominatorTreeBase store a pointer to the parent function. The parent function is needed to perform full rebuilts during some deletions, but it is also used to verify that inserted and deleted edges come from the same function.

Reviewers: dberlin, davide, grosser, sanjoy, brzycki

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 308062

7 years ago[libFuzzer] fix stats during merge
Kostya Serebryany [Fri, 14 Jul 2017 21:48:19 +0000 (21:48 +0000)]
[libFuzzer] fix stats during merge

llvm-svn: 308061

7 years ago[AArch64] Avoid selecting XZR inline ASM memory operand
Yi Kong [Fri, 14 Jul 2017 21:46:16 +0000 (21:46 +0000)]
[AArch64] Avoid selecting XZR inline ASM memory operand

Restricting register class to PointerRegClass for memory operands.

Also fix the PointerRegClass for AArch64 from GPR64 to GPR64sp, since
XZR cannot hold a memory pointer while SP is.

Fixes PR33134.

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

llvm-svn: 308060

7 years ago[AArch64][Falkor] Avoid HW prefetcher tag collisions (step 1)
Geoff Berry [Fri, 14 Jul 2017 21:44:12 +0000 (21:44 +0000)]
[AArch64][Falkor] Avoid HW prefetcher tag collisions (step 1)

Summary:
This patch is the first step in reducing HW prefetcher instruction tag
collisions in inner loops for Falkor.  It adds a pass that annotates IR
loads with metadata to indicate that they are known to be strided loads,
and adds a target lowering hook that translates this metadata to a
target-specific MachineMemOperand flag.

A follow on change will use this MachineMemOperand flag to re-write
instructions to reduce tag collisions.

Reviewers: mcrosier, t.p.northover

Subscribers: aemerson, rengolin, mgorny, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 308059

7 years ago[Dominators] Add a missing include
Jakub Kuderski [Fri, 14 Jul 2017 21:38:15 +0000 (21:38 +0000)]
[Dominators] Add a missing include

llvm-svn: 308058

7 years agoPass OutputSectionCommand to getOSThunkSec. NFC.
Rafael Espindola [Fri, 14 Jul 2017 21:37:10 +0000 (21:37 +0000)]
Pass OutputSectionCommand to getOSThunkSec. NFC.

llvm-svn: 308057

7 years agoPass OutputSectionCommand to forEachExecInputSection's callback.
Rafael Espindola [Fri, 14 Jul 2017 21:33:14 +0000 (21:33 +0000)]
Pass OutputSectionCommand to forEachExecInputSection's callback.

NFC, just makes the OutputSectionCommand available.

llvm-svn: 308056

7 years ago[AMDGPU] Throw away more dead code. NFCI.
Davide Italiano [Fri, 14 Jul 2017 21:20:29 +0000 (21:20 +0000)]
[AMDGPU] Throw away more dead code. NFCI.

llvm-svn: 308055

7 years ago[Dominators] Implement incremental insertions
Jakub Kuderski [Fri, 14 Jul 2017 21:17:33 +0000 (21:17 +0000)]
[Dominators] Implement incremental insertions

Summary:
This patch introduces incremental edge insertions based on the Depth Based Search algorithm.

Insertions should work for both dominators and postdominators.

Reviewers: dberlin, grosser, davide, sanjoy, brzycki

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 308054

7 years ago[Sanitizers] Scudo allocator set errno on failure.
Alex Shlyapnikov [Fri, 14 Jul 2017 21:17:16 +0000 (21:17 +0000)]
[Sanitizers] Scudo allocator set errno on failure.

Summary:
Set proper errno code on alloction failure and change pvalloc and
posix_memalign implementation to satisfy their man-specified
requirements.

Reviewers: cryptoad

Subscribers: llvm-commits

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

llvm-svn: 308053

7 years agoFix mixed line terminators. NFC.
Dimitry Andric [Fri, 14 Jul 2017 21:14:58 +0000 (21:14 +0000)]
Fix mixed line terminators. NFC.

llvm-svn: 308052

7 years ago[EarlyCSE] Handle calls with no MemorySSA info.
Geoff Berry [Fri, 14 Jul 2017 20:13:21 +0000 (20:13 +0000)]
[EarlyCSE] Handle calls with no MemorySSA info.

Summary:
When checking for memory dependencies between calls using MemorySSA,
handle cases where the calls have no MemoryAccess associated with them
because the AA analysis being used has determined that the call does not
read/write memory.

Fixes PR33756

Reviewers: dberlin, davide

Subscribers: mcrosier, llvm-commits, Prazek

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

llvm-svn: 308051

7 years ago[JumpThreading] Add a pattern to TryToUnfoldSelectInCurrBB()
Haicheng Wu [Fri, 14 Jul 2017 19:16:47 +0000 (19:16 +0000)]
[JumpThreading] Add a pattern to TryToUnfoldSelectInCurrBB()

Add the following pattern to TryToUnfoldSelectInCurrBB()

bb:
   %p = phi [0, %bb1], [1, %bb2], [0, %bb3], [1, %bb4], ...
   %c = cmp %p, 0
   %s = select %c, trueval, falseval

The Select in the above pattern will be unfolded and then jump-threaded. The
current implementation does not allow CMP in the middle of PHI and Select.

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

llvm-svn: 308050

7 years ago[Hexagon] Replace ISD opcode VPACK with VPACKE/VPACKO, NFC
Krzysztof Parzyszek [Fri, 14 Jul 2017 19:02:32 +0000 (19:02 +0000)]
[Hexagon] Replace ISD opcode VPACK with VPACKE/VPACKO, NFC

This breaks up pack-even and pack-odd into two separate operations.

llvm-svn: 308049

7 years agoFix flag names in @available docs.
Nico Weber [Fri, 14 Jul 2017 18:52:30 +0000 (18:52 +0000)]
Fix flag names in @available docs.

llvm-svn: 308048

7 years ago[AMDGPU] Garbage collect dead code. NFCI.
Davide Italiano [Fri, 14 Jul 2017 18:47:29 +0000 (18:47 +0000)]
[AMDGPU] Garbage collect dead code. NFCI.

Unbreaks the build with GCC7.

llvm-svn: 308047

7 years agoFix link in docs.
Nico Weber [Fri, 14 Jul 2017 18:45:36 +0000 (18:45 +0000)]
Fix link in docs.

llvm-svn: 308046

7 years agodo more processing in clang-fuzzer (use EmitAssemblyAction)
Kostya Serebryany [Fri, 14 Jul 2017 18:42:07 +0000 (18:42 +0000)]
do more processing in clang-fuzzer (use EmitAssemblyAction)

Summary: use EmitAssemblyAction in clang-fuzzer

Reviewers: klimek, rsmith

Reviewed By: klimek

Subscribers: cfe-commits, mgorny

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

llvm-svn: 308045

7 years agoAdd documentation for @available
Nico Weber [Fri, 14 Jul 2017 18:40:52 +0000 (18:40 +0000)]
Add documentation for @available

https://reviews.llvm.org/D35379

llvm-svn: 308044

7 years agoPrevent ClangTools from generating dependency files.
Sterling Augustine [Fri, 14 Jul 2017 18:33:30 +0000 (18:33 +0000)]
Prevent ClangTools from generating dependency files.

D34304 created a way for ToolInvocations to conditionally generate
dependency files, and updated call sites to preserve the old behavior
of not generating them by default. CompilerInvocations...

Summary:
...are yet another
call-path that needs updating to preserve the old behavior.

Reviewers: klimek, echristo

Reviewed By: echristo

Subscribers: echristo, cfe-commits

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

llvm-svn: 308043

7 years ago[TableGen][MC] Fix a few places where we didn't hide the underlying type of LaneBitma...
Craig Topper [Fri, 14 Jul 2017 18:30:09 +0000 (18:30 +0000)]
[TableGen][MC] Fix a few places where we didn't hide the underlying type of LaneBitmask very well.

One place compared with 32, which I've replaced with LaneBitmask::BitWidth.

The other places are shifts of a constant 1 by a lane number. But if LaneBitmask were to be a larger type than 32-bits like 64-bits, the 1 would need to be 1ULL to do a 64-bit shift. To hide this I've added a LanebitMask::getLane that hides the shift and make sures the 1 is casted to correct type first.

llvm-svn: 308042

7 years ago[Dominators] Update Clang's DominatorTree to use the new template argument
Jakub Kuderski [Fri, 14 Jul 2017 18:26:21 +0000 (18:26 +0000)]
[Dominators] Update Clang's DominatorTree to use the new template argument

Summary: This patch makes the Clang's DominatorTree use the new IsPostDom template argument for DominatorTreeBase.

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 308041

7 years ago[Dominators] Make IsPostDominator a template parameter
Jakub Kuderski [Fri, 14 Jul 2017 18:26:09 +0000 (18:26 +0000)]
[Dominators] Make IsPostDominator a template parameter

Summary:
DominatorTreeBase used to have IsPostDominators (bool) member to indicate if the tree is a dominator or a postdominator tree. This made it possible to switch between the two 'modes' at runtime, but it isn't used in practice anywhere.

This patch makes IsPostDominator a template argument. This way, it is easier to switch between different algorithms at compile-time based on this argument and design external utilities around it. It also makes it impossible to incidentally assign a postdominator tree to a dominator tree (and vice versa), and to further simplify template code in GenericDominatorTreeConstruction.

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 308040

7 years ago[AMDGPU] Do not insert an instruction into worklist twice in movetovalu
Alfred Huang [Fri, 14 Jul 2017 17:56:55 +0000 (17:56 +0000)]
[AMDGPU] Do not insert an instruction into worklist twice in movetovalu

In moveToVALU(), move to vector ALU is performed, all instrs in
the use chain will be visited. We do not want the same node to be
pushed to the visit worklist more than once.

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

llvm-svn: 308039

7 years agoUnconditionally use .init_array instead of .ctors on Solaris.
Aaron Ballman [Fri, 14 Jul 2017 17:49:52 +0000 (17:49 +0000)]
Unconditionally use .init_array instead of .ctors on Solaris.

Patch by Fedor Sergeev

llvm-svn: 308038

7 years ago[clang] Add getSignedSizeType method
Alexander Shaposhnikov [Fri, 14 Jul 2017 17:30:14 +0000 (17:30 +0000)]
[clang] Add getSignedSizeType method

C11 standard refers to the signed counterpart of the type size_t in
the paragraph 7.21.6.1 where it defines d, i, o, u, x, or x conversion specifiers
(in printf format string).
In Clang there is a FIXME (in lib/Analysis/PrintfFormatString.cpp) for this case
(which is not handled correctly at the moment).
This diff adds getSignedSizeType method to TargetInfo and exposes it
in ASTContext similarly to how it is done for getSizeType.
lib/Analysis/PrintfFormatString.cpp will be changed in a separate commit.

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

Test plan: make check-all

llvm-svn: 308037

7 years ago[Dominators] Simplify block and node printing
Jakub Kuderski [Fri, 14 Jul 2017 16:56:35 +0000 (16:56 +0000)]
[Dominators] Simplify block and node printing

Summary:
This patch adds `BlockPrinter`-- a small wrapper for printing CFG nodes and DomTree nodes to `raw_ostream`. It is meant to be only used internally, for debugging and printing errors.

Reviewers: dberlin, sanjoy, grosser, davide

Reviewed By: grosser, davide

Subscribers: llvm-commits

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

llvm-svn: 308036

7 years ago[Hexagon] Add intrinsics for data cache operations
Krzysztof Parzyszek [Fri, 14 Jul 2017 16:01:24 +0000 (16:01 +0000)]
[Hexagon] Add intrinsics for data cache operations

This is the clang part, adding support for
  void __builtin_HEXAGON_Y2_dccleana(void*);
  void __builtin_HEXAGON_Y2_dccleaninva(void*);
  void __builtin_HEXAGON_Y2_dcinva(void*);
  void __builtin_HEXAGON_Y2_dczeroa(void*);
  void __builtin_HEXAGON_Y4_l2fetch(void*, unsigned);
  void __builtin_HEXAGON_Y5_l2fetch(void*, unsigned long long);
Requires r308032.

llvm-svn: 308035

7 years ago[ELF] - Update testcases after LLVM update. (D35351)
George Rimar [Fri, 14 Jul 2017 16:00:34 +0000 (16:00 +0000)]
[ELF] - Update testcases after LLVM update. (D35351)

llvm-svn: 308034

7 years ago[llvm-readobj] - Teach readobj to print DT_FILTER dynamic tag in human readable form.
George Rimar [Fri, 14 Jul 2017 16:00:16 +0000 (16:00 +0000)]
[llvm-readobj] - Teach readobj to print DT_FILTER dynamic tag in human readable form.

Nothing special here, output format is similar to the format
used by binutils readelf and ELF Tool Chain readelf.

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

llvm-svn: 308033

7 years ago[Hexagon] Add intrinsics for data cache operations
Krzysztof Parzyszek [Fri, 14 Jul 2017 15:58:48 +0000 (15:58 +0000)]
[Hexagon] Add intrinsics for data cache operations

This is the LLVM part, adding definitions for
  void @llvm.hexagon.Y2.dccleana(i8*)
  void @llvm.hexagon.Y2.dccleaninva(i8*)
  void @llvm.hexagon.Y2.dcinva(i8*)
  void @llvm.hexagon.Y2.dczeroa(i8*)
  void @llvm.hexagon.Y4.l2fetch(i8*, i32)
  void @llvm.hexagon.Y5.l2fetch(i8*, i64)
The clang part will follow.

llvm-svn: 308032

7 years ago[InstCombine] convert bitwise (in)equality checks to logical ops (PR32401)
Sanjay Patel [Fri, 14 Jul 2017 15:09:49 +0000 (15:09 +0000)]
[InstCombine] convert bitwise (in)equality checks to logical ops (PR32401)

As discussed in:
https://bugs.llvm.org/show_bug.cgi?id=32401

we have a backend transform to undo this:
https://reviews.llvm.org/rL299542

when it's likely that the xor version leads to better codegen, but we want
this form in IR for better analysis and simplification potential.

llvm-svn: 308031

7 years agoRevert "Reland "[mips][mt][6/7] Add support for mftr, mttr instructions.""
Simon Dardis [Fri, 14 Jul 2017 15:08:05 +0000 (15:08 +0000)]
Revert "Reland "[mips][mt][6/7] Add support for mftr, mttr instructions.""

FileCheck is crashing on in the input file, so reverting again while
I investigate.

This reverts r308023.

llvm-svn: 308030

7 years ago[InstCombine] add tests for PR32401; NFC
Sanjay Patel [Fri, 14 Jul 2017 14:43:28 +0000 (14:43 +0000)]
[InstCombine] add tests for PR32401; NFC

Also, add comments to a couple of tests that could be moved out of instcombine.

llvm-svn: 308029

7 years ago[SystemZ] Minor fixing in SystemZScheduleZ196.td
Jonas Paulsson [Fri, 14 Jul 2017 14:30:46 +0000 (14:30 +0000)]
[SystemZ]  Minor fixing in SystemZScheduleZ196.td

Some minor corrections for the recently added instructions.

Review: Ulrich Weigand
llvm-svn: 308028

7 years ago[InstCombine] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 14 Jul 2017 14:29:11 +0000 (14:29 +0000)]
[InstCombine] auto-generate complete test checks; NFC

llvm-svn: 308027

7 years agoImprove Aliasing of operations to static alloca
Nirav Dave [Fri, 14 Jul 2017 13:56:21 +0000 (13:56 +0000)]
Improve Aliasing of operations to static alloca

Recommiting after adding check to avoid miscomputing alias information
on addresses of the same base but different subindices.

Memory accesses offset from frame indices may alias, e.g., we
may merge write from function arguments passed on the stack when they
are contiguous. As a result, when checking aliasing, we consider the
underlying frame index's offset from the stack pointer.

Static allocs are realized as stack objects in SelectionDAG, but its
offset is not set until post-DAG causing DAGCombiner's alias check to
consider access to static allocas to frequently alias. Modify isAlias
to consider access between static allocas and access from other frame
objects to be considered aliasing.

Many test changes are included here. Most are fixes for tests which
indirectly relied on our aliasing ability and needed to be modified to
preserve their original intent.

The remaining tests have minor improvements due to relaxed
ordering. The exception is CodeGen/X86/2011-10-19-widen_vselect.ll
which has a minor degradation dispite though the pre-legalized DAG is
improved.

Reviewers: rnk, mkuper, jonpa, hfinkel, uweigand

Reviewed By: rnk

Subscribers: sdardis, nemanjai, javed.absar, llvm-commits

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

llvm-svn: 308025

7 years ago[SystemZ] Enable LoopDataPrefetch pass.
Jonas Paulsson [Fri, 14 Jul 2017 13:52:38 +0000 (13:52 +0000)]
[SystemZ]  Enable LoopDataPrefetch pass.

Loop data prefetching has shown some improvements on benchmarks, and is
enabled at -O1 and above.

Review: Ulrich Weigand
llvm-svn: 308024

7 years agoReland "[mips][mt][6/7] Add support for mftr, mttr instructions.""
Simon Dardis [Fri, 14 Jul 2017 13:44:12 +0000 (13:44 +0000)]
Reland "[mips][mt][6/7] Add support for mftr, mttr instructions.""

Unlike many other instructions, these instructions have aliases which
take coprocessor registers, gpr register, accumulator (and dsp accumulator)
registers, floating point registers, floating point control registers and
coprocessor 2 data and control operands.

For the moment, these aliases are treated as pseudo instructions which are
expanded into the underlying instruction. As a result, disassembling these
instructions shows the underlying instruction and not the alias.

Reviewers: slthakur, atanasyan

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

The last version of this patch broke one of the expensive checks buildbots,
this version changes the failing test/MC/Mips/mt/invalid.s and other invalid
tests to write the errors to a file and run FileCheck on that, rather than
relying on the 'not llvm-mc ... <%s 2>&1 | Filecheck %s' idiom.

Hopefully this will sarisfy the buildbot.

llvm-svn: 308023

7 years ago[clang-tidy] Minor documentation fix. NFC.
Gabor Horvath [Fri, 14 Jul 2017 12:31:21 +0000 (12:31 +0000)]
[clang-tidy] Minor documentation fix. NFC.

llvm-svn: 308022

7 years ago[clang-tidy] Add bugprone-undefined-memory-manipulation check
Gabor Horvath [Fri, 14 Jul 2017 12:20:19 +0000 (12:20 +0000)]
[clang-tidy] Add bugprone-undefined-memory-manipulation check

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 308021

7 years ago[clang-tidy] Add bugprone-suspicious-memset-usage check
Gabor Horvath [Fri, 14 Jul 2017 12:15:55 +0000 (12:15 +0000)]
[clang-tidy] Add bugprone-suspicious-memset-usage check

Created new module bugprone and placed the check in that.

Finds memset() calls with potential mistakes in their arguments.
Replaces and extends the existing google-runtime-memset-zero-length check.

Cases covered:
* Fill value is a character '0'. Integer 0 might have been intended.
* Fill value is out of char range and gets truncated.
* Byte count is zero. Potentially swapped with the fill value argument.

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 308020

7 years agotsan: optimize sync clock memory consumption
Dmitry Vyukov [Fri, 14 Jul 2017 11:30:06 +0000 (11:30 +0000)]
tsan: optimize sync clock memory consumption

This change implements 2 optimizations of sync clocks that reduce memory consumption:

Use previously unused first level block space to store clock elements.
Currently a clock for 100 threads consumes 3 512-byte blocks:

2 64-bit second level blocks to store clock elements
+1 32-bit first level block to store indices to second level blocks
Only 8 bytes of the first level block are actually used.
With this change such clock consumes only 2 blocks.

Share similar clocks differing only by a single clock entry for the current thread.
When a thread does several release operations on fresh sync objects without intervening
acquire operations in between (e.g. initialization of several fields in ctor),
the resulting clocks differ only by a single entry for the current thread.
This change reuses a single clock for such release operations. The current thread time
(which is different for different clocks) is stored in dirty entries.

We are experiencing issues with a large program that eats all 64M clock blocks
(32GB of non-flushable memory) and crashes with dense allocator overflow.
Max number of threads in the program is ~170 which is currently quite unfortunate
(consume 4 blocks per clock). Currently it crashes after consuming 60+ GB of memory.
The first optimization brings clock block consumption down to ~40M and
allows the program to work. The second optimization further reduces block consumption
to "modest" 16M blocks (~8GB of RAM) and reduces overall RAM consumption to ~30GB.

Measurements on another real world C++ RPC benchmark show RSS reduction
from 3.491G to 3.186G and a modest speedup of ~5%.

Go parallel client/server HTTP benchmark:
https://github.com/golang/benchmarks/blob/master/http/http.go
shows RSS reduction from 320MB to 240MB and a few percent speedup.

Reviewed in https://reviews.llvm.org/D35323

llvm-svn: 308018

7 years agoReverting commit 308011.
Zoran Jovanovic [Fri, 14 Jul 2017 10:52:22 +0000 (10:52 +0000)]
Reverting commit 308011.

llvm-svn: 308017

7 years ago[index] Added a method indexTopLevelDecls to run indexing on a list of Decls.
Ilya Biryukov [Fri, 14 Jul 2017 10:47:45 +0000 (10:47 +0000)]
[index] Added a method indexTopLevelDecls to run indexing on a list of Decls.

Summary:
We need it in clangd for refactoring that replaces ASTUnit
with manual AST management.

Reviewers: akyrtzi, benlangmuir, arphaman, klimek

Reviewed By: arphaman

Subscribers: cfe-commits

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

llvm-svn: 308016

7 years ago[Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML output
Alexander Kornienko [Fri, 14 Jul 2017 10:37:46 +0000 (10:37 +0000)]
[Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML output

Summary:
To get properly integration Clang-Tidy with CLion IDE, next things were implemented:
* Preserve `Message`, `FileOffset`, `FilePath` in the clang-tidy output.
* Export all diagnostics, not just the ones with fixes
* Test-cases

Reviewers: alexfh, ilya-biryukov

Subscribers: mgorny, JDevlieghere, xazax.hun, cfe-commits

Tags: #clang-tools-extra

Patch by Vladimir Plyashkun!

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

llvm-svn: 308015

7 years ago[Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML output
Alexander Kornienko [Fri, 14 Jul 2017 10:37:44 +0000 (10:37 +0000)]
[Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML output

Summary:
To get properly integration Clang-Tidy with CLion IDE, next things were implemented:
1) Preserve `Message`, `FileOffset`, `FilePath` in the clang-tidy output.
2) Export all diagnostics, not just the ones with fixes
3) Test-cases

Reviewers: klimek, ilya-biryukov, alexfh

Reviewed By: alexfh

Subscribers: alexfh, JDevlieghere, mgorny, xazax.hun, cfe-commits, klimek

Tags: #clang-tools-extra

Patch by Vladimir Plyashkun!

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

llvm-svn: 308014

7 years agoupdate isl to: isl-0.18-791-ga22eb92
Tobias Grosser [Fri, 14 Jul 2017 10:36:00 +0000 (10:36 +0000)]
update isl to: isl-0.18-791-ga22eb92

This is a regular maintenance update

llvm-svn: 308013

7 years ago[analyzer] Add annotation for functions taking user-facing strings
Erik Verbruggen [Fri, 14 Jul 2017 10:24:36 +0000 (10:24 +0000)]
[analyzer] Add annotation for functions taking user-facing strings

There was already a returns_localized_nsstring annotation to indicate
that the return value could be passed to UIKit methods that would
display them. However, those UIKit methods were hard-coded, and it was
not possible to indicate that other classes/methods in a code-base would
do the same.

The takes_localized_nsstring annotation can be put on function
parameters and selector parameters to indicate that those will also show
the string to the user.

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

llvm-svn: 308012

7 years ago[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
Zoran Jovanovic [Fri, 14 Jul 2017 10:13:11 +0000 (10:13 +0000)]
[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
Author: milena.vujosevic.janicic
Reviewers: sdardis
The patch extends size reduction pass for MicroMIPS.
The following instructions are examined and transformed, if possible:
ADDIU instruction is transformed into 16-bit instruction ADDIUSP
ADDIU instruction is transformed into 16-bit instruction ADDIUR1SP
Function InRange is changed to avoid left shifting of negative values, since
that caused some sanitizer tests to fail (so the previous patch
Differential Revision: https://reviews.llvm.org/D34511

llvm-svn: 308011

7 years ago[PPCGCodeGeneration] Fix runtime check adjustments since they make assumptions about...
Siddharth Bhat [Fri, 14 Jul 2017 10:00:25 +0000 (10:00 +0000)]
[PPCGCodeGeneration] Fix runtime check adjustments since they make assumptions about BB layout.

- There is a conditional branch that is used to switch between the old
   and new versions of the code.

- If we detect that the build was unsuccessful, `PPCGCodeGeneration` will
  change the runtime check to be always set to false.

- To actually *reach* this runtime check instruction, `PPCGCodeGeneration`
  was using assumptions about the layout of the BBs.

- However, invariant load hoisting violates this assumption by inserting
  an extra basic block in the middle.

- Fix the assumption on the layout by having `createScopConditionally`
   return the conditional branch instruction.

- Use this reference to set to always-false.

llvm-svn: 308010