Commit Graph

259036 Commits

Author SHA1 Message Date
Roman Gareev e0d466342b Restore the initial ordering of dimensions before applying the pattern matching
Dimensions of band nodes can be implicitly permuted by the algorithm applied
during the schedule generation.

For example, in case of the following matrix-matrix multiplication,

for (i = 0; i < 1024; i++)
  for (k = 0; k < 1024; k++)
    for (j = 0; j < 1024; j++)
      C[i][j] += A[i][k] * B[k][j];

it can produce the following schedule tree

domain: "{ Stmt_for_body6[i0, i1, i2] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023 and
                                        0 <= i2 <= 1023 }"
child:
  schedule: "[{ Stmt_for_body6[i0, i1, i2] -> [(i0)] },
              { Stmt_for_body6[i0, i1, i2] -> [(i1)] },
              { Stmt_for_body6[i0, i1, i2] -> [(i2)] }]"
  permutable: 1
  coincident: [ 1, 1, 0 ]

The current implementation of the pattern matching optimizations relies on the
initial ordering of dimensions. Otherwise, it can produce the miscompilation
(e.g., [1]).

This patch helps to restore the initial ordering of dimensions by recreating
the band node when the corresponding conditions are satisfied.

Refs.:

[1] - https://bugs.llvm.org/show_bug.cgi?id=32500

Reviewed-by: Michael Kruse <llvm@meinersbur.de>

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

llvm-svn: 299662
2017-04-06 17:09:54 +00:00
Craig Topper d3115972bf [TSan] Adjust expectation for check_analyze.sh
r299658 fixed a case where InstCombine was replicating instructions instead of combining. Fixing this reduced the number of pushes and pops in the __tsan_read and __tsan_write functions.

Adjust the expectations to account for this after talking to Dmitry Vyukov.

llvm-svn: 299661
2017-04-06 17:09:08 +00:00
Davide Italiano ab932bcbfd [ADT] Add a generic breadth-first-search graph iterator.
This will be used in LCSSA to speed up the canonicalization.

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

llvm-svn: 299660
2017-04-06 17:03:04 +00:00
Stanislav Mekhanoshin ea57c38521 [AMDGPU] Eliminate barrier if workgroup size is not greater than wavefront size
If a workgroup size is known to be not greater than wavefront size
the s_barrier instruction is not needed since all threads are guarantied
to come to the same point at the same time.

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

llvm-svn: 299659
2017-04-06 16:48:30 +00:00
Craig Topper 3fc1225c18 [InstCombine] Fix a case where we weren't checking that an instruction had a single use resulting in extra instructions being created.
llvm-svn: 299658
2017-04-06 16:42:46 +00:00
Gabor Horvath edaf907d36 [clang-tidy] Temporarily disable a test-case that does not work on windows.
llvm-svn: 299657
2017-04-06 15:58:57 +00:00
Mehdi Amini ea7d7cd78a Revert "Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541"
This reverts commit r299652, 32bits MacOS is broken.

llvm-svn: 299656
2017-04-06 15:56:55 +00:00
James Henderson d983180778 Revert r299635 because it exposed a latent bug.
llvm-svn: 299655
2017-04-06 15:22:58 +00:00
Sam Kolton 9fa169601f [AMDGPU] Resubmit SDWA peephole: enable by default
Reviewers: vpykhtin, rampitec, arsenm

