Commit Graph

271109 Commits

Author SHA1 Message Date
Matt Arsenault 3ced3d90c3 InstSimplify: canonicalize is idempotent
llvm-svn: 312685
2017-09-07 01:21:43 +00:00
Richard Smith cd4a7a461f [modules ts] Ensure that module linkage variables are always emitted and always have their name mangled.
llvm-svn: 312684
2017-09-07 00:55:55 +00:00
Peter Collingbourne 264d7c9021 LTO: Remove unnecessary Windows support code.
I empirically verified that open files can in fact be renamed on
Windows with sys::fs::rename, so remove the incorrect code and comment.

llvm-svn: 312683
2017-09-07 00:55:00 +00:00
Justin Lebar 3310888aec [CUDA] Add device overloads for non-placement new/delete.
Summary:
Tests have to live in the test-suite, and so will come in a separate
patch.

Fixes PR34360.

Reviewers: tra

Subscribers: llvm-commits, sanjoy

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

llvm-svn: 312681
2017-09-07 00:37:20 +00:00
Petr Hosek d7df9b20a2 Reland "[llvm-objcopy] Add support for relocations"
This change adds support for SHT_REL and SHT_RELA sections in
llvm-objcopy.

Patch by Jake Ehrlich

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

llvm-svn: 312680
2017-09-06 23:41:02 +00:00
Eugene Zelenko 92334e07ca [Pass] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 312679
2017-09-06 23:05:38 +00:00
Zvi Rackover d635eeb01a Util: Improve update_llc_test_checks to scrub macosx-style assembly annotations
Summary:
In D37523 Sanjay pointed out that the tool does not scrub macosx-style 'End of Function' annotations,
where the comments begin with a double-#.

I tested this patch by verifying all existing occurences of 'End function' are scrubbed:
find ./test/CodeGen/X86 -name '*.ll' | xargs grep -l "End function" | xargs utils/update_llc_test_checks.py --llc-binary build/bin/llc

Reviewers: spatel, chandlerc, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 312678
2017-09-06 23:04:28 +00:00
Mandeep Singh Grang 85570510ae [StaticAnalyzer] Fix failures due to the iteration order of ExplodedNode
Summary:
This fixes failures seen in the reverse iteration builder:
http://lab.llvm.org:8011/builders/reverse-iteration/builds/26

Failing Tests (4):
    Clang :: Analysis/MisusedMovedObject.cpp
    Clang :: Analysis/keychainAPI.m
    Clang :: Analysis/loop-unrolling.cpp
    Clang :: Analysis/malloc.c

Reviewers: zaks.anna, bkramer, chandlerc, krememek, nikhgupt

Reviewed By: zaks.anna

Subscribers: dcoughlin, NoQ, cfe-commits

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

llvm-svn: 312677
2017-09-06 22:54:59 +00:00
Stanislav Mekhanoshin 442e28dd42 [AMDGPU] Use v_pk_max_f16 for fcanonicalize
Differential Revision: https://reviews.llvm.org/D37325

llvm-svn: 312676
2017-09-06 22:27:29 +00:00
Rafael Espindola 17e93d28f2 Simplify type. NFC.
llvm-svn: 312675
2017-09-06 22:16:32 +00:00
Sam Clegg e7a60708ff [WebAssembly] Only treat imports/exports as symbols when reading relocatable object files
This change only treats imported and exports functions and globals
as symbol table entries the object has a "linking" section (i.e. it is
relocatable object file).

In this case all globals must be of type I32 and initialized with
i32.const.  This was previously being assumed but not checked for and
was causing a failure on big endian machines due to using the wrong
value of then union.

See: https://bugs.llvm.org/show_bug.cgi?id=34487

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

llvm-svn: 312674
2017-09-06 22:05:41 +00:00
Rui Ueyama f2f4e033b4 Removes redundant `llvm::`, add comments and simplify a return type of a function.
No functional change intended.

