Commit Graph

219142 Commits

Author SHA1 Message Date
Manuel Jacob 3eedd11329 [Statepoints] Check for the "gc-leaf-function" attribute on call sites as well.
Reviewers: sanjoy, reames

Subscribers: sanjoy, llvm-commits

Differential Revision: http://reviews.llvm.org/D15900

llvm-svn: 256875
2016-01-05 23:59:08 +00:00
Adrian Prantl aac97c93ac Fix a typo in testcase and increase its coverage!
llvm-svn: 256874
2016-01-05 23:54:01 +00:00
Chris Bieneman b2920a779c [CMake] Support a simple case for bootstrap builds to generate PGO data
Summary:
This patch adds support for the clang multi-stage bootstrapping to support PGO profdata generation, and can build a 2 or 3 stage compiler.

With this patch applied you can configure your build directory with the following invocation of CMake:

cmake -G <generator> -C <path_to_clang>/cmake/caches/PGO.cmake <source dir>

After configuration the following additional targets will be generated:

stage2-instrumented:
Builds a stage1 x86 compiler, runtime, and required tools (llvm-config, llvm-profdata) then uses that compiler to build an instrumented stage2 compiler.

stage2-instrumented-generate-profdata:
Depends on "stage2-instrumented" and will use the instrumented compiler to generate profdata based on the training files in <clang>/utils/perf-training

stage2:
Depends on "stage2-instrumented-generate-profdata" and will use the stage1 compiler with the stage2 profdata to build a PGO-optimized compiler.

stage2-check-llvm:
Depends on stage2 and runs check-llvm using the stage3 compiler.

stage2-check-clang:
Depends on stage2 and runs check-clang using the stage3 compiler.

stage2-check-all:
Depends on stage2 and runs check-all using the stage3 compiler.

stage2-test-suite:
Depends on stage2 and runs the test-suite using the stage3 compiler (requires in-tree test-suite).

Reviewers: bogner, silvas, chandlerc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15584

llvm-svn: 256873
2016-01-05 23:51:42 +00:00
Rui Ueyama c9559d9378 Add comments.
llvm-svn: 256872
2016-01-05 20:47:37 +00:00
Sanjay Patel 29095ea1b0 [LibCallSimplfier] use instruction-level fast-math-flags for fmin/fmax transforms
llvm-svn: 256871
2016-01-05 20:46:19 +00:00
Nicolai Haehnle 6035504ab3 AMDGPU/SI: Do not move scratch resource register on Tonga & Iceland
Due to the SGPR init bug, every program claims to use the same number
of SGPRs anyway, so there's no point in trying to shift those registers
down from their initial spot of reservation.

Add a test that uses VGPR spilling and blocks most SGPRs from being used for
the scratch resource register. Previously, this would run into an assertion.

Differential Revision: http://reviews.llvm.org/D15724

llvm-svn: 256870
2016-01-05 20:42:49 +00:00
Rui Ueyama 2ef58a18af Remove SymbolTable::isUndefined.
Because it can be implemented outside of the symbol table.

llvm-svn: 256869
2016-01-05 20:35:16 +00:00
Amaury Sechet a0c242cdfd Implement load to store => memcpy in MemCpyOpt for aggregates
Summary:
Most of the tool chain is able to optimize scalar and memcpy like operation effisciently while it isn't that good with aggregates. In order to improve the support of aggregate, we try to change aggregate manipulation into either scalar or memcpy like ones whenever possible without loosing informations.

This is one such opportunity.

Reviewers: craig.topper, spatel, dexonsmith, Prazek, chandlerc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15894