Subscribers: qcolombet, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 299654
2017-04-06 15:03:28 +00:00
Artem Dergachev da9e718fb4 [analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector"
Hopefully fix crashes by unshadowing the variable.


Original commit message:

A big part of the clone detection code is functionality for filtering clones and
clone groups based on different criteria. So far this filtering process was
hardcoded into the CloneDetector class, which made it hard to understand and,
ultimately, to extend.

This patch splits the CloneDetector's logic into a sequence of reusable
constraints that are used for filtering clone groups. These constraints
can be turned on and off and reodreder at will, and new constraints are easy
to implement if necessary.

Unit tests are added for the new constraint interface.

This is a refactoring patch - no functional change intended.

Patch by Raphael Isemann!

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

llvm-svn: 299653
2017-04-06 14:34:07 +00:00
Marshall Clow 02c162d71a Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541
llvm-svn: 299652
2017-04-06 14:32:42 +00:00
Alexander Kornienko 215604c252 [clang-tidy] Update docs and help message
llvm-svn: 299651
2017-04-06 14:27:00 +00:00
Alex Lorenz 6c2898a3e9 Avoid the -Wdocumentation-unknown-command warning in Clang's C API docs
rdar://20441985

llvm-svn: 299650
2017-04-06 14:03:25 +00:00
Alexander Kornienko 2561320f80 [clang-tidy] Add FormatStyle configuration option.
llvm-svn: 299649
2017-04-06 13:41:29 +00:00
Alex Lorenz a983213459 [ObjC++] Conversions from specialized to non-specialized Objective-C generic
object types should be preferred over conversions to other object pointers

This change ensures that Clang will select the correct overload for the
following code sample:

  void overload(Base *b);
  void overload(Derived *d);
  void test(Base<Base *> b) {
    overload(b); // Select overload(Base *), not overload(Derived *)
  }

rdar://20124827

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

llvm-svn: 299648
2017-04-06 13:06:34 +00:00
Jonas Paulsson 45c936ef86 [SelectionDAG] NFC patch removing a redundant check.
Since the BUILD_VECTOR has already been checked by
isBuildVectorOfConstantSDNodes() in SelectionDAG::getNode() for a
SIGN_EXTEND_INREG, it can be assumed that Op is always either undef or a
ConstantSDNode, and Ops.size() will always equal VT.getVectorNumElements().

llvm-svn: 299647
2017-04-06 13:00:37 +00:00
Alex Lorenz b4791c7595 Fix lambda to block conversion in C++17 by avoiding copy elision for the
lambda capture used by the created block

The commit r288866 introduced guaranteed copy elision to C++ 17. This
unfortunately broke the lambda to block conversion in C++17 (the compiler
crashes when performing IRGen). This commit fixes the conversion by avoiding
copy elision for the capture that captures the lambda that's used in the block
created by the lambda to block conversion process.

rdar://31385153

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

llvm-svn: 299646
2017-04-06 12:53:43 +00:00
Gabor Horvath e228f68811 Attempt to fix build bots after r299638.
llvm-svn: 299645
2017-04-06 12:49:35 +00:00
Dean Michael Berris d41c5ffc3e [XRay][compiler-rt] Remove unused local variable
The local was only referenced in assertions.

Follow-up to D31345.

llvm-svn: 299644
2017-04-06 11:27:53 +00:00
Simon Dardis 266f8f8d4c [Sema] Retarget test to a specific platform for consistent datasizes
Attempt to satisfy llvm-clang-x86_64-expensive-checks-win by targeting
x86_64-apple-darwin10 for Sema/vector-ops.c. The underlying failure is
due to datatype differences between platforms.

llvm-svn: 299643
2017-04-06 11:12:14 +00:00
Simon Pilgrim 4e682348a2 Wdocumentation fix
llvm-svn: 299642
2017-04-06 10:49:02 +00:00
Simon Dardis f81c995dab [Sema] Extend GetSignedVectorType to deal with non ExtVector types
This improves some error messages which would otherwise refer to
ext_vector_type types in contexts where there are no such types.

Factored out from D25866 at reviewer's request.

Reviewers: bruno

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

llvm-svn: 299641
2017-04-06 10:38:03 +00:00
Simon Pilgrim 77d3c770d3 [X86][MMX] Test showing failure to create MMX non-temporal store
llvm-svn: 299640
2017-04-06 10:32:30 +00:00
Vassil Vassilev 4b8e29d516 PR16106: Correct the docs to reflect the actual behavior of the interface.
llvm-svn: 299639
2017-04-06 10:05:46 +00:00
Gabor Horvath b3856d65ea [clang-tidy] Check for forwarding reference overload in constructors.
Patch by András Leitereg!

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

llvm-svn: 299638
2017-04-06 09:56:42 +00:00
Daniel Sanders 0b5293f6ae [globalisel][tablegen] Move <Target>InstructionSelector declarations to anonymous namespaces
Summary: This resolves the issue of tablegen-erated includes in the headers for non-GlobalISel builds in a simpler way than before.

Reviewers: qcolombet, ab

Reviewed By: ab

Subscribers: igorb, ab, mgorny, dberris, rovka, llvm-commits, kristof.beyls

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

llvm-svn: 299637
2017-04-06 09:49:34 +00:00
James Henderson 7ee227561e [ELF] Remove unnecessary cast and fix comments. NFC.
llvm-svn: 299636
2017-04-06 09:40:03 +00:00
James Henderson 8dd4c06a77 [ELF] Pad x86 executable sections with 0xcc int3 instructions
Executable sections should not be padded with zero by default. On some
architectures, 0x00 is the start of a valid instruction sequence, so can confuse
disassembly between InputSections (and indeed the start of the next InputSection
in some situations). Further, in the case of misjumps into padding, padding may
start to be executed silently.

On x86, the "0xcc" byte represents the int3 trap instruction. It is a single
byte long so can serve well as padding. This change switches x86 (and x86_64) to
use this value for padding in executable sections, if no linker script directive
overrides it. It also puts the behaviour into place making it easy to change the
behaviour of other targets when desired. I do not know the relevant instruction
sequences for trap instructions on other targets however, so somebody should add
this separately.

Because the old behaviour simply wrote padding in the whole section before
overwriting most of it, this change also modifies the padding algorithm to write
padding only where needed. This in turn has caused a small behaviour change with
regards to what values are written via Fill commands in linker scripts, bringing
it into line with ld.bfd. The fill value is now written starting from the end of
the previous block, which means that it always starts from the first byte of the
fill, whereas the old behaviour meant that the padding sometimes started mid-way
through the fill value. See the test changes for more details.

Reviewed by: ruiu

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

Bugzilla: http://bugs.llvm.org/show_bug.cgi?id=32227
llvm-svn: 299635
2017-04-06 09:29:08 +00:00
David Green 1b4b59a415 [ARM] Remove a dead ADD during the creation of TBBs
During the optimisation of jump tables in the constant island pass,
an extra ADD could be left over, now dead but not removed.

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

llvm-svn: 299634
2017-04-06 08:32:47 +00:00
Siddharth Bhat 5eeb1dd42e [Polly] [ScheduleOptimizer] Prevent incorrect tile size computation
Because Polly exposes parameters that directly influence tile size
calculations, one can setup situations like divide-by-zero.

Check against a possible divide-by-zero in getMacroKernelParams
and return early.

Also assert at the end of getMacroKernelParams that the block sizes
computed for matrices are positive (>= 1).

Tags: #polly

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

llvm-svn: 299633
2017-04-06 08:20:22 +00:00
Maxim Ostapenko e6b81315f7 Try to fix MAC buildbot after r299630
llvm-svn: 299632
2017-04-06 08:17:09 +00:00
Maxim Ostapenko 18afec1ba6 Try to fix windows buildbot after r299630
llvm-svn: 299631
2017-04-06 07:53:26 +00:00
Maxim Ostapenko fe863a6510 [lsan] Avoid segfaults during threads destruction under high load
This patch addresses two issues:

	* It turned out that suspended thread may have dtls->dtv_size == kDestroyedThread (-1)
	and LSan wrongly assumes that DTV is available. This leads to SEGV when LSan tries to
	iterate through DTV that is invalid.
	* In some rare cases GetRegistersAndSP can fail with errno 3 (ESRCH). In this case LSan
	assumes that the whole stack of a given thread is available. This is wrong because ESRCH
	can indicate that suspended thread was destroyed and its stack was unmapped. This patch
	properly handles ESRCH from GetRegistersAndSP in order to avoid invalid accesses to already
	unpapped threads stack.

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

llvm-svn: 299630
2017-04-06 07:42:27 +00:00
Dean Michael Berris 895171e6ee [XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.
Summary:
"short" is defined as an xray flag, and buffer rewinding happens for both exits
 and tail exits.

 I've made the choice to seek backwards finding pairs of FunctionEntry, TailExit
 record pairs and erasing them if the FunctionEntry occurred before exit from the
 currently exiting function. This is a compromise so that we don't skip logging
 tail calls if the function that they call into takes longer our duration.

 This works by counting the consecutive function and function entry, tail exit
 pairs that proceed the current point in the buffer. The buffer is rewound to
 check whether these entry points happened recently enough to be erased.

 It is still possible we will omit them if they call into a child function that
 is not instrumented which calls a fast grandchild that is instrumented before
 doing other processing.

Reviewers: pelikan, dberris

Reviewed By: dberris

Subscribers: llvm-commits

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

llvm-svn: 299629
2017-04-06 07:14:43 +00:00
Weiming Zhao fbe67da29b [Builtins] Fix div0 error in udivsi3
Summary: Need to save `lr` before bl to aeabi_div0

Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: llvm-commits

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

llvm-svn: 299628
2017-04-06 06:13:39 +00:00
Craig Topper f7298b0ef0 [InstSimplify] Add test cases for mixing add/sub i1 with xor of i1. Seems we can simplify in one direction but not the other.
llvm-svn: 299627
2017-04-06 05:48:06 +00:00
Craig Topper aa5f524095 [InstSimplify] Teach SimplifyAddInst and SimplifySubInst that vectors of i1 can be treated as Xor too.
llvm-svn: 299626
2017-04-06 05:28:41 +00:00
Shoaib Meenai 5dc5a8e5be [libc++] Respect Windows Store app CRT restrictions
Some CRT APIs are unavailable for Windows Store apps [1]. Detect when
we're targeting the Windows Store and don't try to refer to non-existent
CRT functions in that case. (This would otherwise lead to a compile
error when using the libc++ headers and compiling for Windows Store.)

[1] https://docs.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps

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

llvm-svn: 299625
2017-04-06 04:47:49 +00:00
Dean Michael Berris be65893bc7 [XRay][docs] Fix hyperlink to XRay doc
llvm-svn: 299624
2017-04-06 04:26:26 +00:00
Lang Hames f5593e2337 [Orc] Add missing header include for r299611.
llvm-svn: 299623
2017-04-06 04:12:47 +00:00
Craig Topper 2ca72f4971 Revert accidental commit of r299619.
llvm-svn: 299622
2017-04-06 04:04:10 +00:00
Craig Topper 6b15606051 Revert accidental commit of r299618
llvm-svn: 299621
2017-04-06 04:03:34 +00:00
Craig Topper 0491c15de3 [IR] Add commutable matchers for Add and Mul to go with the logic operations that are already present. NFC
llvm-svn: 299620
2017-04-06 04:02:33 +00:00
Craig Topper 5d7ece8895 bar
llvm-svn: 299619
2017-04-06 04:02:31 +00:00
Craig Topper faf5a8553c foo
llvm-svn: 299618
2017-04-06 04:02:28 +00:00
Tobias Grosser 0d622a4bf9 Update to isl-0.18-417-gb9e7334
This is a regular maintenance update.

llvm-svn: 299617
2017-04-06 03:41:47 +00:00
Keith Wyss e96152a944 [XRay] - Fix spelling error to test commit access.
Just a spelling change in a comment intended to test svn commit access.

llvm-svn: 299616
2017-04-06 03:32:01 +00:00
Rui Ueyama 5036cc6768 Create GOT and PLT entries early in scanRelocs().
scanRelocs() does a lot of things. It fills InputSection's Relocations vector,
making a decision whether a TLS relocation should be relaxed or not,
and making a decision whether a GOT/PLT slot needs to be created or not.

They don't actually have to be done in a single loop. I want to separate
them so that some of them can be run concurently. As a first step, this
patch moves PLT/GOT slot assignment to beginning of the loop, so that
they just fall through to the next statements. This should make it clear
that that code doesn't affect other parts of the loop.

llvm-svn: 299615
2017-04-06 03:30:51 +00:00
Rui Ueyama c2a49bf95c Remove Target::isTlsGlobalDynamicRel()
Relocations are abstracted as platform-independent R_TLS_* relocations,
so we don't need to check platform-specific ones to see if a relocation
is TLS GD.

llvm-svn: 299614
2017-04-06 03:30:32 +00:00
Jason Molenda 30169d5ef2 Update unittests/Host/SocketTest.cpp to also use the new
one-socket API.

llvm-svn: 299613
2017-04-06 03:16:44 +00:00