Commit Graph

288187 Commits

Author SHA1 Message Date
Mark Searles ec58183e1b [AMDGPU] Waitcnt pass: add debug options
- Add "amdgpu-waitcnt-forcezero" to force all waitcnt instrs to be emitted as s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)

- Add debug counters to control force emit of s_waitcnt instrs; debug counters:
si-insert-waitcnts-forceexp: force emit s_waitcnt expcnt(0) instrs
si-insert-waitcnts-forcevm: force emit s_waitcnt lgkmcnt(0) instrs
si-insert-waitcnts-forcelgkm: force emit s_waitcnt vmcnt(0) instrs

- Add some debug statements

Note that a variant of this patch was previously committed/reverted.

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

llvm-svn: 330862
2018-04-25 19:21:26 +00:00
Eli Friedman e54d0ff400 [TargetInfo] Sort target features before passing them to the backend
Passing the features in random order will lead to unpredictable results
when some of the features are related (like the architecture-version
features on ARM).

It might be possible to fix this particular case in the ARM target code,
to avoid adding overlapping target features. But we should probably be
sorting in any case: the behavior shouldn't depend on StringMap's
hashing algorithm.

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

llvm-svn: 330861
2018-04-25 19:14:05 +00:00
David Bolvansky cb8ca5f37c [SimplifyLibcalls] Atoi, strtol replacements
Reviewers: spatel, lebedev.ri, xbolva00, efriedma

Reviewed By: xbolva00, efriedma

Subscribers: efriedma, llvm-commits

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

llvm-svn: 330860
2018-04-25 18:58:53 +00:00
Francis Visoiu Mistrih 57fcd3454a [MIR] Add support for debug metadata for fixed stack objects
Debug var, expr and loc were only supported for non-fixed stack objects.

This patch adds the following fields to the "fixedStack:" entries, and
renames the ones from "stack:" to:

* debug-info-variable
* debug-info-expression
* debug-info-location

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

llvm-svn: 330859
2018-04-25 18:58:06 +00:00
Michael Kruse beffdb9daa [ScopDetect] Reject loop with multiple exit blocks.
The current statement domain derivation algorithm does not (always)
consider that different exit blocks of a loop can have different
conditions to be reached.

From the code

      for (int i = n; ; i-=2) {
        if (i <= 0) goto even;
        if (i <= 1) goto odd;
        A[i] = i;
      }
    even:
      A[0] = 42;
      return;
    odd:
      A[1] = 21;
      return;

Polly currently derives the following domains:

        Stmt_even_critedge
            Domain :=
                [n] -> { Stmt_even_critedge[] };
        Stmt_odd
            Domain :=
                [n] -> { Stmt_odd[] : (1 + n) mod 2 = 0 and n > 0 };

while the domain for the odd case is correct, Stmt_even is assumed to be
executed unconditionally, which is obviously wrong. While projecting out
the loop dimension in `adjustDomainDimensions`, it does not consider
that there are other exit condition that have matched before.

I don't know a how to fix this without changing a lot of code. Therefore
This patch rejects loops with multiple exist blocks to fix the
miscompile of test-suite's uuencode.

The odd condition is transformed by LLVM to

    %cmp1 = icmp eq i64 %indvars.iv, 1

such that the project_out in adjustDomainDimensions() indeed only
matches for odd n (using this condition only, we'd have an infinite loop
otherwise).

The even condition manifests as

    %cmp = icmp slt i64 %indvars.iv, 3

Because buildDomainsWithBranchConstraints() does not consider other exit
conditions, it has to assume that the induction variable will eventually
be lower than 3 and taking this exit.

IMHO we need to reuse the algorithm that determines the number of
iterations (addLoopBoundsToHeaderDomain) to determine which exit
condition applies first. It has to happen in
buildDomainsWithBranchConstraints() because the result will need to
propagate to successor BBs. Currently addLoopBoundsToHeaderDomain() just
look for union of all backedge conditions (which means leaving not the
loop here). The patch in llvm.org/PR35465 changes it to look for exit
conditions instead. This is required because there might be other exit
conditions that do not alternatively go back to the loop header.

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

llvm-svn: 330858
2018-04-25 18:53:33 +00:00
Kostya Kortchinsky d8803d3d92 [scudo] Adding an interface function to print allocator stats
Summary:
This adds `__scudo_print_stats` as an interface function to display the Primary
and Secondary allocator statistics for Scudo.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 330857
2018-04-25 18:52:29 +00:00
Nico Weber a48924c706 IWYU llvm-config.h for LLVM_VERSION_STRING
llvm-svn: 330856
2018-04-25 18:34:00 +00:00
Petr Hosek 17fdef6606 [CMake] Enable libc++ for Fuchsia toolchain on Darwin
This is necessary in order to get a working C++ compiler on Darwin
since Clang expects libc++ headers to be part of the toolchain.

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

