Commit Graph

260789 Commits

Author SHA1 Message Date
Richard Smith 145e15a37b [modules ts] Diagnose 'export' declarations outside of a module interface.
llvm-svn: 301271
2017-04-24 23:12:30 +00:00
Matt Arsenault e8d0539f20 InferAddressSpaces: Remove redundant assert
This is just asserting all the operations are handled in the
switch, which the unreachable already handles.

llvm-svn: 301270
2017-04-24 23:02:57 +00:00
Sanjay Patel 6b01b4f5a6 [ARM, x86] add more vector tests for bool math; NFC
I'm proposing a fold for increment-of-sexted-bool in:
https://reviews.llvm.org/D31944
...so we need to know what happens in more cases like these.

llvm-svn: 301269
2017-04-24 22:42:34 +00:00
Reid Kleckner df7263567a [git-llvm] Remove CR from middle of svn propget output
llvm-svn: 301268
2017-04-24 22:26:46 +00:00
Reid Kleckner 63b26f0eea Make getSlotAttributes return an AttributeSet instead of a wrapper list
Remove the temporary, poorly named getSlotSet method which did the same
thing. Also remove getSlotNode, which is a hold-over from when we were
dealing with AttributeSetNode* instead of AttributeSet.

llvm-svn: 301267
2017-04-24 22:25:02 +00:00
Siddharth Bhat 729377f063 [Polly] [DependenceInfo] change WAR generation, Read will not block Read
Earlier, the call to buildFlow was:
    WAR = buildFlow(Write, Read, MustWrite, Schedule).

This meant that Read could block another Read, since must-sources can
block each other.

Fixed the call to buildFlow to correctly compute Read. The resulting
code needs to do some ISL juggling to get the output we want.

Bug report: https://bugs.llvm.org/show_bug.cgi?id=32623

Reviewers: Meinersbur

Tags: #polly

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

llvm-svn: 301266
2017-04-24 22:23:12 +00:00
Rafael Espindola 8fb1efa4d0 Mark a test as requiring a shell.
llvm-svn: 301265
2017-04-24 22:20:22 +00:00
Rui Ueyama 95fe854332 Handle _LINK_ env string as command line parameters.
"_LINK_" environment varaible should be appended to the command line.
https://msdn.microsoft.com/en-us/library/6y6t9esh.aspx

Fixes https://bugs.llvm.org/show_bug.cgi?id=32756

llvm-svn: 301264
2017-04-24 22:20:03 +00:00
Sean Callanan b494578afb [DWARF] Fix lookup in the abstract origins of inlined blocks/functions
LLDB uses clang::DeclContexts for lookups, and variables get put into
the DeclContext for their abstract origin. (The abstract origin is a 
DWARF pointer that indicates the unique definition of inlined code.) 
When the expression parser is looking for variables, it locates the 
DeclContext for the current context. This needs to be done carefully, 
though, e.g.:

__attribute__ ((always_inline)) void f(int a) {
  {
    int b = a * 2;
  }
}

void g() {
  f(3);
}
Here, if we're stopped in the inlined copy of f, we have to find the 
DeclContext corresponding to the definition of f – its abstract 
origin. Clang doesn't allow multiple functions with the same name and 
arguments to exist. It also means that any variables we see must be 
placed in the appropriate DeclContext.

[Bug 1]: When stopped in an inline block, the function 
GetDeclContextDIEContainingDIE for that block doesn't properly
construct a DeclContext for the abstract origin for inlined
subroutines. That means we get duplicated function DeclContexts, but
function arguments only get put in the abstract origin's DeclContext, 
and as a result when we try to look for them in nested contexts they 
aren't found.

[Bug 2]: When stopped in an inline block, the DWARF (for space 
reasons) doesn't explicitly point to the abstract origin for that 
block. This means that the function GetClangDeclContextForDIE returns
a different DeclContext for each place the block is inlined. However, 
any variables defined in the block have abstract origins, so they 
will only get placed in the DeclContext for their abstract origin.

In this fix, I've introduced a test covering both of these issues,
and fixed them.

Bug 1 could be resolved simply by making sure we look up the abstract
origin for inlined functions when looking up their DeclContexts on 
behalf of nested blocks.

For Bug 2, I've implemented an algorithm that makes the DeclContext 
for a block be the containing DeclContext for the closest entity we
would find during lookup that has an abstract origin pointer. That
means that in the following situation:

{ // block 1
  int a;
  { // block 2
    int b;
  }
}
if we looked up the DeclContext for block 2, we'd find the block 
containing the abstract origin of b, and lookup would proceed 
correctly because we'd see b and a. However, in the situation

{ // block 1
  int a;
  { // block 2
  }
}
since there isn't anything to look up in block 2, we can't determine 
its abstract origin (and there is no such pointer in the DWARF for 
blocks). However, we can walk up the parent chain and find a, and its 
abstract origin lives in the abstract origin of block 1. So we simply 
say that the DeclContext for block 2 is the same as the DeclContext 
for block 1, which contains a. Lookups will return the same results.

Thanks to Jim Ingham for review and suggestions.

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

llvm-svn: 301263
2017-04-24 22:11:10 +00:00
Reid Kleckner 4534097b0b [git-llvm] Make `push` work on CRLF files with svn:eol-style=native
Summary:
`git apply` on Windows doesn't work for files that SVN checks out as
CRLF. There is no way to force SVN to check everything out with Unix
line endings on Windows. Files with svn:eol-style=native will always
come out with CRLF, breaking `git apply`, which wants Unix line endings.
My workaround is to list all files with this property set in the change,
and run `dos2unix` on them. SVN doesn't commit a massive line ending
change because the svn:eol-style property indicates that these are text
files.

Tested on r301245.

Reviewers: zturner, jlebar

Subscribers: llvm-commits

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

llvm-svn: 301262
2017-04-24 22:09:08 +00:00
Bruno Cardoso Lopes 7bd3d9f0d7 [Modules] Fix test to wipe out the cache before using it
This should appease bots:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_check/35914

rdar://problem/31796737

llvm-svn: 301261
2017-04-24 21:58:13 +00:00
Sanjay Patel 35c362ebbb [InstSimplify] use ConstantRange to simplify more and-of-icmps
We can simplify (and (icmp X, C1), (icmp X, C2)) to one of the icmps in many cases. 
I had to check some of these with Alive to prove to myself it's right, but everything 
seems to check out. Eg, the code in instcombine was completely ignoring predicates with 
mismatched signedness.

Handling or-of-icmps would be a follow-up step.

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

llvm-svn: 301260
2017-04-24 21:52:39 +00:00
Rafael Espindola 3460cdd440 Remove DefaultSoName.
We can just use the existing SoName member variable. It now initially
contains what was in DefaultSoName and is modified if the .so has an
actual soname.

llvm-svn: 301259
2017-04-24 21:44:20 +00:00
Simon Pilgrim 93da6660a2 [DAGCombiner] Use APInt::intersects to avoid tmp variable. NFCI.
llvm-svn: 301258
2017-04-24 21:43:21 +00:00
Evgeniy Stepanov 0b11403d55 [cfi] Fix wrong CMake condition for WIN32.
llvm-svn: 301257
2017-04-24 21:27:47 +00:00
Evgeniy Stepanov 2c201068dd [asan] Remove asanwrapper from Android test harness.
It is only necessary for pre-L and creates problems on newer builds.

llvm-svn: 301256
2017-04-24 21:27:45 +00:00
Matt Arsenault e22184940b AMDGPU: Slightly simplify prolog reserved register handling
Rely on MachineRegisterInfo's knowledge of used physical
registers.

Move flat_scratch initialization earlier, so the uses are visible
when making these decisions.

This will make it easier to add another reserved register
at the end for the stack pointer rather than handling another
special case.

llvm-svn: 301254
2017-04-24 21:08:32 +00:00
Galina Kistanova 5fda6a90e0 Cosmetic change.
llvm-svn: 301253
2017-04-24 21:06:29 +00:00
Saleem Abdulrasool 53972d60cb ProfileData: clean up some stale declarations (NFC)
These were removed in SVN r300381.  Remove the declarations.

llvm-svn: 301252
2017-04-24 21:05:05 +00:00
Artem Dergachev cbd7cd8360 [analyzer] Improve subscripting null arrays for catching null dereferences.
Array-to-pointer cast now works correctly when the pointer to the array
is concrete, eg. null, which allows further symbolic calculations involving
such values.

Inlined defensive checks are now detected correctly when the resulting null
symbol is being array-subscripted before dereference.

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

llvm-svn: 301251
2017-04-24 20:55:07 +00:00
Vedant Kumar 9e32aa2587 Remove a dead field. NFC.
Suggested by Adam Folwarczny!