llvm-svn: 312673
2017-09-06 22:05:32 +00:00
George Karpenkov 50657f6bd6 [CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h
The implementation is in AnalysisDeclContext.cpp and the class is called
AnalysisDeclContext.

Making those match up has numerous benefits, including:

 - Easier jump from header to/from implementation.
 - Easily identify filename from class.

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

llvm-svn: 312671
2017-09-06 21:45:03 +00:00
George Karpenkov 7b9cf1c4c3 [NFC] [CSA] Move AnyFunctionCall::getRuntimeDefinition implementation to cpp.
Differential Revision: https://reviews.llvm.org/D37499

llvm-svn: 312670
2017-09-06 21:45:01 +00:00
Davide Italiano a0186dd986 [ELF/Writer] Fix english in a comment. NFCI.
llvm-svn: 312669
2017-09-06 21:16:51 +00:00
Matthias Braun c9056b834d Insert IMPLICIT_DEFS for undef uses in tail merging
Tail merging can convert an undef use into a normal one when creating a
common tail. Doing so can make the register live out from a block which
previously contained the undef use. To keep the liveness up-to-date,
insert IMPLICIT_DEFs in such blocks when necessary.

To enable this patch the computeLiveIns() function which used to
compute live-ins for a block and set them immediately is split into new
functions:
- computeLiveIns() just computes the live-ins in a LivePhysRegs set.
- addLiveIns() applies the live-ins to a block live-in list.
- computeAndAddLiveIns() is a convenience function combining the other
  two functions and behaving like computeLiveIns() before this patch.

Based on a patch by Krzysztof Parzyszek <kparzysz@codeaurora.org>

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

llvm-svn: 312668
2017-09-06 20:45:24 +00:00
Mandeep Singh Grang d147f52252 [docs] Add a note on iteration of unordered containers to coding standards
Summary: Beware of non-determinism due to ordering of pointers

Reviewers: dblaikie, dexonsmith

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 312667
2017-09-06 20:19:10 +00:00
Chris Bieneman 5226a2a6de [CMake] Need to set WITH_LOCKDOWN on debugserver target
Turns out WITH_LOCKDOWN define changes the struct layout and constructor implementation for RNBSocket which is used in debugserver.cpp, so we need to make sure this is consistent.

In the future we should change WITH_LOCKDOWN to be configured in a generated header, but for now we can just set it correctly.

<rdar://problem/33900552>

llvm-svn: 312666
2017-09-06 20:15:43 +00:00
Richard Smith a465362d77 [modules ts] Emit global variables in a module interface unit as part of that unit, not in importers.
llvm-svn: 312665
2017-09-06 20:01:14 +00:00
Krzysztof Parzyszek 1dc313727e Disable jump threading into loop headers
Consider this type of a loop:
    for (...) {
      ...
      if (...) continue;
      ...
    }
Normally, the "continue" would branch to the loop control code that
checks whether the loop should continue iterating and which contains
the (often) unique loop latch branch. In certain cases jump threading
can "thread" the inner branch directly to the loop header, creating
a second loop latch. Loop canonicalization would then transform this
loop into a loop nest. The problem with this is that in such a loop
nest neither loop is countable even if the original loop was. This
may inhibit subsequent loop optimizations and be detrimental to
performance.

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

llvm-svn: 312664
2017-09-06 19:36:58 +00:00
Michael Kruse 8ee179d3b4 Revert "[ScopDetect/Info] Look through PHIs that follow an error block"
This reverts commit
r312410 - [ScopDetect/Info] Look through PHIs that follow an error block

The commit caused generation of invalid IR due to accessing a parameter
that does not dominate the SCoP.

llvm-svn: 312663
2017-09-06 19:05:40 +00:00
Sanjay Patel e96f875deb [x86] fix triple and regenerate checks for psubus; NFC
Patch by Yulia Koval!

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

llvm-svn: 312662
2017-09-06 19:05:20 +00:00
Craig Topper 7391786175 [X86] Move more isel patterns to X86InstrVecCompiler.td. NFC
This moves more of our subvector insert/extract tricks to X86InstrVecCompiler.td and refactors them into multiclasses.

llvm-svn: 312661
2017-09-06 19:03:55 +00:00
Stanislav Mekhanoshin ea134bcb13 [AMDGPU] Fixed encoding of v_pk_mul_f16 in fcanonicalize
Differential Revision: https://reviews.llvm.org/D37522

llvm-svn: 312660
2017-09-06 18:29:51 +00:00
Rui Ueyama 0440be4a42 Detect linker script INCLUDE cycles.
Differential Revision: https://reviews.llvm.org/D37524

llvm-svn: 312656
2017-09-06 18:14:08 +00:00
Rui Ueyama fd06b02558 Add a comment.
llvm-svn: 312655
2017-09-06 18:09:06 +00:00
Krzysztof Parzyszek a3017aa2ab [IfConversion] Remove kill flags from common instructions as well
When if-converting a diamond, two separate blocks will be placed back
to back to form a straight line code. To ensure correctness of the
liveness information, any registers that are live in the second block
should not be killed in the first block, even if they were in the
original code.
Additionally, when the two blocks share common instructions at the
beginning, these instructions will not be duplicated, but only placed
once, before both of the blocks. Since the function "isIdenticalTo"
(as used here) ignores kill flags, the common initial code in one
block may have a kill flag for a register that is live in the other
block.
Because the code that removes kill flags only runs for the non-common
parts of the predicated blocks, a kill flag mismatch in the common
code could still lead to a live register being killed prematurely.

llvm-svn: 312654
2017-09-06 17:57:13 +00:00
Kostya Kortchinsky 6bc7b26d18 [scudo] getauxval alternative for Android
Summary:
`getauxval` was introduced with API level 18. In order to get things to work
at lower API levels (for the toolchain itself which is built at 14 for 32-bit),
we introduce an alternative implementation reading directly from
`/proc/self/auxv`.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, llvm-commits

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

llvm-svn: 312653
2017-09-06 17:51:32 +00:00
Rui Ueyama a353d9cb18 Remove a trailing empty line that didn't end with '\n'.
llvm-svn: 312652
2017-09-06 17:41:29 +00:00
Jonathan Roelofs b780c8ac75 Fix ARM bare metal driver to support atomics
The new bare metal support only supports the single thread model. This causes
the builtin atomic functions (e.g.: __atomic_fetch_add) to not generate
thread-safe assembly for these operations, which breaks our firmware. We target
bare metal, and need to atomically modify variables in our interrupt routines,
and task threads.

Internally, the -mthread-model flag determines whether to lower or expand
atomic operations (see D4984).

This change removes the overridden thread model methods, and instead relies on
the base ToolChain class to validate the thread model (which already includes
logic to validate single thread model support). If the single thread model is
required, the -mthread-model flag will have to be provided.

As a workaround "-mthread-model posix" could be provided, but it only works due
to a bug in the validation of the -mthread-model flag (separate patch coming to
fix this).

https://reviews.llvm.org/D37493

Patch by: Ian Tessier!

llvm-svn: 312651
2017-09-06 17:09:25 +00:00
Craig Topper d548bb9d37 [X86] Actually add the new file that was supposed to go with r312649.
llvm-svn: 312650
2017-09-06 17:06:40 +00:00
Craig Topper cf1d8a55f2 [X86] Introduce a new td file to hold patterns some of the non instruction patterns from SSE and AVX512
This patch moves some of similar non-instruction patterns from X86InstrSSE.td and X86InstrAVX512.td to a common file.

This is intended as a starting point. There are many other optimization patterns that exist in both files that we could move here.

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

llvm-svn: 312649
2017-09-06 16:56:52 +00:00
Nuno Lopes ba1c9f7aee Fix PR33878: BasicAA incorrectly assumes different address spaces don't alias
Remove code that assumed that a nullptr of address space != 0 couldnt alias with a non-null pointer. This is incorrect, since nothing can be concluded about a null pointer in an address space != 0.
This code was written before address spaces were introduced

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

llvm-svn: 312648
2017-09-06 16:55:31 +00:00
Alexander Kornienko 3ad84ee009 Minor style fixes in lib/Support/**/Program.(inc|cpp).
No functional changes intended.

llvm-svn: 312646
2017-09-06 16:28:33 +00:00
Petr Hosek 7d96d46cb7 Revert "[llvm-objcopy] Add support for relocations"
This reverts r312643 because it's failing on llvm-i686-linux-RA.

llvm-svn: 312645
2017-09-06 16:23:15 +00:00
Krzysztof Parzyszek daf1a5f94e [Hexagon] Add option to generate calls to "abort" for "unreachable"
llvm-svn: 312644
2017-09-06 16:22:55 +00:00
Petr Hosek bdc3e61d21 [llvm-objcopy] Add support for relocations
This change adds support for SHT_REL and SHT_RELA sections in
llvm-objcopy.

Patch by Jake Ehrlich

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

llvm-svn: 312643
2017-09-06 16:19:48 +00:00
Alexey Bataev f43f714213 [OPENMP] Fix for PR33922: New ident_t flags for
__kmpc_for_static_fini().

Added special flags for calls of __kmpc_for_static_fini(), like previous
ly for __kmpc_for_static_init(). Added flag OMP_IDENT_WORK_DISTRIBUTE
for distribute cnstruct, OMP_IDENT_WORK_SECTIONS for sections-based
  constructs and OMP_IDENT_WORK_LOOP for loop-based constructs in
  location flags.

llvm-svn: 312642
2017-09-06 16:17:35 +00:00
Wei Mi 818d50a93d [TailCall] Allow llvm.memcpy/memset/memmove to be tail calls when parent
function return the intrinsics's first argument.

llvm.memcpy/memset/memmove return void but they will return the first
argument after they are expanded as libcalls. Now if the parent function
has any return value, llvm.memcpy cannot be turned into tail call after
expansion.

The patch is to handle that case in SelectionDAGBuilder so when caller
function return the same value as the first argument of llvm.memcpy,
tail call is allowed.

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

llvm-svn: 312641
2017-09-06 16:05:17 +00:00
Stanislav Mekhanoshin 949fac9e40 [AMDGPU] Fix shouldClusterMemOps to process flat loads
Flat loads do not have vdata operand but have vdst instead.

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

llvm-svn: 312640
2017-09-06 15:31:30 +00:00
Aaron Ballman 8816a87064 Replacing "or" with "||" to appease MSVC.
llvm-svn: 312639
2017-09-06 15:12:05 +00:00
Alexey Bataev 070f43aee7 [OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime in
move constructor.

Previously user-defined reduction initializer was considered as an
assignment expression, not as initializer. Fixed this by treating the
initializer expression as an initializer.

llvm-svn: 312638
2017-09-06 14:49:58 +00:00
Peter Smith 1d5a070386 [ELF][AArch64] Add alignment checks for the LDST<N>_ABS_LO12_NC relocations
The R_AARCH64_LDST<N>_ABS LO12_NC relocations where N is 8, 16, 32, 64 or
128 have a scaled immediate. For example R_AARCH64_LDST32_ABS_LO12_NC
shifts the calculated value right by 4. If the target symbol + relocation
addend is not aligned properly then bits of the answer will be lost.

This change adds an alignment check to the relocations to make sure the
target of the relocation is aligned properly. This matches the behavior of
GNU ld. The motivation is to catch ODR violations such as a declaration of
extern int foo, but a definition of bool foo as the compiler may use
R_AARCH64_LDST32_ABS_LO12_NC for the former, but not align the destination.

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

llvm-svn: 312637
2017-09-06 14:23:06 +00:00
Peter Smith 3ef89b0fc7 [ELF] Move fixSectionAlignments() before first call to assignAddresses()
The fixSectionAlignments() function may alter the alignment of some
OutputSections, this is likely to alter the addresses calculated earlier
in assignAddresses(). By moving the call to fixSectionAlignments() we
make sure that assignAddresses() is consistent with the early calculation
used for RangeThunks and the final call just before writing the image.

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

llvm-svn: 312636
2017-09-06 14:02:14 +00:00
Nicolai Haehnle 523827145b AMDGPU: Make worst-case assumption about the wait states in inline assembly
Summary:
Mesa still uses a hack where empty inline assembly is used as a kind of
optimization barrier. This exposed a problem where not enough wait states
were inserted, because the hazard recognizer implicitly assumed that each
inline assembly "instruction" has at least one wait state.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 312635
2017-09-06 13:50:13 +00:00
Johannes Altmanninger 1509da083a [AST] Add TableGen for StmtDataCollectors
Summary:
This adds an option "-gen-clang-data-collectors" to the Clang TableGen
that is used to generate StmtDataCollectors.inc.

Reviewers: arphaman, teemperor!

Subscribers: mgorny, cfe-commits

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

llvm-svn: 312634
2017-09-06 13:20:51 +00:00
Johannes Altmanninger d614a1c15a [AST] Traverse CXXOperatorCallExpr in LexicallyOrderedRecursiveASTVisitor
Summary:
This affects overloaded operators, which are represented by a
CXXOperatorCallExpr whose first child is always a DeclRefExpr referring to the
operator. For infix, postfix and call operators we want the first argument
to be traversed before the operator.

Reviewers: arphaman

Subscribers: klimek, cfe-commits

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

llvm-svn: 312633
2017-09-06 13:12:11 +00:00
Michael Kruse 48c726f925 [test] Add forgotten REQUIRES: line.
llvm-svn: 312632
2017-09-06 13:11:24 +00:00
Johannes Altmanninger 0a755162be [AST] Traverse templates in LexicallyOrderedRecursiveASTVisitor
Summary:
We need to specialize this because RecursiveASTVisitor visits template
template parameters after the templated declaration, unlike the order in
which they appear in the source code.

Reviewers: arphaman

Reviewed By: arphaman

Subscribers: klimek, cfe-commits

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

llvm-svn: 312631
2017-09-06 13:11:13 +00:00
Michael Kruse bd84ce8931 [ZoneAlgo] Handle non-StoreInst/LoadInst MemoryAccesses including memset.
Up to now ZoneAlgo considered array elements access by something else
than a LoadInst or StoreInst as not analyzable. This patch removes that
restriction by using the unknown ValInst to describe the written
content, repectively the element type's null value in case of memset.

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

llvm-svn: 312630
2017-09-06 12:40:55 +00:00