llvm-svn: 330855
2018-04-25 18:30:55 +00:00
Sam Clegg 9067b46e1b [WebAssebmly] Add Module name to WasmSymbol
Imports in a wasm module can have custom module name.  This change
adds the module name to the WasmSymbol structure so that the linker
can preserve this module name.

This is needed to fix: https://bugs.llvm.org/show_bug.cgi?id=37168

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

llvm-svn: 330854
2018-04-25 18:24:08 +00:00
Nico Weber 4264a38916 Rename sancov.cc to sancov.cpp
LLVM uses cpp as its C++ file ending.
https://reviews.llvm.org/D46068

llvm-svn: 330853
2018-04-25 18:06:23 +00:00
Simon Pilgrim 0ae4bba911 [CostModel][X86] Add div/rem tests for non-uniform constant divisors
llvm-svn: 330852
2018-04-25 18:03:31 +00:00
Jan Vesely 1647e50359 relational/select: Condition types for half are short/ushort, not char/uchar
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 330851
2018-04-25 17:36:36 +00:00
Craig Topper 300e20d61c [X86] Form MUL_IMM for multiplies with 3/5/9 to encourage LEA formation over load folding.
Previously we only formed MUL_IMM when we split a constant. This blocked load folding on those cases. We should also form MUL_IMM for 3/5/9 to favor LEA over load folding.

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

llvm-svn: 330850
2018-04-25 17:35:03 +00:00
Petar Jovanovic 3517ece21f Finetune supported arches for the tests added in r330840
r330840 introduced two tests that may not be supported on all architectures.
powerpc64 seems to be one of those.

llvm-svn: 330849
2018-04-25 17:34:30 +00:00
Reid Kleckner 1ca666886f Revert r330755 "[lit] Report line number for failed RUN command"
It is causing many tests to fail on Windows buildbots:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10211

llvm-svn: 330848
2018-04-25 17:30:00 +00:00
Peter Szecsi b180eebed4 [ASTImporter] FriendDecl importing improvements
There are only a few cases of importing a frienddecl which is currently supported.
This patch aims to improve the friend import process.
Set FriendObjectKind in case of decls, insert friend into the friend chain
correctly, checks structurally equivalent in a more advanced manner.
Test cases added as well.  

llvm-svn: 330847
2018-04-25 17:28:03 +00:00
Alex Bradbury cd8688a4c2 [RISCV] Allow call pseudoinstruction to be used to call a function name that coincides with a register name
Previously `call zero`, `call f0` etc would fail. This leads to compilation 
failures if building programs that define functions with those names and using 
-save-temps.

llvm-svn: 330846
2018-04-25 17:25:29 +00:00
Nico Weber 39d61944df Don't list a source file twice.
llvm-svn: 330845
2018-04-25 17:24:41 +00:00
Taewook Oh 923c216da5 [ICP] Do not attempt type matching for variable length arguments.
Summary:
When performing indirect call promotion, current implementation inspects "all" parameters of the callsite and attemps to match with the formal argument type of the callee function. However, it is not possible to find the type for variable length arguments, and the compiler crashes when it attemps to match the type for variable lenght argument.

It seems that the bug is introduced with D40658. Prior to that, the type matching is performed only for the parameters whose ID is less than callee->getFunctionNumParams(). The attached test case will crash without the patch.

Reviewers: mssimpso, davidxl, davide

Reviewed By: mssimpso

Subscribers: llvm-commits

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

llvm-svn: 330844
2018-04-25 17:19:21 +00:00
Nico Weber 79c6ec484e Rename Attributes.gen, Intrinsics.gen to Attributes.inc, Intrinsics.inc
Virtually all other tablegen outputs are called .inc, not .gen, so rename these two too for consistency.
No behavior change.

https://reviews.llvm.org/D46058

llvm-svn: 330843
2018-04-25 17:07:46 +00:00
Craig Topper b6dcc57ad1 [Builtins] Fix typos in a comment. NFC
llvm-svn: 330842
2018-04-25 16:57:46 +00:00
Sanjay Patel 807ddee1bf [InstCombine] clean up foldSelectICmpAnd(); NFC
As discussed in D45862, we want to delete parts of
this code because it can create more instructions
than it removes. But we also want to preserve some 
folds that are winners, so tidy up what's here to
make splitting the good from bad a bit easier.

llvm-svn: 330841
2018-04-25 16:34:01 +00:00
Petar Jovanovic 1dd3584ec0 [mips] Implement GetWriteFlag() for mips
The read/write flag is set by manually decoding the instruction that caused
the exception. It is implemented this way because the cause register which
contains the needed flag was removed from the signal context structure which
the user handler receives from the kernel.

Patch by Milos Stojanovic.

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