llvm-svn: 301250
2017-04-24 20:54:36 +00:00
Vedant Kumar bc370f0c18 [Coverage] Avoid null deref in skipRegionMappingForDecl (fixes PR32761)
Patch by Adam Folwarczny!

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

llvm-svn: 301249
2017-04-24 20:52:04 +00:00
Galina Kistanova c7524f05b2 Small addition on how to add a builder.
llvm-svn: 301248
2017-04-24 20:48:40 +00:00
Artem Tamazov d6656b945e [AMDGPU][mc][tests][NFC] Bulk ISA tests: update for Gfx7/Gfx8, add for Gfx9.
llvm-svn: 301247
2017-04-24 20:42:27 +00:00
George Karpenkov d4fec71b9b Specify a target explicitly in libfuzzer driver flag test
llvm-svn: 301246
2017-04-24 20:38:56 +00:00
Reid Kleckner b4a2d18777 [Bitcode] Refactor attribute group writing to avoid getSlotAttributes
Summary:
That API creates a temporary AttributeList to carry an index and a
single AttributeSet. We need to carry the index in addition to the set,
because that is how attribute groups are currently encoded.

NFC

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 301245
2017-04-24 20:38:30 +00:00
Teresa Johnson b2c390e9f5 Update profile during memory instrinsic optimization
Summary:
Ensure that the new merge BB (which contains the rest of the original BB
after the mem op being optimized) gets a profile frequency, in case
there are additional mem ops later in the BB. Otherwise they get skipped
as the merge BB looks cold.

Reviewers: davidxl, xur

Subscribers: llvm-commits

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

llvm-svn: 301244
2017-04-24 20:30:42 +00:00
Evgeniy Stepanov ed8c47477f [asan] Use posix strerror_r interceptor on android.
This fixes a regression in r297315.

llvm-svn: 301243
2017-04-24 20:25:39 +00:00
Matt Arsenault 4474652c95 Revert "StructurizeCFG: Directly invert cmp instructions"
This reverts commit r300732. This breaks a few tests.
I think the problem is related to adding more uses of
the condition that don't yet exist at this point.

llvm-svn: 301242
2017-04-24 20:25:01 +00:00
Davide Italiano ca81fbcadb [LoopUnroll] Remove spurious newline.
Eli pointed out in the review, but I didn't squash the two commits
correctly. Pointy-hat to me.

llvm-svn: 301241
2017-04-24 20:17:38 +00:00
Frederich Munch fd96d5e1c9 Revert "Refactor DynamicLibrary so searching for a symbol will have a defined order"
The i686-mingw32-RA-on-linux bot is still having errors.

This reverts commit r301236.

llvm-svn: 301240
2017-04-24 20:16:01 +00:00
Davide Italiano 0f62eea7ff [LoopUnroll] Don't try to unroll non canonical loops.
The current Loop Unroll implementation works with loops having a
single latch that contains a conditional branch to a block outside
the loop (the other successor is, by defition of latch, the header).
If this precondition doesn't hold, avoid unrolling the loop as
the code is not ready to handle such circumstances.

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

llvm-svn: 301239
2017-04-24 20:14:11 +00:00
Sanjoy Das 206f65c049 [LIR] Obey non-integral pointer semantics
Summary: See http://llvm.org/docs/LangRef.html#non-integral-pointer-type

Reviewers: haicheng

Reviewed By: haicheng

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

llvm-svn: 301238
2017-04-24 20:12:10 +00:00
Saleem Abdulrasool d056cb4b74 Avoid unnecessary copies in some for loops
Use constant references rather than `const auto` which will cause the
copy constructor.  These particular cases cause issues for the swift
compiler.

llvm-svn: 301237
2017-04-24 20:01:03 +00:00
Frederich Munch 70c377a362 Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

llvm-svn: 301236
2017-04-24 19:55:16 +00:00
Evgeniy Stepanov 5d7633f75d [cfi] Disable ThinLTO + CFI tests on Windows.
PR32770.

llvm-svn: 301235
2017-04-24 19:52:51 +00:00
Krzysztof Parzyszek c8e8e2a046 Move value type list from TargetRegisterClass to TargetRegisterInfo
Differential Revision: https://reviews.llvm.org/D31937

llvm-svn: 301234
2017-04-24 19:51:12 +00:00
Carlo Bertolli f09daae75d Revert r301223
llvm-svn: 301233
2017-04-24 19:50:35 +00:00
Krzysztof Parzyszek 98ab4c64c4 Revert r301231: Accidentally committed stale files
I forgot to commit local changes before commit.

