platform/upstream/llvm.git
7 years agoSplitting out test for Darwin for print-stack-trace:
George Karpenkov [Mon, 24 Jul 2017 20:35:20 +0000 (20:35 +0000)]
Splitting out test for Darwin for print-stack-trace:

New default symbolizer can not symbolize inlined function which appear
under -O3.

llvm-svn: 308925

7 years agoSmall tweak to one check in error handling to the dyld compact export
Kevin Enderby [Mon, 24 Jul 2017 20:33:41 +0000 (20:33 +0000)]
Small tweak to one check in error handling to the dyld compact export
entries in libObject (done in r308690).  In the case when the last node
has no children setting State.Current = Children + 1; where that would be past
Trie.end() is actually ok since the pointer is not used with zero children.

rdar://33490512

llvm-svn: 308924

7 years agoMove MemoryAccess::InvalidDomain to isl++
Tobias Grosser [Mon, 24 Jul 2017 20:30:34 +0000 (20:30 +0000)]
Move MemoryAccess::InvalidDomain to isl++

llvm-svn: 308923

7 years ago[mips] Switch asm to __asm__ for non-GNU compiles.
Stephen Hines [Mon, 24 Jul 2017 20:25:08 +0000 (20:25 +0000)]
[mips] Switch asm to __asm__ for non-GNU compiles.

Summary:
Using asm works fine for gnu11, but fails if the compiler uses C11.
Switch to the more consistent __asm__, since that is what the rest of
the source is using.

Reviewers: petarj

Reviewed By: petarj

Subscribers: llvm-commits, sdardis, arichardson, pirama

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

llvm-svn: 308922

7 years ago[ELF] Fix a typo introduced in r308915.
Davide Italiano [Mon, 24 Jul 2017 20:18:16 +0000 (20:18 +0000)]
[ELF] Fix a typo introduced in r308915.

Thanks to Rafael for finding it in a post-commit review.

llvm-svn: 308921

7 years ago[LTO] Make sure symbol ordering is honoured also for data.
Davide Italiano [Mon, 24 Jul 2017 20:15:07 +0000 (20:15 +0000)]
[LTO] Make sure symbol ordering is honoured also for data.

Follow-up to r308915 suggested by Rafael and Peter.

llvm-svn: 308920

7 years agoSkip test_lldbmi_var_update on Darwin.
Sean Callanan [Mon, 24 Jul 2017 20:11:20 +0000 (20:11 +0000)]
Skip test_lldbmi_var_update on Darwin.

llvm-svn: 308919

7 years ago[clang-format] Reorder assignments, NFC
Krasimir Georgiev [Mon, 24 Jul 2017 19:52:49 +0000 (19:52 +0000)]
[clang-format] Reorder assignments, NFC

llvm-svn: 308918

7 years agoFollowup to r308890: don't assert the llvm llvm version number.
James Y Knight [Mon, 24 Jul 2017 19:44:43 +0000 (19:44 +0000)]
Followup to r308890: don't assert the llvm llvm version number.

llvm-svn: 308917

7 years ago[ELF] Fix a couple of typos in a test.
Davide Italiano [Mon, 24 Jul 2017 19:42:13 +0000 (19:42 +0000)]
[ELF] Fix a couple of typos in a test.

llvm-svn: 308916

7 years ago[LTO] Make sure symbol ordering is honoured.
Davide Italiano [Mon, 24 Jul 2017 19:38:13 +0000 (19:38 +0000)]
[LTO] Make sure symbol ordering is honoured.

We do this emitting a section for every function when LTO is used.
Fixes PR33888.

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

llvm-svn: 308915