llvm-svn: 330840
2018-04-25 16:21:00 +00:00
Nico Weber f3e043f67b Make add_clang_unittest formatting a bit more consistent.
llvm-svn: 330839
2018-04-25 16:20:43 +00:00
Marshall Clow 0badc676cf Disable the test I just added when testing C++03.
llvm-svn: 330838
2018-04-25 16:09:47 +00:00
Sanjay Patel 0387ceb67a [InstCombine] add tests for select to logic folds; NFC
As discussed in D45862, we want these folds sometimes
because they're good improvements.
But as we can see here, the current logic doesn't
check uses and doesn't produce optimal code in all
cases. 

llvm-svn: 330837
2018-04-25 15:59:23 +00:00
Haojian Wu cbf20ef6ab [clangd] Add "str()" method to SymbolID.
Summary:
This is a convenient function when we try to get std::string of
SymbolID.

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, MaskRay, jkorous, cfe-commits

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

llvm-svn: 330835
2018-04-25 15:27:09 +00:00
Simon Pilgrim 58e03a09db [CostModel][X86] Recursive call for cost of imul for packed v16i16 constant shift left.
Don't just assume cost = 1.

llvm-svn: 330834
2018-04-25 15:22:03 +00:00
Ilya Biryukov ef4ece75fd [CodeComplete] Fix completion in the middle of ident in ctor lists.
Summary:
The example that was broken before (^ designates completion points):

    class Foo {
      Foo() : fie^ld^() {} // no completions were provided here.
      int field;
    };

To fix it we don't cut off lexing after an identifier followed by code
completion token is lexed. Instead we skip the rest of identifier and
continue lexing.
This is consistent with behavior of completion when completion token is
right before the identifier.

Reviewers: sammccall, aaron.ballman, bkramer, sepavloff, arphaman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 330833
2018-04-25 15:13:34 +00:00
Krasimir Georgiev 5559cc3b75 [clang-format] Start formatting cpp code in raw strings in google style
Summary: This adds some delimiters to detect cpp code in raw strings.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 330832
2018-04-25 14:56:19 +00:00
Amara Emerson 1f5d994119 [AArch64][GlobalISel] Implement selection for the llvm.trap intrinsic.
rdar://38674040

llvm-svn: 330831
2018-04-25 14:43:59 +00:00
Paul Walker f6e44a0bdf Fix typo in static_assert for size of LoadSDNodeBitfields.
Reviewers: fhahn, jlebar, delena, RKSimon

Reviewed By: fhahn, jlebar

Subscribers: llvm-commits

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

llvm-svn: 330830
2018-04-25 14:42:44 +00:00
Filipe Cabecinhas def742ca52 [llvm-mca] Make ViewOptions static. NFCI
llvm-svn: 330829
2018-04-25 14:39:16 +00:00
Marshall Clow 3df56fdd9b Fix static initialization of std::atomic_flag; Fixes PR#37226. Thanks to Ricky Zhou for the report and test case.
llvm-svn: 330828
2018-04-25 14:27:29 +00:00
Shiva Chen d58bd8dc4a [RISCV] Expand function call to "call" pseudoinstruction
To do this:
1. Change GlobalAddress SDNode to TargetGlobalAddress to avoid legalizer
   split the symbol.

2. Change ExternalSymbol SDNode to TargetExternalSymbol to avoid legalizer
   split the symbol.

3. Let PseudoCALL match direct call with target operand TargetGlobalAddress
   and TargetExternalSymbol.

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

llvm-svn: 330827
2018-04-25 14:19:12 +00:00
Shiva Chen 98f9389f65 [RISCV] Support "call" pseudoinstruction in the MC layer
To do this:
1. Add PseudoCALLIndirct to match indirect function call.

2. Add PseudoCALL to support parsing and print pseudo `call` in assembly

3. Expand PseudoCALL to the following form with R_RISCV_CALL relocation type
   while encoding:
        auipc ra, func
        jalr ra, ra, 0

If we expand PseudoCALL before emitting assembly, we will see auipc and jalr
pair when compile with -S. It's hard for assembly parser to parsing this
pair and identify it's semantic is function call and then insert R_RISCV_CALL
relocation type. Although we could insert R_RISCV_PCREL_HI20 and
R_RISCV_PCREL_LO12_I relocation types instead of R_RISCV_CALL.
Due to RISCV relocation design, auipc and jalr pair only can relax to jal with
R_RISCV_CALL + R_RISCV_RELAX relocation types.

We expand PseudoCALL as late as encoding(RISCVMCCodeEmitter) instead of before
emitting assembly(RISCVAsmPrinter) because we want to preserve call
pseudoinstruction in assembly code. It's more readable and assembly parser
could identify call assembly and insert R_RISCV_CALL relocation type.

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