llvm-svn: 301232
2017-04-24 19:48:51 +00:00
Krzysztof Parzyszek c0197066d7 Move value type list from TargetRegisterClass to TargetRegisterInfo
Differential Revision: https://reviews.llvm.org/D31937

llvm-svn: 301231
2017-04-24 19:43:45 +00:00
Matt Arsenault 0774ea267a AMDGPU: Select scratch mubuf offsets when pointer is a constant
In call sequence setups, there may not be a frame index base
and the pointer is a constant offset from the frame
pointer / scratch wave offset register.

llvm-svn: 301230
2017-04-24 19:40:59 +00:00
Matt Arsenault df6539f44b AMDGPU: Set StackGrowsUp in MCAsmInfo
Not sure what this does though.

llvm-svn: 301229
2017-04-24 19:40:51 +00:00
Stanislav Mekhanoshin bd5394be3d [AMDGPU] Merge M0 initializations
Merges equivalent initializations of M0 and hoists them into a common
dominator block. Technically the same code can be used with any
register, physical or virtual.

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

llvm-svn: 301228
2017-04-24 19:37:54 +00:00
Piotr Padlewski 610c966a4e Handle invariant.group.barrier in BasicAA
Summary:
llvm.invariant.group.barrier returns pointer that mustalias
pointer it takes. It can't be marked with `returned` attribute,
because it would be remove easily. The other reason is that
only Alias Analysis can know about this, because if any other
pass would know it, then the result would be replaced with it's
argument, which would be invalid.

We can think about returned pointer as something that mustalias, but
it doesn't have to be bitwise the same as the argument.

Reviewers: dberlin, chandlerc, hfinkel, sanjoy

Subscribers: reames, nlewycky, rsmith, anna, amharc

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

llvm-svn: 301227
2017-04-24 19:37:17 +00:00
Evgeniy Stepanov 9e536081fe [asan] Let the frontend disable gc-sections optimization for asan globals.
Also extend -asan-globals-live-support flag to all binary formats.

llvm-svn: 301226
2017-04-24 19:34:13 +00:00
Evgeniy Stepanov df217a2f3c [asan] Disable ASan global-GC depending on the target and compiler flags.
llvm-svn: 301225
2017-04-24 19:34:12 +00:00
Artem Dergachev 37de888867 [analyzer] Improve suppression for inlined defensive checks before operator &.
Null dereferences are suppressed if the lvalue was constrained to 0 for the
first time inside a sub-function that was inlined during analysis, because
such constraint is a valid defensive check that does not, by itself,
indicate that null pointer case is anyhow special for the caller.

If further operations on the lvalue are performed, the symbolic lvalue is
collapsed to concrete null pointer, and we need to track where does the null
pointer come from.

Improve such tracking for lvalue operations involving operator &.

rdar://problem/27876009

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

llvm-svn: 301224
2017-04-24 19:30:33 +00:00
Carlo Bertolli 4287d65c10 [OpenMP] Initial implementation of code generation for pragma 'distribute parallel for' on host
https://reviews.llvm.org/D29508

This patch makes the following additions:

1. It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation.
2. It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses.

It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code.

Looking forward to comments.

llvm-svn: 301223
2017-04-24 19:26:11 +00:00
Mandeep Singh Grang 799a2edb3d [SimplifyCFG] Fix for non-determinism in codegen
Summary: This patch fixes issues in codegen uncovered due to https://reviews.llvm.org/D26718

Reviewers: majnemer, chenli, davide

Reviewed By: davide

Subscribers: davide, arsenm, llvm-commits

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

llvm-svn: 301222
2017-04-24 19:20:45 +00:00
Krzysztof Parzyszek 44e25f37ae Move size and alignment information of regclass to TargetRegisterInfo
1. RegisterClass::getSize() is split into two functions:
   - TargetRegisterInfo::getRegSizeInBits(const TargetRegisterClass &RC) const;
   - TargetRegisterInfo::getSpillSize(const TargetRegisterClass &RC) const;
2. RegisterClass::getAlignment() is replaced by:
   - TargetRegisterInfo::getSpillAlignment(const TargetRegisterClass &RC) const;

This will allow making those values depend on subtarget features in the
future.

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

llvm-svn: 301221
2017-04-24 18:55:33 +00:00