llvm-svn: 256868
2016-01-05 20:17:48 +00:00
Rui Ueyama 2a65a49bcf Make findFile() a member function of SymbolTable to simplify. NFC.
llvm-svn: 256867
2016-01-05 20:01:29 +00:00
Oleg Ranevskyy 2e83790c37 [Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS
Summary:
Hi Rafael,

Would you be able to review this patch, please?

(Clang part of the patch is D15832).

When clang runs an external tool, e.g. a linker, it may create a command line that exceeds the length limit.

Clang uses the llvm::sys::argumentsFitWithinSystemLimits function to check if command line length fits the OS 

limitation. There are two problems in this function that may cause exceeding of the limit:

1. It ignores the length of the program path in its calculations. On the other hand, clang adds the program 

path to the command line when it runs the program.

2. It assumes no space character is inserted after the last argument, which is not true for Windows. The flattenArgs function adds the trailing space for *each* argument. The result of this is that the terminating NULL character is not counted and may be placed beyond the length limit if the command line is exactly 32768 characters long. The WinAPI's CreateProcess does not find the NULL character and fails.

Reviewers: rafael, ygao, probinson

Subscribers: asl, llvm-commits

Differential Revision: http://reviews.llvm.org/D15831

llvm-svn: 256866
2016-01-05 19:56:12 +00:00
Oleg Ranevskyy cd5163720f [Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS
Summary:
LLVM part of the patch is D15831.

When clang runs an external tool such as a linker it may create a command line that exceeds the length limit.

Clang uses the llvm::sys::argumentsFitWithinSystemLimits function to check if command line length fits the OS 

limitation. There are two problems in this function that may cause exceeding of the limit:

1. It ignores the length of the program path in its calculations. On the other hand, clang adds the program 

path to the command line when it runs the program.

2. It assumes no space character is inserted after the last argument, which is not true for Windows. The flattenArgs function adds the trailing space for *each* argument. The result of this is that the terminating NULL character is not counted and may be placed beyond the length limit if the command line is exactly 32768 characters long. The WinAPI's CreateProcess does not find the NULL character and fails.


Reviewers: rafael, asl

Subscribers: asl, llvm-commits

Differential Revision: http://reviews.llvm.org/D15832

llvm-svn: 256865
2016-01-05 19:54:39 +00:00
Marshall Clow 652a2ce191 Add explicit include directives; the file was getting implicitly included already. NFC
llvm-svn: 256864
2016-01-05 19:53:31 +00:00
Dawn Perchik 954b40bf63 Add support for "source info" and use it to fix MI's -symbol-list-lines.
This patch adds support the command 'source info' as follows:
    (lldb) help source info
         Display source line information (as specified) based on the current executable's
         debug info.
    
    Syntax: source info <cmd-options>
    
    Command Options Usage:
      source info [-c <count>] [-s <shlib-name>] [-f <filename>] [-l <linenum>] [-e <linenum>]
      source info [-c <count>] [-s <shlib-name>] [-n <symbol>]
      source info [-c <count>] [-a <address-expression>]
    
           -a <address-expression> ( --address <address-expression> )
                Lookup the address and display the source information for the corresponding
                file and line.
    
           -c <count> ( --count <count> )
                The number of line entries to display.
    
           -e <linenum> ( --end-line <linenum> )
                The line number at which to stop displaying lines.
    
           -f <filename> ( --file <filename> )
                The file from which to display source.
    
           -l <linenum> ( --line <linenum> )
                The line number at which to start the displaying lines.
    
           -n <symbol> ( --name <symbol> )
                The name of a function whose source to display.
    
           -s <shlib-name> ( --shlib <shlib-name> )
                Look up the source in the given module or shared library (can be specified
                more than once).
For example:
    (lldb) source info --file x.h
    Lines for file x.h in compilation unit x.cpp in `x
    [0x0000000100000d00-0x0000000100000d10): /Users/dawn/tmp/./x.h:10
    [0x0000000100000d10-0x0000000100000d1b): /Users/dawn/tmp/./x.h:10

The new options are used to fix the MI command:
    -symbol-list-lines <file>
which didn't work for header files because it called:
    target modules dump line-table <file>
which only dumps line tables for a compilation unit.

The patch also fixes a bug in the error reporting when no files were supplied to the command. Previously you'd get:
    (lldb) target modules dump line-table
    error:
    Syntax:
    error: no source filenames matched any command arguments
Now you get:
    error: file option must be specified.

Reviewed by: clayborg, jingham, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D15593

llvm-svn: 256863
2016-01-05 19:51:51 +00:00
Manuel Jacob 68b753a4fb Correct my last commit (revision 256860).
I forgot to save a small wording improvement before committing.

llvm-svn: 256862
2016-01-05 19:45:54 +00:00
Marshall Clow fd495892d6 Remove some test scaffolding that I added and then didn't need. No functional change
llvm-svn: 256861
2016-01-05 19:44:58 +00:00
Manuel Jacob b8060cd88a [PlaceSafepoints] Add a test.
Calls of functions with the "gc-leaf-function" attribute shouldn't be turned
into a safepoint.

llvm-svn: 256860
2016-01-05 19:40:58 +00:00
Marshall Clow afc9ff99ec First half of LWG#2354: 'Unnecessary copying when inserting into maps with braced-init syntax'
llvm-svn: 256859
2016-01-05 19:32:41 +00:00
Samuel Antao 7d5de9a1ee [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen.
It was causing two regression, so I'm reverting until the cause is found.

llvm-svn: 256858
2016-01-05 19:16:13 +00:00
Sanjay Patel a1c5347982 [InstCombine] insert a new shuffle before its uses (PR26015)
Although this solves the test case in PR26015:
https://llvm.org/bugs/show_bug.cgi?id=26015

And may solve PR25999:
https://llvm.org/bugs/show_bug.cgi?id=25999

...I suspect this is not the best solution. I think we want to insert the new shuffle
just ahead of the earliest ExtractElementInst that we're replacing, but I don't know 
how that should be implemented.

Differential Revision: http://reviews.llvm.org/D15878

llvm-svn: 256857
2016-01-05 19:09:47 +00:00
Manuel Jacob 0aa9f7fdad Add function for testing string attributes to InvokeInst and CallSite. NFC.
llvm-svn: 256856
2016-01-05 19:08:33 +00:00
Nathan Slingerland e8ddf9e9db [PGO] Enable clang to pass compiler-rt profile support library to linker on Windows
Summary: This change enables clang to automatically link binaries built with the -fprofile-instr-generate against the clang_rt.profile-i386.lib library.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15833

llvm-svn: 256855
2016-01-05 18:27:06 +00:00
Samuel Antao 1e06636b32 [OpenMP] Allow file ID to be signed in the offloading metadata.
This fixes a regression introduced by rL256842.

llvm-svn: 256854
2016-01-05 18:02:24 +00:00
Pavel Labath ea2cc5e028 Add logging to SBProcess::GetRestartedFromEvent
llvm-svn: 256853
2016-01-05 17:55:35 +00:00
Pavel Labath 2acc48827e Fix a typo in Process.cpp
llvm-svn: 256852
2016-01-05 17:55:32 +00:00
Pavel Labath 7723c57ca2 Fix a typo in lldbutil.py
llvm-svn: 256851
2016-01-05 17:55:29 +00:00
Rui Ueyama ddec22d55d Add comments.
llvm-svn: 256850
2016-01-05 17:55:05 +00:00
David Majnemer 861a0ae349 [X86] Determine if we have an OpaqueSPAdjustment earlier
We queried hasFP before we hit ExpandISelPseudos.  ExpandISelPseudos
manipulated state that hasFP relied on, potentially changing the result
after it has been queried elsewhere.

While I am not aware of any particular bug due to this state of affairs,
it seems best to avoid it entirely by changing the state during DAG
construction.

llvm-svn: 256849
2016-01-05 17:46:36 +00:00
Nathan Slingerland ba86c9279b [PGO] Enable building compiler-rt profile support library on Windows
Summary: This change configures Windows builds to build the complier-rt profile support library (clang_rt.profile-i386.lib). Windows API incompatibilities in the compiler-rt profile lib are also fixed.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15830

llvm-svn: 256848
2016-01-05 17:27:01 +00:00
Omair Javaid a7d7f7cf33 Fix for undefined behavior while updating PC value on arm-linux
Differential revision: http://reviews.llvm.org/D15877

llvm-svn: 256847
2016-01-05 16:56:13 +00:00
Rui Ueyama c7b073a23a Simplify. NFC.
llvm-svn: 256846
2016-01-05 16:35:48 +00:00
Rui Ueyama f53b1b7fde Update comments.
llvm-svn: 256845
2016-01-05 16:35:46 +00:00
Rui Ueyama e57c487eee Consistently use 'Bss' instead of 'BSS'.
llvm-svn: 256844
2016-01-05 16:35:43 +00:00
Rui Ueyama 7f9e7ea343 Remove redundant typedef.
llvm-svn: 256843
2016-01-05 16:35:41 +00:00
Samuel Antao 4d5f0bbea1 [OpenMP] Offloading descriptor registration and device codegen.
Summary:
In order to offloading work properly two things need to be in place:
- a descriptor with all the offloading information (device entry functions, and global variable) has to be created by the host and registered in the OpenMP offloading runtime library.
- all the device functions need to be emitted for the device and a convention has to be in place so that the runtime library can easily map the host ID of an entry point with the actual function in the device.

This patch adds support for these two things. However, only entry functions are being registered given that 'declare target' directive is not yet implemented.

About offloading descriptor:

The details of the descriptor are explained with more detail in http://goo.gl/L1rnKJ. Basically the descriptor will have fields that specify the number of devices, the pointers to where the device images begin and end (that will be defined by the linker), and also pointers to a the begin and end of table whose entries contain information about a specific entry point. Each entry has the type:
```
struct __tgt_offload_entry{
 void *addr;
 char *name;
 int64_t size;
};
```  
and will be implemented in a pre determined (ELF) section `.omp_offloading.entries` with 1-byte alignment, so that when all the objects are linked, the table is in that section with no padding in between entries (will be like a C array). The code generation ensures that all `__tgt_offload_entry` entries are emitted in the same order for both host and device so that the runtime can have the corresponding entries in both host and device in same index of the table, and efficiently implement the mapping.

The resulting descriptor is registered/unregistered with the runtime library using the calls `__tgt_register_lib` and `__tgt_unregister_lib`. The registration is implemented in a high priority global initializer so that the registration happens always before any initializer (that can potentially include target regions) is run.

The driver flag -omptargets= was created to specify a comma separated list of devices the user wants to support so that the new functionality can be exercised. Each device is specified with its triple.


About target codegen:

The target codegen is pretty much straightforward as it reuses completely the logic of the host version for the same target region. The tricky part is to identify the meaningful target regions in the device side. Unlike other programming models, like CUDA, there are no already outlined functions with attributes that mark what should be emitted or not. So, the information on what to emit is passed in the form of metadata in host bc file. This requires a new option to pass the host bc to the device frontend. Then everything is similar to what happens in CUDA: the global declarations emission is intercepted to check to see if it is an "interesting" declaration. The difference is that instead of checking an attribute, the metadata information in checked. Right now, there is only a form of metadata to pass information about the device entry points (target regions). A class `OffloadEntriesInfoManagerTy` was created to manage all the information and queries related with the metadata. The metadata looks like this:
```
!omp_offload.info = !{!0, !1, !2, !3, !4, !5, !6}

!0 = !{i32 0, i32 52, i32 77426347, !"_ZN2S12r1Ei", i32 479, i32 13, i32 4}
!1 = !{i32 0, i32 52, i32 77426347, !"_ZL7fstatici", i32 461, i32 11, i32 5}
!2 = !{i32 0, i32 52, i32 77426347, !"_Z9ftemplateIiET_i", i32 444, i32 11, i32 6}
!3 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 99, i32 11, i32 0}
!4 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 272, i32 11, i32 3}
!5 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 127, i32 11, i32 1}
!6 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 159, i32 11, i32 2}
```
The fields in each metadata entry are (in sequence):
Entry 1) an ID of the type of metadata - right now only zero is used meaning "OpenMP target region".
Entry 2) a unique ID of the device where the input source file that contain the target region lives. 
Entry 3) a unique ID of the file where the input source file that contain the target region lives. 
Entry 4) a mangled name of the function that encloses the target region.
Entries 5) and 6) line and column number where the target region was found.
Entry 7) is the order the entry was emitted.

Entry 2) and 3) are required to distinguish files that have the same function name.
Entry 4) is required to distinguish different instances of the same declaration (usually templated ones)
Entries 5) and 6) are required to distinguish the particular target region in body of the function (it is possible that a given target region is not an entry point - if clause can evaluate always to zero - and therefore we need to identify the "interesting" target regions. )

This patch replaces http://reviews.llvm.org/D12306.

Reviewers: ABataev, hfinkel, tra, rjmccall, sfantao

Subscribers: FBrygidyn, piotr.rak, Hahnfeld, cfe-commits

Differential Revision: http://reviews.llvm.org/D12614

llvm-svn: 256842
2016-01-05 16:23:04 +00:00
Daniel Jasper 411af72e8c clang-format: Fix corner case in "if it saves columns"-calculation.
Before:
  aaaa
      .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
	  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
	  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 256841
2016-01-05 16:10:39 +00:00
Michael Zuckerman 5cbae95916 [AVX512] add PSLLD and PSLLQ Intrinsic
Differential Revision: http://reviews.llvm.org/D15885

llvm-svn: 256840
2016-01-05 15:17:39 +00:00
MinSeong Kim 4a9a4e198f [MISched] Explanatory error message when machine model is not complete. NFC
When not all instructions have a scheduling class,
the error message now provides a possible solution.

Differential Revision: http://reviews.llvm.org/D15854

llvm-svn: 256839
2016-01-05 14:50:15 +00:00
Anastasia Stulova cf04d04ccf [OpenCL] Disallow taking an address of a function.
An undecorated function designator implies taking the address of a function,
which is illegal in OpenCL. Implementing a check for this earlier to allow
the error to be reported even in the presence of other more obvious errors.

Patch by Neil Hickey!

http://reviews.llvm.org/D15691

llvm-svn: 256838
2016-01-05 14:39:27 +00:00
Aaron Ballman e09fcfb108 Reverting r256836; it causes a build bot failure: http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/14050/steps/build/logs/stdio
llvm-svn: 256837
2016-01-05 14:35:01 +00:00
Aaron Ballman 2566f4be50 Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.
Patch by Alexander Riccio

llvm-svn: 256836
2016-01-05 14:24:01 +00:00
Pavel Labath 6f38342af1 Mark a test_lldbmi_gdb_set_target_async_on as flaky on linux
Test fails in about 1% of buildbot runs. Marking as flaky to avoid the noise.

llvm-svn: 256835
2016-01-05 14:21:15 +00:00
Sagar Thakur 307a3ba3b3 [LLDB][MIPS] Make register read/write to set/get the size of register according to abi.
Summary:
For O32 abi register size should be 4 bytes.
For N32 and N64 abi register size should be 8 bytes.
This patch will make register read/write to set/get the size of register according to abi.

Reviewers: clayborg, tberghammer
Subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, bhushan, jaydeep
Differential: http://reviews.llvm.org/D15884
llvm-svn: 256834
2016-01-05 14:03:45 +00:00
Ewan Crawford 7093cccf92 Revert r256769
Reverts "Use correct format identifiers to print something meaningful."

Original format specifiers were correct.
Instead use void* casts to remove warnings, since this is what the %p specifier expects.

llvm-svn: 256833
2016-01-05 13:18:46 +00:00
Daniel Jasper 0a589416e8 clang-format: Handle \n the same way as std::endl with stream operator.
clang-format breaks multi-line streams after std::endl.
It now also break for '\n', the suggested replacement for std::endl:

  http://llvm.org/docs/CodingStandards.html#avoid-std-endl

Before:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n' << bbbbbbbbbbbbbbbbbbbbbb
               << '\n';
  llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n" << bbbb
               << "bbbbbbbbbbbbbbbbbb\n";

After:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n'
               << bbbbbbbbbbbbbbbbbbbbbb << '\n';
  llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n"
               << bbbb << "bbbbbbbbbbbbbbbbbb\n";

This changeset ensure that multiline streams have a line break after:
  - std::endl
  - '\n'
  - "\n"
  - "Some Text\n"

Patch by Jean-Philippe Dufraigne, thank you.

llvm-svn: 256832
2016-01-05 13:06:27 +00:00
Daniel Jasper 801cdb27e4 clang-format: Avoid creating hanging indents in call sequences.
Before:
  aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaa)
        .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa)
        .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 256831
2016-01-05 13:03:59 +00:00
Daniel Jasper 00492f96bf clang-format: Improve line wrapping behavior in call sequences.
r256750 has been leading to an undesired behavior:

  aaaaaaaaaa
      .aaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

This change increases penalty for wrapping before member accesses that aren't
calls. Thus, this is again formatted as (as it has been before r256750):

  aaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 256830
2016-01-05 13:03:50 +00:00
MinSeong Kim 50d9c156dd [AArch64] Teaches clang about Samsung Exynos-M1
Adds core tuning support for new Samsung Exynos-M1 core (ARMv8-A).

Differential Revision: http://reviews.llvm.org/D15664

llvm-svn: 256829
2016-01-05 12:53:24 +00:00
MinSeong Kim a7385ebf78 [AArch64] Add support for Samsung Exynos-M1
Adds core tuning support for new Samsung Exynos-M1 core (ARMv8-A).

Differential Revision: http://reviews.llvm.org/D15663

llvm-svn: 256828
2016-01-05 12:51:59 +00:00
Pavel Labath b4872150d2 Remove XTIMEOUT from TestEvents on linux
I'm getting rid of the expected timeouts. I'll XFAIL/skip any tests that show up as failing after
this (I haven't seen any when running locally, but maybe the buildbot will disagree).

llvm-svn: 256827
2016-01-05 12:51:26 +00:00
Tobias Grosser c28ae257c0 TODO: Polly can handle boolean expressions (Open->Done)
The necessary support was committed by Johannes in r249971.

llvm-svn: 256826
2016-01-05 11:48:59 +00:00