llvm-svn: 330826
2018-04-25 14:18:55 +00:00
Simon Dardis 0f2f5976d0 [mips] Teach the delay slot filler to transform 'jal' for microMIPS
ISel is currently picking 'JAL' over 'JAL_MM' for calling a function when
targeting microMIPS. A later patch will correct this behaviour.

This patch extends the mechanism for transforming instructions into their short
delay to recognise 'JAL_MM' for transforming into 'JALS_MM'.

llvm-svn: 330825
2018-04-25 14:12:57 +00:00
Yaxun Liu 9061e4f486 [HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__
Differential Revision: https://reviews.llvm.org/D45441

llvm-svn: 330824
2018-04-25 13:33:19 +00:00
Benjamin Kramer 0d97c225cd Fix -Wswitch warning after r330790.
source/Symbol/ClangASTContext.cpp:391:13: error: enumeration value 'HIP' not handled in switch [-Werror,-Wswitch]
    switch (IK.getLanguage()) {

llvm-svn: 330823
2018-04-25 13:22:47 +00:00
Simon Pilgrim 7574ffd7bc [llvm-mca][X86] Updated fma3 tests after rL330820
llvm-svn: 330822
2018-04-25 13:19:04 +00:00
Yaxun Liu 48390a992f Fix failure in lit test kernel-call.cu due to name mangling
llvm-svn: 330821
2018-04-25 13:07:58 +00:00
Simon Pilgrim dbd1ae7ddd [X86] Split WriteFMA into XMM, Scalar and YMM/ZMM scheduler classes
This removes all the FMA InstRW overrides.

If we ever get PR36924, then we can remove many of these declarations from models.

llvm-svn: 330820
2018-04-25 13:07:58 +00:00
Roman Lebedev cfa9e58ccf [X86][AArch64][NFC] Finish adding 'bad' tests for masked merge unfolding with constants.
I have initially committed basic tests in, rL330771,
but then quickly discovered that there are a few more
interesting patterns.

llvm-svn: 330819
2018-04-25 12:48:23 +00:00
Alexander Timofeev b934728cd2 [AMDGPU] Revert b0efc4fd6 (https://reviews.llvm.org/D40556)
llvm-svn: 330818
2018-04-25 12:32:46 +00:00
Gabor Buella f4bd34b026 Avoid a warning on pointer casting, NFC
Reviewers: philip.pfaffe	

Reviewed By: philip.pfaffe	

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

llvm-svn: 330817
2018-04-25 12:15:34 +00:00
Andrea Di Biagio 534e1dab79 [llvm-mca] Add a new option category for views.
With this patch, options to add/tweak views are all grouped together in the
-help output.

The new "View Options" category looks like this:

```
  View Options:

    -dispatch-stats                 - Print dispatch statistics
    -instruction-info               - Print the instruction info view
    -instruction-tables             - Print instruction tables
    -register-file-stats            - Print register file statistics
    -resource-pressure              - Print the resource pressure view
    -retire-stats                   - Print retire control unit statistics
    -scheduler-stats                - Print scheduler statistics
    -timeline                       - Print the timeline view
    -timeline-max-cycles=<uint>     - Maximum number of cycles in the timeline view. Defaults to 80 cycles
    -timeline-max-iterations=<uint> - Maximum number of iterations to print in timeline view
```

llvm-svn: 330816
2018-04-25 11:33:14 +00:00
Greg Bedwell 03e85e126c [UpdateTestChecks] Change update_mca_test_checks.py file mode to match the other scripts
llvm-svn: 330815
2018-04-25 11:20:42 +00:00
George Rimar d30a78b3fe [ELF] - Eliminate the AssertCommand.
Currently, LLD supports ASSERT as a separate command.

We support two forms now.

Assign expression-form: . = ASSERT(0x100)
(old GNU ld required it and some scripts in the wild are still using
something like . = ASSERT((_end - _text <= (512 * 1024 * 1024)), "kernel image bigger than KERNEL_IMAGE_SIZE");

Nowadays above is not a mandatory form and command-like form is commonly used:
ASSERT(<expr>, "text);

The return value of the ASSERT is Dot. That was implemented in D30171.
It looks like (2) is just a short version of (1) then.

GNU ld does *not* list ASSERT as a SECTIONS command:
https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS

Given above we probably can change ASSERT to be an assignment to Dot. 
That makes the rest of the code much simpler. Patch do that.

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

llvm-svn: 330814
2018-04-25 11:16:31 +00:00
Simon Pilgrim 6a82e96ed9 [X86][SKX] Setup WriteFAdd and remove unnecessary InstRW scheduler overrides.
llvm-svn: 330813
2018-04-25 10:51:19 +00:00
Simon Pilgrim 98e21c5ade [X86][SNB] Remove unnecessary WriteFBlendLd InstRW scheduler overrides.
llvm-svn: 330812
2018-04-25 10:50:39 +00:00