Commit Graph

273666 Commits

Author SHA1 Message Date
Krzysztof Parzyszek 8f174dde92 [Pipeliner] Improve serialization order for post-increments
The pipeliner is generating a serial sequence that causes poor
register allocation when a post-increment instruction appears
prior to the use of the post-increment register. This occurs when
there is a circular set of dependences involved with a sequence
of instructions in the same cycle. In this case, there is no
serialization of the parallel semantics that will not cause an
additional register to be allocated.

This patch fixes the problem by changing the instructions so that
the post-increment instruction is used by the subsequent
instruction, which enables the register allocator to make a
better decision and not require another register.

Patch by Brendon Cahoon.

llvm-svn: 315466
2017-10-11 15:51:44 +00:00
Matt Morehouse 7b6010cdde Reland "[clang-fuzzer] Allow building without coverage instrumentation."
This relands r315336 after fixing bot breakage.

llvm-svn: 315465
2017-10-11 15:51:12 +00:00
Alexey Bataev e213f3e61a [OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.
If both taskloop and task directives are used at the same time in one
program, we may ran into the situation when the particular type for task
directive is reused for taskloop directives. Patch fixes this problem.

llvm-svn: 315464
2017-10-11 15:29:40 +00:00
Matt Morehouse eb1701fe76 [clang-fuzzer] Fix shared library dependencies.
llvm-svn: 315463
2017-10-11 15:13:53 +00:00
Daniel Marjamaki d3d83681bc [Analyzer] Clarify error messages for undefined result
Differential Revision: https://reviews.llvm.org/D30295

llvm-svn: 315462
2017-10-11 14:49:35 +00:00
Sanjay Patel 8d565a233d [InstCombine] add baseline tests for D38531; NFC
llvm-svn: 315461
2017-10-11 14:29:17 +00:00
Sanjay Patel 34fd5eaaf0 [DAGCombiner] convert insertelement of bitcasted vector into shuffle
Eg:
insert v4i32 V, (v2i16 X), 2 --> shuffle v8i16 V', X', {0,1,2,3,8,9,6,7}

This is a generalization of the IR fold in D38316 to handle insertion into a non-undef vector. 
We may want to abandon that one if we can't find value in squashing the more specific pattern sooner.

We're using the existing legal shuffle target hook to avoid AVX512 horror with vXi1 shuffles.

There may be room for improvement in the shuffle lowering here, but that would be follow-up work.

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

llvm-svn: 315460
2017-10-11 14:12:16 +00:00
Haojian Wu 3a4b7ec9de [clang-rename] Add more unittest.
llvm-svn: 315459
2017-10-11 14:00:42 +00:00
Jonas Devlieghere ec053332cf Revert "[dsymutil] Timestmap verification for __swift_ast"
This reverts commit r315456.

llvm-svn: 315458
2017-10-11 13:51:30 +00:00
Alex Bradbury 4d275f0dfe [TargetLowering] Correctly track NumFixedArgs field of CallLoweringInfo
The NumFixedArgs field of CallLoweringInfo is used by
TargetLowering::LowerCallTo to determine whether a given argument is passed
using the vararg calling convention or not (specifically, to set IsFixed for
each ISD::OutputArg).

Firstly, CallLoweringInfo::setLibCallee and CallLoweringInfo::setCallee both
incorrectly set NumFixedArgs based on the _previous_ args list. Secondly,
TargetLowering::LowerCallTo failed to increment NumFixedArgs when modifying
the argument list so a pointer is passed for the return value.

If your backend uses the IsFixed property or directly accesses NumFixedArgs, 
it is _possible_ this change could result in codegen changes (although the 
previous behaviour would have been incorrect). No such cases have been
identified during code review for any in-tree architecture.

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

llvm-svn: 315457
2017-10-11 13:48:45 +00:00
Jonas Devlieghere 8acb2e3ac4 [dsymutil] Timestmap verification for __swift_ast
This patch adds timestamp verification for swiftmodule files.

 - A new flag is provided to allows us to continue testing of the code
   for embedding the__swift_ast. (git doesn't maintain timestamps)
 - Adds a new test for fat (arm) binaries.

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

llvm-svn: 315456
2017-10-11 13:34:52 +00:00
Alex Bradbury 5c1eef4618 [RISCV] Fix build after r315327
Differential Revision: https://reviews.llvm.org/D38779
Patch by Chih-Mao Chen.

llvm-svn: 315455
2017-10-11 12:09:06 +00:00
Simon Dardis 442ee63468 [mips] Add missing tests from rL315451
llvm-svn: 315454
2017-10-11 11:45:06 +00:00
Alexey Bader 1f2779407e [OpenCL] Allow function declaration with empty argument list.
Treat 'f()' as 'f(void)' rather than a function w/o a prototype.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia, yaxunl

Subscribers: cfe-commits, echuraev, chapuni

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

Re-apply revision 306653.

llvm-svn: 315453
2017-10-11 11:16:31 +00:00
Haojian Wu 19d7299a8b [clang-rename] Don't add prefix qualifiers to the declaration and definition of the renamed symbol.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, arphaman

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

llvm-svn: 315452
2017-10-11 11:15:48 +00:00
Simon Dardis 41851e3546 [mips] Add support for parsing target specific flags for MIR
Reviewers: atanasyan

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

llvm-svn: 315451
2017-10-11 11:11:35 +00:00
NAKAMURA Takumi 08ac59ef4d llvm/module.modulemap: Create LLVM_MC_TableGen. It is used by llvm-tblgen.
llvm-svn: 315450
2017-10-11 11:08:52 +00:00
NAKAMURA Takumi 5748816f12 llvm/module.modulemap: Move Support_TargetRegistry to let LLVMSupport free from MC.
llvm-svn: 315449
2017-10-11 11:08:50 +00:00
Max Kazantsev fecaff1bd9 [NFC] Fix variables used only for assert in GVN
llvm-svn: 315448
2017-10-11 10:31:49 +00:00
Simon Dardis 75f9ae2b8b [llvm-rc] Fix spelling in message
llvm-svn: 315447
2017-10-11 10:14:22 +00:00
Javed Absar 2c9570c096 [TableGen] Tidy up CodeGenSchedule.cpp
Use range_loop where it simplifies.

llvm-svn: 315446
2017-10-11 09:33:23 +00:00
Oliver Stannard 4191b9eaea [Asm] Add debug tracing in table-generated assembly matcher
This adds debug tracing to the table-generated assembly instruction matcher,
enabled by the -debug-only=asm-matcher option.

The changes in the target AsmParsers are to add an MCInstrInfo reference under
a consistent name, so that we can use it from table-generated code. This was
already being used this way for targets that use deprecation warnings, but 5
targets did not have it, and Hexagon had it under a different name to the other
backends.

llvm-svn: 315445
2017-10-11 09:17:43 +00:00
Petr Pavlu dbd7c338a0 Fix dumping of characters with non-standard sizes
* Prevent dumping of characters in DumpDataExtractor() with
  item_byte_size bigger than 8 bytes. This case is not supported by the
  code and results in a crash because the code calls
  DataExtractor::GetMaxU64Bitfield() -> GetMaxU64() that asserts for
  byte size > 8 bytes.
* Teach DataExtractor::GetMaxU64(), GetMaxU32(), GetMaxS64() and
  GetMaxU64_unchecked() how to handle byte sizes that are not a multiple
  of 2. This allows DumpDataExtractor() to dump characters and booleans
  with item_byte_size in the interval of [1, 8] bytes. Values that are
  not a multiple of 2 would previously result in a crash because they
  were not handled by GetMaxU64().

llvm-svn: 315444
2017-10-11 08:48:18 +00:00
Uriel Korach 782f28bf2f [X86] Added tests for TESTM and TESTNM (NFC)
Adding this test files now so after another commit that will add a new pattern for
TESTM and TESTNM instructions will show the improvemnts that have been done.

Change-Id: If3908b7f91897d764053312365a2bc1de78b291d
llvm-svn: 315443
2017-10-11 08:39:25 +00:00
George Rimar 970e783bdd [ELF] - Fix out of sync comment. NFC.
llvm-svn: 315442
2017-10-11 08:18:53 +00:00
George Rimar 26fa916deb [ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}.
This is PR34546.

Currently LLD creates output sections even if it has no input sections,
but its command contains an assignment.
Committed code just assigns the same flag that was used in previous
live section.
That does not work sometimes. For example if we have following script:

.ARM.exidx : { *(.ARM.exidx*) }
.foo : { _foo = 0; } }
Then first section has SHF_LINK_ORDER flag. But section foo should not.
That was a reason of crash in OutputSection::finalize(). LLD tried to calculate
Link value, calling front() on empty input sections list.
We should only keep access flags and omit all others when creating such sections.

Patch fixes the crash observed.

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

llvm-svn: 315441
2017-10-11 08:13:40 +00:00
Max Kazantsev 3b81809e06 [GVN] Prevent LoadPRE from hoisting across instructions that don't pass control flow to successors
This patch fixes the miscompile that happens when PRE hoists loads across guards and
other instructions that don't always pass control flow to their successors. PRE is now prohibited
to hoist across such instructions because there is no guarantee that the load standing after such
instruction is still valid before such instruction. For example, a load from under a guard may be
invalid before the guard in the following case:
  int array[LEN];
  ...
  guard(0 <= index && index < LEN);
  use(array[index]);

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

llvm-svn: 315440
2017-10-11 08:10:43 +00:00
Daniel Jasper 4a6d5b72af Revert r314955: "Remove PendingBody mechanism for function and ObjC method deserialization."
This is breaking a build of https://github.com/abseil/abseil-cpp and so
likely not really NFC. Also reverted subsequent r314956/7.

I'll forward reproduction instructions to Richard.

llvm-svn: 315439
2017-10-11 07:47:54 +00:00
Max Kazantsev 0c8dd052b8 [LICM] Disallow sinking of unordered atomic loads into loops
Sinking of unordered atomic load into loop must be disallowed because it turns
a single load into multiple loads. The relevant section of the documentation
is: http://llvm.org/docs/Atomics.html#unordered, specifically the Notes for
Optimizers section. Here is the full text of this section:

> Notes for optimizers
> In terms of the optimizer, this **prohibits any transformation that
> transforms a single load into multiple loads**, transforms a store into
> multiple stores, narrows a store, or stores a value which would not be
> stored otherwise. Some examples of unsafe optimizations are narrowing
> an assignment into a bitfield, rematerializing a load, and turning loads
> and stores into a memcpy call. Reordering unordered operations is safe,
> though, and optimizers should take advantage of that because unordered
> operations are common in languages that need them.

Patch by Daniil Suchkov!

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D38392

llvm-svn: 315438
2017-10-11 07:26:45 +00:00
Max Kazantsev 25d8655dc2 [IRCE] Do not process empty safe ranges
IRCE should not apply when the safe iteration range is proved to be empty.
In this case we do unneeded job creating pre/post loops and then never
go to the main loop.

This patch makes IRCE not apply to empty safe ranges, adds test for this
situation and also modifies one of existing tests where it used to happen
slightly.

Reviewed By: anna
Differential Revision: https://reviews.llvm.org/D38577

llvm-svn: 315437
2017-10-11 06:53:07 +00:00
Rui Ueyama a2212f846b Do not copy Sections vector.
llvm-svn: 315436
2017-10-11 05:13:16 +00:00
NAKAMURA Takumi 6d4fa5046a Reorder.
llvm-svn: 315435
2017-10-11 04:54:05 +00:00
Rui Ueyama 7ad1e3102a Split LinkerScript::computeInputSections into two functions.
llvm-svn: 315434
2017-10-11 04:50:30 +00:00
Rui Ueyama 722221f5a7 Swap parameters of getSymbolValue.
Usually, a function that does symbol lookup takes symbol name as
its first argument. Also, if a function takes a source location hint,
it is usually the last parameter. So the previous parameter order
was counter-intuitive.

llvm-svn: 315433
2017-10-11 04:34:34 +00:00
Rui Ueyama f5733500c9 Do not handle DefinedCommon in linker scripts.
Because of r314495, DefinedCommon symbols cannot reach to
getSymbolValue function. When they reach the fucntion, they have
already been converted to DefinedRegular symbols.

llvm-svn: 315432
2017-10-11 04:31:13 +00:00
Rui Ueyama f0403c601a Rename BytesDataCommand -> ByteCommand.
llvm-svn: 315431
2017-10-11 04:22:09 +00:00
Rui Ueyama 2f4c121d89 Inline LinkerScript::process.
"process" was not a good name because everything can be named it.

llvm-svn: 315430
2017-10-11 04:21:55 +00:00
Davide Italiano e2138fe41b [GVN] Don't replace constants with constants.
This fixes PR34908. Patch by Alex Crichton!

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

llvm-svn: 315429
2017-10-11 04:21:51 +00:00
NAKAMURA Takumi 6a80e5dd3b ClangCodeGenTests: Update libdeps in rL315392, +clangAST.
llvm-svn: 315428
2017-10-11 04:20:19 +00:00
Rui Ueyama 355a8dd663 Split a loop into two to make it clear that it did two different things.
llvm-svn: 315427
2017-10-11 04:01:24 +00:00
Rui Ueyama 0543343170 Use more precise type.
llvm-svn: 315426
2017-10-11 04:01:13 +00:00
Rui Ueyama 187b67a533 Remove a static local varaible.
We should generally avoid static local variables.

llvm-svn: 315425
2017-10-11 03:34:09 +00:00
Rui Ueyama 1f4d7b56f4 Avoid a pointer to a pointer to an input section.
llvm-svn: 315424
2017-10-11 03:23:29 +00:00
Rui Ueyama ec5c4adbf2 Add comment.
llvm-svn: 315423
2017-10-11 03:23:17 +00:00
Rui Ueyama 2b714b56a9 Split decompressAndMergeSection into two separate functions.
Even though they are called sequentially, they are separate
operations, so it is better to split it.

llvm-svn: 315422
2017-10-11 03:12:53 +00:00
Rui Ueyama b801441ed3 Remove useless cast.
llvm-svn: 315421
2017-10-11 02:55:05 +00:00
Rui Ueyama 04c9ca7408 Rename filename -> getFilename.
llvm-svn: 315420
2017-10-11 02:54:52 +00:00
Rui Ueyama 71f840672d Rename Align -> Alignment.
llvm-svn: 315419
2017-10-11 02:46:09 +00:00
Rui Ueyama 29b240c671 Rename CurAddressState -> Ctx.
We used CurAddressState to capture a dynamic context just like
we use lambdas to capture static contexts. So, CurAddressState
is used everywhere in LinkerScript.cpp. It is worth a shorter
name.

llvm-svn: 315418
2017-10-11 02:45:54 +00:00
Jake Ehrlich d9a283463a Revert "[llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data"
This reverts commit rL315412

llvm-svn: 315417
2017-10-11 02:42:29 +00:00