7 years ago[Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump
Krzysztof Parzyszek [Mon, 24 Jul 2017 19:35:48 +0000 (19:35 +0000)]
[Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump

llvm-svn: 308914

7 years agoMove DWARFSectionMap to a .cpp file.
Rafael Espindola [Mon, 24 Jul 2017 19:34:26 +0000 (19:34 +0000)]
Move DWARFSectionMap to a .cpp file.

Thanks to Paul Robinson for the suggestion.

llvm-svn: 308913

7 years agotest-release.sh: Fix phase2 and phase3 binary comparision
Tom Stellard [Mon, 24 Jul 2017 19:28:30 +0000 (19:28 +0000)]
test-release.sh: Fix phase2 and phase3 binary comparision

Summary:
scudo_utils.cpp.o from compiler-rt has one of the host compiler's builtin
include paths stored in the .debug_line section.  So we need to do
sed 's,Phase1,Phase2,g` on the Phase2 object file so it matches Phase3.

Reviewers: hans

Reviewed By: hans

Subscribers: llvm-commits

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

llvm-svn: 308912

7 years agoDon't allow .debug_types to be parsed as LLDB can crash when enums are not able to...
Greg Clayton [Mon, 24 Jul 2017 18:40:33 +0000 (18:40 +0000)]
Don't allow .debug_types to be parsed as LLDB can crash when enums are not able to be found.

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

llvm-svn: 308911

7 years agoRevert "Revert "[libFuzzer] Add a dependency on symbolizer from libFuzzer tests""
George Karpenkov [Mon, 24 Jul 2017 18:38:14 +0000 (18:38 +0000)]
Revert "Revert "[libFuzzer] Add a dependency on symbolizer from libFuzzer tests""

This reverts commit 15425f2bc6eac6249ee957a2a280511306c07547.

Should work now that atos is a default symbolizer on Darwin.

llvm-svn: 308910

7 years agoAdding base test for interleave store VF16 and expand the test for AVX512
Michael Zuckerman [Mon, 24 Jul 2017 18:29:56 +0000 (18:29 +0000)]
Adding base test for interleave store VF16 and expand the test for AVX512
This patch doesn't modifay any non test file.

llvm-svn: 308909

7 years agoPrefer atos to llvm-symbolizer on Darwin
George Karpenkov [Mon, 24 Jul 2017 18:24:08 +0000 (18:24 +0000)]
Prefer atos to llvm-symbolizer on Darwin

atos is the default symbolizer on Apple's compiler for quite a few years now.
llvm-symbolizer is quite fragile on Darwin: for example, unless a .dSYM
file was explicitly generated symbolication would not work.
It is also very convenient when the behavior of LLVM open source
compiler matches to that of Apple's compiler on Apple's platform.
Furthermore, llvm-symbolizer is not installed on Apple's platform by
default, which leads to strange behavior during debugging: the test
might fail under lit (where it has llvm-symbolizer) but would run
properly when launched on the command line (where it does not, and atos
would be used).

Indeed, there's a downside: atos does not work properly with inlined
functions, hence the test change.
We do not think that this is a major problem, as users would often
compile with -O0 when debugging, and in any case it is preferable to
symbolizer not being able to symbolize.

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

llvm-svn: 308908

7 years ago[scudo] Fix QuarantineChunksUpToSize failing test on AArch64
Kostya Kortchinsky [Mon, 24 Jul 2017 18:22:33 +0000 (18:22 +0000)]
[scudo] Fix QuarantineChunksUpToSize failing test on AArch64

Summary:
Warm-up the other 2 sizes used by the tests, which should get rid of a failure
on AArch64.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: aemerson, rengolin, llvm-commits, kristof.beyls

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

llvm-svn: 308907

7 years agoRA: Replace asserts related to empty live intervals
Matt Arsenault [Mon, 24 Jul 2017 18:07:55 +0000 (18:07 +0000)]
RA: Replace asserts related to empty live intervals

These don't exactly assert the same thing anymore, and
allow empty live intervals with non-empty uses.

Removed in r308808 and r308813.

llvm-svn: 308906

7 years agoRFix PR33875 by distinguishing between DWO and clang modules.
Adrian Prantl [Mon, 24 Jul 2017 18:06:39 +0000 (18:06 +0000)]
RFix PR33875 by distinguishing between DWO and clang modules.

This reapplies https://reviews.llvm.org/D35740 with a tweak to find
the section by name rather than type. Section types don't distinguish
between regular sections and their DWO counterparts.

llvm-svn: 308905

7 years ago[AArch64] Adjust the cost model for Exynos M1 and M2
Evandro Menezes [Mon, 24 Jul 2017 18:06:16 +0000 (18:06 +0000)]
[AArch64] Adjust the cost model for Exynos M1 and M2

Fine tune the resources in a couple of ASIMD loads.

llvm-svn: 308904

7 years agoAMDGPU: Fix allocating pseudo-registers
Matt Arsenault [Mon, 24 Jul 2017 18:06:15 +0000 (18:06 +0000)]
AMDGPU: Fix allocating pseudo-registers

There's no need for these to be part of a class since
they are immediately replaced. New unreachable hit in
existing tests.'

llvm-svn: 308903

7 years agoRevert "Debug: handle dumping the D language."
Tim Northover [Mon, 24 Jul 2017 17:47:46 +0000 (17:47 +0000)]
Revert "Debug: handle dumping the D language."

Reid beat me to it.

llvm-svn: 308902

7 years agoDebug: handle dumping the D language.
Tim Northover [Mon, 24 Jul 2017 17:39:44 +0000 (17:39 +0000)]
Debug: handle dumping the D language.

Mostly just to silence a warning about an unhandled case. There don't seem to
be any tests for this operator (at least that I could find).

llvm-svn: 308901

7 years ago[CMake] Remove redundant logic in runtimes/CMakeList.txt
Leo Li [Mon, 24 Jul 2017 17:26:28 +0000 (17:26 +0000)]
[CMake] Remove redundant logic in runtimes/CMakeList.txt

Summary:
`SUB_CHECK_TARGETS` contains all test targets in `SUB_COMPONENTS` when
we load `Components.cmake`. We don't need to add those targets
again and having duplicate targets will break the cmake policy CMP0002.

Reviewers: phosek

Subscribers: mgorny, llvm-commits, srhines, pirama

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

llvm-svn: 308900

7 years ago[CodeGen] Propagate dllexport to thunks
Shoaib Meenai [Mon, 24 Jul 2017 17:16:27 +0000 (17:16 +0000)]
[CodeGen] Propagate dllexport to thunks

Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now. This is consistent with MinGW GCC's behavior.

This redoes r306770 but limits the logic to Itanium. MicrosoftCXXABI's
setThunkLinkage ensures that thunks aren't exported under that ABI, so
I'm handling this in ItaniumCXXABI's setThunkLinkage for symmetry.

We need to export these thunks because they can be referenced outside
the library they're defined in. For example, if a child class without a
key function inherits from a parent class with a key function, the
parent's thunks will only be defined in the library with the key
function, but the construction vtable for the parent in the child might
be emitted outside the library (since the child doesn't have a key
function), and it needs to reference the parent's thunks.

We don't need to mark these thunks as imported since any references to
them will occur in data, so the compiler can't generate the IAT load
sequence anyway. Instead, we rely on the linker generating import thunks
for the thunks.

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

llvm-svn: 308899

7 years agoAArch64 & ARM: move TargetInfo functions from .h to .cpp file. NFC.
Tim Northover [Mon, 24 Jul 2017 17:06:23 +0000 (17:06 +0000)]
AArch64 & ARM: move TargetInfo functions from .h to .cpp file. NFC.

Most of them are virtual anyway, and the few remaining ones can move to the
.cpp for consistency.

llvm-svn: 308898

7 years agoWork around an MSVC2017 update 3 codegen bug.
Nico Weber [Mon, 24 Jul 2017 16:54:11 +0000 (16:54 +0000)]
Work around an MSVC2017 update 3 codegen bug.

C2017 update 3 produces a clang that crashes when compiling clang. Disabling
optimizations for StmtProfiler::VisitCXXOperatorCallExpr() makes the crash go
away.

Patch from Bruce Dawson <brucedawson@chromium.org>!
https://reviews.llvm.org/D35757

llvm-svn: 308897

7 years agoDon't crash when hostname is empty. StringRef will assert and kill your program.
Greg Clayton [Mon, 24 Jul 2017 16:47:04 +0000 (16:47 +0000)]
Don't crash when hostname is empty. StringRef will assert and kill your program.

llvm-svn: 308896

7 years agoMove MemoryAccess::getPwAff to isl++
Tobias Grosser [Mon, 24 Jul 2017 16:36:34 +0000 (16:36 +0000)]
Move MemoryAccess::getPwAff to isl++

llvm-svn: 308895

7 years agoAdd missing case to switch
Reid Kleckner [Mon, 24 Jul 2017 16:30:44 +0000 (16:30 +0000)]
Add missing case to switch

llvm-svn: 308894

7 years agoMove MemoryAccess::MemoryAccess to isl++
Tobias Grosser [Mon, 24 Jul 2017 16:22:32 +0000 (16:22 +0000)]
Move MemoryAccess::MemoryAccess to isl++

llvm-svn: 308893

7 years agoMove ScopArrayInfo::getFromAccessFunction and getFromId to isl++
Tobias Grosser [Mon, 24 Jul 2017 16:22:27 +0000 (16:22 +0000)]
Move ScopArrayInfo::getFromAccessFunction and getFromId to isl++

llvm-svn: 308892

7 years ago[CodeGenPrepare] Cut off FindAllMemoryUses if there are too many uses.
Benjamin Kramer [Mon, 24 Jul 2017 16:18:09 +0000 (16:18 +0000)]
[CodeGenPrepare] Cut off FindAllMemoryUses if there are too many uses.

This avoids excessive compile time. The case I'm looking at is
Function.cpp from an old version of LLVM that still had the giant memcmp
string matcher in it. Before r308322 this compiled in about 2 minutes,
after it, clang takes infinite* time to compile it. With this patch
we're at 5 min, which is still bad but this is a pathological case.

The cut off at 20 uses was chosen by looking at other cut-offs in LLVM
for user scanning. It's probably too high, but does the job and is very
unlikely to regress anything.

Fixes PR33900.

* I'm impatient and aborted after 15 minutes, on the bug report it was
  killed after 2h.

llvm-svn: 308891

7 years ago[codeview] Emit 'D' as the cv source language for D code
Reid Kleckner [Mon, 24 Jul 2017 16:16:42 +0000 (16:16 +0000)]
[codeview] Emit 'D' as the cv source language for D code

This matches DMD:
https://github.com/dlang/dmd/blob/522263965cf3a27ed16b31f3c3562db86cdeabec/src/ddmd/backend/cv8.c#L199

Fixes PR33899.

llvm-svn: 308890

7 years agoFormat some case labels and shrink an anonymous namespace NFC
Reid Kleckner [Mon, 24 Jul 2017 16:16:17 +0000 (16:16 +0000)]
Format some case labels and shrink an anonymous namespace NFC

llvm-svn: 308889

7 years agoNFC. Fixed typos in the comments.
Ilya Biryukov [Mon, 24 Jul 2017 16:02:29 +0000 (16:02 +0000)]
NFC. Fixed typos in the comments.

llvm-svn: 308888

7 years ago[ForwardOpTree] Properly indent enumeration in comment. NFC.
Michael Kruse [Mon, 24 Jul 2017 15:34:03 +0000 (15:34 +0000)]
[ForwardOpTree] Properly indent enumeration in comment. NFC.

llvm-svn: 308887

7 years ago[ForwardOpTree] Rename FD_CanForward to FD_CanForwardLeaf. NFC.
Michael Kruse [Mon, 24 Jul 2017 15:33:58 +0000 (15:33 +0000)]
[ForwardOpTree] Rename FD_CanForward to FD_CanForwardLeaf. NFC.

To make the meaning and distinction to FD_CanForwardTree clearer.

llvm-svn: 308886

7 years ago[ForwardOpTree] Add comments to ForwardingDecision items. NFC.
Michael Kruse [Mon, 24 Jul 2017 15:33:53 +0000 (15:33 +0000)]
[ForwardOpTree] Add comments to ForwardingDecision items. NFC.

In particular, explain the difference between FD_CanForward
and FD_CanForwardTree.

llvm-svn: 308885

7 years ago[scudo] Quarantine overhaul
Kostya Kortchinsky [Mon, 24 Jul 2017 15:29:38 +0000 (15:29 +0000)]
[scudo] Quarantine overhaul

Summary:
First, some context.

The main feedback we get about the quarantine is that it's too memory hungry.
A single MB of quarantine will have an impact of 3 to 4MB of PSS/RSS, and
things quickly get out of hand in terms of memory usage, and the quarantine
ends up disabled.

The main objective of the quarantine is to protect from use-after-free
exploitation by making it harder for an attacker to reallocate a controlled
chunk in place of the targeted freed chunk. This is achieved by not making it
available to the backend right away for reuse, but holding it a little while.

Historically, what has usually been the target of such attacks was objects,
where vtable pointers or other function pointers could constitute a valuable
targeti to replace. Those are usually on the smaller side. There is barely any
advantage in putting the quarantine several megabytes of RGB data or the like.

Now for the patch.

This patch introduces a new way the Quarantine behaves in Scudo. First of all,
the size of the Quarantine will be defined in KB instead of MB, then we
introduce a new option: the size up to which (lower than or equal to) a chunk
will be quarantined. This way, we only quarantine smaller chunks, and the size
of the quarantine remains manageable. It also prevents someone from triggering
a recycle by allocating something huge. We default to 512 bytes on 32-bit and
2048 bytes on 64-bit platforms.

In details, the patches includes the following:
- introduce `QuarantineSizeKb`, but honor `QuarantineSizeMb` if set to fall
  back to the old behavior (meaning no threshold in that case);
  `QuarantineSizeMb` is described as deprecated in the options descriptios;
  documentation update will follow;
- introduce `QuarantineChunksUpToSize`, the new threshold value;
- update the `quarantine.cpp` test, and other tests using `QuarantineSizeMb`;
- remove `AllocatorOptions::copyTo`, it wasn't used;
- slightly change the logic around `quarantineOrDeallocateChunk` to accomodate
  for the new logic; rename a couple of variables there as well;

Rewriting the tests, I found a somewhat annoying bug where non-default aligned
chunks would account for more than needed when placed in the quarantine due to
`<< MinAlignment` instead of `<< MinAlignmentLog`. This is fixed and tested for
now.

Reviewers: alekseyshl, kcc

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 308884

7 years ago[OPENMP] Fix the restrictions for in_reduction clause.
Alexey Bataev [Mon, 24 Jul 2017 14:52:13 +0000 (14:52 +0000)]
[OPENMP] Fix the restrictions for in_reduction clause.

This patch allows to use in_reduction clause even if the innermost
directive is not taskgroup.

llvm-svn: 308883

7 years ago[clang-format] Fix comment levels between '} else {' and PPDirective.
Krasimir Georgiev [Mon, 24 Jul 2017 14:51:59 +0000 (14:51 +0000)]
[clang-format] Fix comment levels between '} else {' and PPDirective.

Summary:
This fixes a regression exposed by r307795 and rL308725 in which the level of a
comment line between '} else {' and a preprocessor directive is incorrectly set
as the level of the '} else {' line. For example, this :
```
int f(int i) {
  if (i) {
    ++i;
  } else {
    // comment
#ifdef A
    --i;
#endif
  }
}
```
was formatted as:
```
int f(int i) {
  if (i) {
    ++i;
  } else {
  // comment
#ifdef A
    --i;
#endif
  }
}
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 308882

7 years ago[compiler-rt] Add missing const specifier to MemoryMappedSegment functions
Francis Ricci [Mon, 24 Jul 2017 14:31:01 +0000 (14:31 +0000)]
[compiler-rt] Add missing const specifier to MemoryMappedSegment functions

llvm-svn: 308881

7 years agomake sure that we don't call basic_streambuf::gbump with a value bigger than INT_MAX...
Marshall Clow [Mon, 24 Jul 2017 14:05:10 +0000 (14:05 +0000)]
make sure that we don't call basic_streambuf::gbump with a value bigger than INT_MAX, since it only takes an int. Related to, but not quite the same as PR33725

llvm-svn: 308880

7 years ago[mips] Add support for -m(no-)extern-data.
Simon Dardis [Mon, 24 Jul 2017 14:02:09 +0000 (14:02 +0000)]
[mips] Add support for -m(no-)extern-data.

Add support for -m(no-)extern-data when using -mgpopt in the driver. It is
enabled by default in the backend.

Reviewers: atanasyan, slthakur

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

llvm-svn: 308879

7 years ago[DOTGraphTraits] Propagate Graph template argument, NFC
Alexandre Isoard [Mon, 24 Jul 2017 12:55:00 +0000 (12:55 +0000)]
[DOTGraphTraits] Propagate Graph template argument, NFC

Propagates the GraphT template argument to the default value of
the AnalysisGraphTraitsT template argument. This allows to specialize
the DefaultAnalysisGraphTraits<AnalysisT,GraphT> for analysis with a
graph type different from the analysis type and it will automatically
get picked-up.

Note: This was probably the intended purpose and should not result in any
      functional change.
llvm-svn: 308878

7 years agoFix spelling in comments. NFCI.
Simon Pilgrim [Mon, 24 Jul 2017 12:44:35 +0000 (12:44 +0000)]
Fix spelling in comments. NFCI.

llvm-svn: 308877

7 years ago[ForwardOpTree] Support read-only value uses.
Michael Kruse [Mon, 24 Jul 2017 12:43:27 +0000 (12:43 +0000)]
[ForwardOpTree] Support read-only value uses.

Read-only values (values defined before the SCoP) require special
handing with -polly-analyze-read-only-scalars=true (which is the
default). If active, each use of a value requires a read access.
When a copied value uses a read-only value, we must also ensure that
such a MemoryAccess is available or is created.

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

llvm-svn: 308876

7 years ago[Polly] [NFC] [ScopDetection] Make `polly-only-func` perform regex scop name match.
Siddharth Bhat [Mon, 24 Jul 2017 12:40:52 +0000 (12:40 +0000)]
[Polly] [NFC] [ScopDetection] Make `polly-only-func` perform regex scop name match.

Summary:

- We were using `.count` in `StringRef`, which matches substrings.
- We may want to use this for equality as well.
- Generalise this, so allow regexes as a parameter to `polly-only-func`.

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

llvm-svn: 308875

7 years ago[ForwardOpTree] Fix mixup in comment. NFC.
Michael Kruse [Mon, 24 Jul 2017 12:39:46 +0000 (12:39 +0000)]
[ForwardOpTree] Fix mixup in comment. NFC.

The cases DoIt==false and DoIt==true were mixed up.

Thanks to Siddharth for noticing.

llvm-svn: 308874

7 years ago[ScopInfo] Fix typo in method name. NFC.
Michael Kruse [Mon, 24 Jul 2017 12:39:41 +0000 (12:39 +0000)]
[ScopInfo] Fix typo in method name. NFC.

prependInstrunction -> prependInstruction

Thanks Nandini for noticing.

llvm-svn: 308873

7 years ago[LoopInterchange] Update code to use range-based for loops (NFC).
Florian Hahn [Mon, 24 Jul 2017 11:41:30 +0000 (11:41 +0000)]
[LoopInterchange] Update code to use range-based for loops (NFC).

Summary:
The remaining non range-based for loops do not iterate over full ranges,
so leave them as they are.

Reviewers: karthikthecool, blitz.opensource, mcrosier, mkuper, aemerson

Reviewed By: aemerson

Subscribers: aemerson, mzolotukhin, llvm-commits

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

llvm-svn: 308872

7 years ago[libunwind] Handle .ARM.exidx tables without sentinel last entry
Momchil Velikov [Mon, 24 Jul 2017 09:19:32 +0000 (09:19 +0000)]
[libunwind] Handle .ARM.exidx tables without sentinel last entry

UnwindCursor<A, R>::getInfoFromEHABISection assumes the last
entry in the index table never corresponds to a real function.
Indeed, GNU ld always inserts an EXIDX_CANTUNWIND entry,
containing the end of the .text section. However, the EHABI specification
(http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf)
does not seem to contain text that requires the presence of a sentinel entry.
In that sense the libunwind implementation isn't compliant with the specification.

This patch makes getInfoFromEHABISection examine the last entry in the index
table if upper_bound returns the end iterator.

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

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

llvm-svn: 308871

7 years agoConvert GPUNodeBuilder::getArraySize to islcpp.
Siddharth Bhat [Mon, 24 Jul 2017 09:08:21 +0000 (09:08 +0000)]
Convert GPUNodeBuilder::getArraySize to islcpp.

Note: PPCGCodeGeneration::pollyBuildAstExprForStmt is at
      https://reviews.llvm.org/D35770

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

llvm-svn: 308870

7 years ago[NFC] Move PPCGCodeGeneration::pollyBuildAstExprForStmt to isl++.
Siddharth Bhat [Mon, 24 Jul 2017 08:34:24 +0000 (08:34 +0000)]
[NFC] Move PPCGCodeGeneration::pollyBuildAstExprForStmt to isl++.

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

llvm-svn: 308869

7 years ago[X86][AVX512] Add patterns for masked AVX512 floating point compare instructions...
Ayman Musa [Mon, 24 Jul 2017 08:10:32 +0000 (08:10 +0000)]
[X86][AVX512] Add patterns for masked AVX512 floating point compare instructions that were missing.

patterns were missed by D33188. Adding for completion.
+Updating test.

Differential Revesion: https://reviews.llvm.org/D35179

llvm-svn: 308868

7 years ago[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two...
Coby Tayree [Mon, 24 Jul 2017 07:06:37 +0000 (07:06 +0000)]
[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides

On MS-style, the following snippet:

int eax;
__asm mov eax, ebx

should yield loading of ebx, into the location pointed by the variable eax

This patch sees to it.

Currently, a reg-to-reg move would have been invoked.

llvm: D34739

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

llvm-svn: 308867

7 years ago[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two...
Coby Tayree [Mon, 24 Jul 2017 07:04:55 +0000 (07:04 +0000)]
[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides

On MS-style, the following snippet:

int eax;
__asm mov eax, ebx

should yield loading of ebx, into the location pointed by the variable eax

This patch sees to it.

Currently, a reg-to-reg move would have been invoked.

clang: D34740

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

llvm-svn: 308866

7 years ago[AVR] Remove the instrumentation pass
Dylan McKay [Sun, 23 Jul 2017 23:39:11 +0000 (23:39 +0000)]
[AVR] Remove the instrumentation pass

I have a much better way of running integration tests now.

https://github.com/dylanmckay/avr-test-suite

llvm-svn: 308857

7 years ago[AVR] Improve the 'icall-func-pointer-correct-addr-space.ll' test
Dylan McKay [Sun, 23 Jul 2017 23:00:55 +0000 (23:00 +0000)]
[AVR] Improve the 'icall-func-pointer-correct-addr-space.ll' test

Patch by Carl Peto.

llvm-svn: 308856

7 years ago[Driver] Fuchsia defaults to -fno-math-errno
Petr Hosek [Sun, 23 Jul 2017 22:30:13 +0000 (22:30 +0000)]
[Driver] Fuchsia defaults to -fno-math-errno

Patch by Roland McGrath

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

llvm-svn: 308855

7 years ago[CodeGen][X86] Fuchsia supports sincos* libcalls and sin+cos->sincos optimization
Petr Hosek [Sun, 23 Jul 2017 22:30:00 +0000 (22:30 +0000)]
[CodeGen][X86] Fuchsia supports sincos* libcalls and sin+cos->sincos optimization

Patch by Roland McGrath

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

llvm-svn: 308854

7 years agoFix typo: GETTER to SETTER (NFC)
Momchil Velikov [Sun, 23 Jul 2017 22:27:34 +0000 (22:27 +0000)]
Fix typo: GETTER to SETTER (NFC)

Use the CALLSITE_DELEGATE_SETTER macro in CallSiteBase::setCannotDuplicate.
Comitted as obvious.

llvm-svn: 308853

7 years ago[AArch64] Add test for function alignment for a optsize function (NFC).
Florian Hahn [Sun, 23 Jul 2017 21:15:10 +0000 (21:15 +0000)]
[AArch64] Add test for function alignment for a optsize function (NFC).

Reviewers: dblaikie, t.p.northover, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 308852

7 years agoRevert "Fix PR33875 by distinguishing between DWO and clang modules"
Adrian Prantl [Sun, 23 Jul 2017 20:24:41 +0000 (20:24 +0000)]
Revert "Fix PR33875 by distinguishing between DWO and clang modules"

This reverts commit r308850.

llvm-svn: 308851

7 years agoFix PR33875 by distinguishing between DWO and clang modules
Adrian Prantl [Sun, 23 Jul 2017 17:59:07 +0000 (17:59 +0000)]
Fix PR33875 by distinguishing between DWO and clang modules

The DWO handling code can get confused by clang modules which also use
skeleton CUs to point to the object file with the full debug
info. This patch detects whether an object is a "real" DWO or a clang
module and prevents LLDB from interpreting clang modules as DWO. This
fixes the regression in TestWithModuleDebugging.

http://llvm.org/bugs/show_bug.cgi?id=33875

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

llvm-svn: 308850

7 years ago[AArch64] Redundant Copy Elimination - remove more zero copies.
Chad Rosier [Sun, 23 Jul 2017 16:38:08 +0000 (16:38 +0000)]
[AArch64] Redundant Copy Elimination - remove more zero copies.

This patch removes unnecessary zero copies in BBs that are targets of b.eq/b.ne
and we know the result of the compare instruction is zero.  For example,

BB#0:
  subs w0, w1, w2
  str w0, [x1]
  b.ne .LBB0_2
BB#1:
  mov w0, wzr  ; <-- redundant
  str w0, [x2]
.LBB0_2

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

llvm-svn: 308849

7 years agoRemove Driver::UseStdLib.
Nico Weber [Sun, 23 Jul 2017 16:31:47 +0000 (16:31 +0000)]
Remove Driver::UseStdLib.

All but one place are checking options::OPT_nostdlib instead of looking at
this field, so convert that one other place to doing that as well.

No behavior change.

llvm-svn: 308848

7 years ago[SCEV] Limit max size of AddRecExpr during evolving
Max Kazantsev [Sun, 23 Jul 2017 15:40:19 +0000 (15:40 +0000)]
[SCEV] Limit max size of AddRecExpr during evolving

When SCEV calculates product of two SCEVAddRecs from the same loop, it
tries to combine them into one big AddRecExpr. If the sizes of the initial
SCEVs were `S1` and `S2`, the size of their product is `S1 + S2 - 1`, and every
operand of the resulting SCEV is combined from operands of initial SCEV and
has much higher complexity than they have.

As result, if we try to calculate something like:
  %x1 = {a,+,b}
  %x2 = mul i32 %x1, %x1
  %x3 = mul i32 %x2, %x1
  %x4 = mul i32 %x3, %x2
  ...
The size of such SCEVs grows as `2^N`, and the arguments
become more and more complex as we go forth. This leads
to long compilation and huge memory consumption.

This patch sets a limit after which we don't try to combine two
`SCEVAddRecExpr`s into one. By default, max allowed size of the
resulting AddRecExpr is set to 16.

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

llvm-svn: 308847

7 years agoRuntimeDyldELF.cpp: Prune unused "TargetRegistry.h"
NAKAMURA Takumi [Sun, 23 Jul 2017 11:47:22 +0000 (11:47 +0000)]
RuntimeDyldELF.cpp: Prune unused "TargetRegistry.h"

llvm-svn: 308846

7 years agoSimplify: Adopt for translation of MemoryAccess::getAccessRelation
Tobias Grosser [Sun, 23 Jul 2017 08:15:28 +0000 (08:15 +0000)]
Simplify: Adopt for translation of MemoryAccess::getAccessRelation

For some reason this one was missed earlier.

llvm-svn: 308845

7 years ago[Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.
NAKAMURA Takumi [Sun, 23 Jul 2017 05:09:44 +0000 (05:09 +0000)]
[Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.

This gets rid of almost LLVM targets unconditionally depending on intrinsic_gen.

Clang's modules still have weird dependencies and hard to remove intrinsics_gen in better way.
Then, it'd be better to give whole clang targets depend on intrinsic_gen.

llvm-svn: 308844

7 years agoMove MemoryAccess::get*ArrayId to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:59 +0000 (04:08 +0000)]
Move MemoryAccess::get*ArrayId to isl++

llvm-svn: 308843

7 years agoMove applyScheduleToAccessRelation to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:52 +0000 (04:08 +0000)]
Move applyScheduleToAccessRelation to isl++

llvm-svn: 308842

7 years agoMove MemoryAccess::getAddressFunction to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:45 +0000 (04:08 +0000)]
Move MemoryAccess::getAddressFunction to isl++

llvm-svn: 308841

7 years agoMove MemoryAccess::NewAccessRelation to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:38 +0000 (04:08 +0000)]
Move MemoryAccess::NewAccessRelation to isl++

We also move related accessor functions

llvm-svn: 308840

7 years agoMove MemoryAccess::getOriginalAccessRelation to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:27 +0000 (04:08 +0000)]
Move MemoryAccess::getOriginalAccessRelation to isl++

llvm-svn: 308839

7 years agoMove MemoryAccess::AccessRelation to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:22 +0000 (04:08 +0000)]
Move MemoryAccess::AccessRelation to isl++

llvm-svn: 308838

7 years agoMove MemoryAccess::createBasicAccessMap to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:17 +0000 (04:08 +0000)]
Move MemoryAccess::createBasicAccessMap to isl++

llvm-svn: 308837

7 years agoMove MemoryAccess::id to isl++
Tobias Grosser [Sun, 23 Jul 2017 04:08:11 +0000 (04:08 +0000)]
Move MemoryAccess::id to isl++

llvm-svn: 308836

7 years ago[X86] Add some hasSideEffects=0 flags.
Craig Topper [Sun, 23 Jul 2017 03:59:39 +0000 (03:59 +0000)]
[X86] Add some hasSideEffects=0 flags.

llvm-svn: 308835

7 years ago[X86] Add patterns for memory forms of SARX/SHLX/SHRX with careful complexity adjustm...
Craig Topper [Sun, 23 Jul 2017 03:59:37 +0000 (03:59 +0000)]
[X86] Add patterns for memory forms of SARX/SHLX/SHRX with careful complexity adjustment to keep shift by immediate using the legacy instructions.

These patterns were only missing to favor using the legacy instructions when the shift was a constant. With careful adjustment of the pattern complexity we can make sure the immediate instructions still have priority over these patterns.

llvm-svn: 308834

7 years ago[DAG] Fix typo preventing some stores merges to truncated stores.
Nirav Dave [Sun, 23 Jul 2017 02:06:28 +0000 (02:06 +0000)]
[DAG] Fix typo preventing some stores merges to truncated stores.

Check the actual memory type stored and not the extended value size
when considering if truncated store merge is worthwhile.

Reviewers: efriedma, RKSimon, spatel, jyknight

Reviewed By: efriedma

Subscribers: llvm-commits, nhaehnle

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

llvm-svn: 308833

7 years agoclang/module.modulemap: Split out Clang_ToolingCore from Clang_Tooling.
NAKAMURA Takumi [Sun, 23 Jul 2017 01:40:36 +0000 (01:40 +0000)]
clang/module.modulemap: Split out Clang_ToolingCore from Clang_Tooling.

It cuts clangFormat's dependencies out of;

  Clang_Analysis
  Clang_C
  Clang_Diagnostics
  Clang_Driver
  Clang_Frontend
  Clang_Sema
  Clang_Serialization
  Clang_StaticAnalyzer_Core
  Clang_Tooling -> Clang_ToolingCore

Now, the module Clang_Format depends on;

  Clang_AST
  Clang_Basic
  Clang_ToolingCore

llvm-svn: 308832

7 years ago[Simplify] Remove partial write accesses with empty domain.
Michael Kruse [Sat, 22 Jul 2017 20:33:09 +0000 (20:33 +0000)]
[Simplify] Remove partial write accesses with empty domain.

If the access relation's domain is empty, the access will never be
executed. We can just remove it.

We only remove write accesses. Partial read accesses are not yet
supported and instructions in the statement might require the
llvm::Value holding the read's result to be defined.

llvm-svn: 308830

7 years ago[ScopInfo] Adapt indentation of instruction list printing.
Michael Kruse [Sat, 22 Jul 2017 16:44:39 +0000 (16:44 +0000)]
[ScopInfo] Adapt indentation of instruction list printing.

Change the indention of the last brace to align with the opening line.

Before:

            Instructions {
                  %val = fadd double %arg, 2.100000e+01
                  store double %val, double* %A
                }

After:

            Instructions {
                  %val = fadd double %arg, 2.100000e+01
                  store double %val, double* %A
            }

llvm-svn: 308828

7 years agoFix grammar-o in comment.
Nico Weber [Sat, 22 Jul 2017 15:16:42 +0000 (15:16 +0000)]
Fix grammar-o in comment.

llvm-svn: 308827

7 years ago[ForwardOpTree] Support hoisted invariant loads.
Michael Kruse [Sat, 22 Jul 2017 14:30:02 +0000 (14:30 +0000)]
[ForwardOpTree] Support hoisted invariant loads.

Hoisted loads can be trivially supported because there are no
MemoryAccess to be modified, the loaded value is just available
at code generation.

llvm-svn: 308826

7 years ago[ForwardOpTree] Introduce the -polly-optree pass.
Michael Kruse [Sat, 22 Jul 2017 14:02:47 +0000 (14:02 +0000)]
[ForwardOpTree] Introduce the -polly-optree pass.

This pass 'forwards' operand trees into statements that use them in
order to avoid scalar dependencies.

This minimal implementation handles only the case of speculatable
instructions. We will successively add support for:
- Hoisted loads
- Read-only values
- Synthesizable values
- Loads
- PHIs
- Forwarding only parts of the tree

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

llvm-svn: 308825

7 years ago[Bash-autocompletion] Fixed typo and add '-' after -Wno
Yuka Takahashi [Sat, 22 Jul 2017 12:35:15 +0000 (12:35 +0000)]
[Bash-autocompletion] Fixed typo and add '-' after -Wno

Summary: -Wno-<warning> was autocompleted as -Wno<warning>, so fixed this typo.

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

llvm-svn: 308824

7 years ago[NFC, documentation] Prefer the term expansion instead of macro instantiation
Faisal Vali [Sat, 22 Jul 2017 12:04:37 +0000 (12:04 +0000)]
[NFC, documentation] Prefer the term expansion instead of macro instantiation

... in the few remaining places where this was not corrected.

llvm-svn: 308823

7 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Sat, 22 Jul 2017 02:43:50 +0000 (02:43 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This reverts commit 2b52298eb28ba4d3eca113353a348c02a6ef1f93.

llvm-svn: 308822

7 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Sat, 22 Jul 2017 02:33:45 +0000 (02:33 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

llvm-svn: 308821

7 years ago[sanitizer_common] Move filesystem-related code out of sanitizer_common.cc
Vitaly Buka [Sat, 22 Jul 2017 01:46:40 +0000 (01:46 +0000)]
[sanitizer_common] Move filesystem-related code out of sanitizer_common.cc

Summary:
This is a pure refactoring change.  It just moves code that is
related to filesystem operations from sanitizer_common.{cc,h} to
sanitizer_file.{cc,h}.  This makes it cleaner to disable the
filesystem-related code for a new port that doesn't want it.

Submitted on behalf of Roland McGrath.

Reviewers: kcc, eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: vitalybuka, llvm-commits, kubamracek, mgorny, phosek

Tags: #sanitizers

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

llvm-svn: 308819

7 years ago[X86] Add nopq instruction which is a rex encoded version of nopl for gas compatibility.
Craig Topper [Sat, 22 Jul 2017 01:30:53 +0000 (01:30 +0000)]
[X86] Add nopq instruction which is a rex encoded version of nopl for gas compatibility.

llvm-svn: 308818

7 years ago[X86] Add register form of NOPL and NOPW for assembler/disassembler.
Craig Topper [Sat, 22 Jul 2017 01:30:51 +0000 (01:30 +0000)]
[X86] Add register form of NOPL and NOPW for assembler/disassembler.

Fixes PR32805.

llvm-svn: 308817

7 years agoAMDGPU: Remove leftover td file
Matt Arsenault [Sat, 22 Jul 2017 00:40:46 +0000 (00:40 +0000)]
AMDGPU: Remove leftover td file

All of the instructions were moved out of this a while ago,
so it's just a useless comment now.

llvm-svn: 308815

7 years agoCommit missing/empty test file from r308789
David Blaikie [Sat, 22 Jul 2017 00:24:20 +0000 (00:24 +0000)]
Commit missing/empty test file from r308789

llvm-svn: 308814