platform/upstream/llvm.git
8 years ago[ELF] - Linkerscript: support complex section pattern grammar.
George Rimar [Wed, 21 Sep 2016 15:56:44 +0000 (15:56 +0000)]
[ELF] - Linkerscript: support complex section pattern grammar.

This is PR30442.
Previously we were failed to parce complex expressions like:
foo : { *(SORT_BY_NAME(bar) zed) }

Main idea of patch that globs and excludes can be wrapped in a SORT.
There is a difference in semanics of ld/gold:
ld likes:
*(SORT(EXCLUDE_FILE (*file1.o) .foo.1))

gold likes:
*(EXCLUDE_FILE (*file1.o) SORT(.foo.1))

Patch implements ld grammar, complex expressions like
next is not a problem anymore:
.abc : { *(SORT(.foo.* EXCLUDE_FILE (*file1.o) .bar.*) .bar.*) }

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

llvm-svn: 282078

8 years agoRevert r281895 "Add @llvm.dbg.value entries for the phi node created by -mem2reg"
Hans Wennborg [Wed, 21 Sep 2016 15:55:53 +0000 (15:55 +0000)]
Revert r281895 "Add @llvm.dbg.value entries for the phi node created by -mem2reg"

(And follow-up r281964.)

It caused PR30468.

llvm-svn: 282077

8 years agoRevert r281715, it caused PR30475
Nico Weber [Wed, 21 Sep 2016 15:33:24 +0000 (15:33 +0000)]
Revert r281715, it caused PR30475

llvm-svn: 282076

8 years agoDeadArgElim: Don't mark swifterror arguments as unused
Arnold Schwaighofer [Wed, 21 Sep 2016 15:29:08 +0000 (15:29 +0000)]
DeadArgElim: Don't mark swifterror arguments as unused

Replacing swifterror arguments with undef creates invalid IR.

rdar://28300490

llvm-svn: 282075

8 years agoFix compiler warnings.
Haojian Wu [Wed, 21 Sep 2016 15:19:04 +0000 (15:19 +0000)]
Fix compiler warnings.

llvm-svn: 282074

8 years ago[change-namespace] fix name qualifiers in UsingShadowDecl and NestedNameSpecifier.
Eric Liu [Wed, 21 Sep 2016 15:06:12 +0000 (15:06 +0000)]
[change-namespace] fix name qualifiers in UsingShadowDecl and NestedNameSpecifier.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 282073

8 years agoRefactor NativeRegisterContextLinux_x86_64 code.
Valentina Giusti [Wed, 21 Sep 2016 13:33:01 +0000 (13:33 +0000)]
Refactor NativeRegisterContextLinux_x86_64 code.

This patch refactors the way the XState type is checked and, in order to
simplify the code, it removes the usage of the 'cpuid' instruction: just checking
if the ptrace calls done throuhg ReadFPR is enough to verify both if there is
HW support and if there is kernel support. Also the XCR0 bits are enough to check if
there is both HW and kernel support for AVX and MPX.

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

llvm-svn: 282072

8 years ago[LoopInterchange] Various cleanup. NFC.
Chad Rosier [Wed, 21 Sep 2016 13:28:41 +0000 (13:28 +0000)]
[LoopInterchange] Various cleanup. NFC.

llvm-svn: 282071

8 years ago[clang-move] A prototype tool for moving class definition to new file.
Haojian Wu [Wed, 21 Sep 2016 13:18:19 +0000 (13:18 +0000)]
[clang-move] A prototype tool for moving class definition to new file.

Summary:
This patch introduces a new tool which moves a specific class definition
from files (.h, .cc) to new files (.h, .cc), which mostly acts like
"Extract class defintion". In the long term, this tool should be
merged in to clang-refactoring as a subtool.

clang-move not only moves class definition, but also moves all the
forward declarations, functions defined in anonymous namespace and #include
headers to new files, to make sure the new files are compliable as much
as possible.

To move `Foo` from old.[h/cc] to new.[h/cc], use:

```
clang-move -name=Foo -old_header=old.h -old_cc=old.cc -new_header=new.h
-new_cc=new.cc old.cc
```

To move `Foo` from old.h to new.h, use:

```
clang-move -name=Foo -old_header=old.h -new_header=new.h old.cc
```

Reviewers: klimek, djasper, ioeric

Subscribers: mgorny, beanz, Eugene.Zelenko, bkramer, omtcyfz, cfe-commits

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

llvm-svn: 282070

8 years agoGlobalISel: produce correct code for signext/zeroext ABI flags.
Tim Northover [Wed, 21 Sep 2016 12:57:45 +0000 (12:57 +0000)]
GlobalISel: produce correct code for signext/zeroext ABI flags.

We still don't really have an equivalent of "AssertXExt" in DAG, so we don't
exploit the guarantees on the receiving side yet, but this should produce
conservatively correct code on iOS ABIs.

llvm-svn: 282069

8 years agoGlobalISel: pass Function to lowerFormalArguments directly (NFC).
Tim Northover [Wed, 21 Sep 2016 12:57:35 +0000 (12:57 +0000)]
GlobalISel: pass Function to lowerFormalArguments directly (NFC).

The only implementation that exists immediately looks it up anyway, and the
information is needed to handle various parameter attributes (stored on the
function itself).

llvm-svn: 282068

8 years agoLinker script: Fix bug with several .bss
Eugene Leviant [Wed, 21 Sep 2016 11:29:28 +0000 (11:29 +0000)]
Linker script: Fix bug with several .bss

When final image has several .bss sections, lld fails
because second .bss always has zero VA. This causes
link error "Not enough space for ELF and program headers"

llvm-svn: 282067

8 years agoRemove an invalid doxygen `@return` docstring on a void function
Luke Drummond [Wed, 21 Sep 2016 11:12:50 +0000 (11:12 +0000)]
Remove an invalid doxygen `@return` docstring on a void function

`ClangASTSource::FindExternalVisibleDecls` has void return type, so the
previous docstring was misleading.

llvm-svn: 282066

8 years ago[AMDGPU] Assembler: remove unused AMDGPUMCObjectWriter.
Sam Kolton [Wed, 21 Sep 2016 10:33:32 +0000 (10:33 +0000)]
[AMDGPU] Assembler: remove unused AMDGPUMCObjectWriter.

Summary: It is replaced by AMDGPUELFObjectWriter

Reviewers: tstellarAMD, vpykhtin, artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl

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

llvm-svn: 282065

8 years agoRevert "[sanitizers] Update sanitizers test to better match glibc internals"
Diana Picus [Wed, 21 Sep 2016 10:06:37 +0000 (10:06 +0000)]
Revert "[sanitizers] Update sanitizers test to better match glibc internals"

This reverts commit r282061 because it broke the clang-cuda-build bot.

llvm-svn: 282064

8 years ago[mips] LLVM PR/30197 - Tail call incorrectly clobbers arguments for mips
Simon Dardis [Wed, 21 Sep 2016 09:43:40 +0000 (09:43 +0000)]
[mips] LLVM PR/30197 - Tail call incorrectly clobbers arguments for mips

The postRA scheduler performs alias analysis to determine if stores and loads
can moved past each other. When a function has more arguments than argument
registers for the calling convention used, excess arguments are spilled onto the
stack. LLVM by default assumes that argument slots are immutable, unless the
function contains a tail call. Without the knowledge of that a function contains
a tail call site, stores and loads to fixed stack slots may be re-ordered
causing the out-going arguments to clobber the incoming arguments before the
incoming arguments are supposed to be dead.

Reviewers: vkalintiris

Differential Review: https://reviews.llvm.org/D24077

llvm-svn: 282063

8 years ago[libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)
Asiri Rathnayake [Wed, 21 Sep 2016 09:09:32 +0000 (09:09 +0000)]
[libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)

Align the naming / use of the macro LIBCXXABI_HAS_NO_THREADS to follow what we
have in libcxx. NFC.

llvm-svn: 282062

8 years ago[sanitizers] Update sanitizers test to better match glibc internals
Diana Picus [Wed, 21 Sep 2016 08:56:14 +0000 (08:56 +0000)]
[sanitizers] Update sanitizers test to better match glibc internals

One of the tests relying on sem_t's layout gets the wrong value for versions of
glibc newer than 2.21 on platforms that don't have 64-bit atomics (e.g. ARM).

This commit fixes the test to work with:
* versions of glibc >= 2.21 on platforms with 64-bit atomics: unchanged
* versions of glibc >= 2.21 on platforms without 64-bit atomics: the semaphore
value is shifted by SEM_VALUE_SHIFT (which is set to 1 in glibc's internal
headers)
* versions of glibc < 2.21: unchanged

See the glibc 2.23 sources:
* sysdeps/nptl/internaltypes.h (struct new_sem for glibc >= 2.21 and
                                struct old_sem for glibc < 2.21)
* nptl/sem_getvalue.c

This was uncovered on one of the new buildbots that we are trying to move to
production.

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

llvm-svn: 282061

8 years ago[ELF] - Linkerscript: reimplement readSectionExcludes()
George Rimar [Wed, 21 Sep 2016 08:53:21 +0000 (08:53 +0000)]
[ELF] - Linkerscript: reimplement readSectionExcludes()

It is not only a bit more straightforward now, but also next 2 issues are solved:

* It just crashed on ".foo : { *(EXCLUDE_FILE (*file1.o)) }" before.
* It accepted multiple EXCLUDE_FILEs in a row.

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

llvm-svn: 282060

8 years agoPR30401: Fix substitutions for functions with abi_tag
Dmitry Polukhin [Wed, 21 Sep 2016 08:27:03 +0000 (08:27 +0000)]
PR30401: Fix substitutions for functions with abi_tag

llvm-svn: 282059

8 years agoRevert "AArch64: Set shift bit of TLSLE HI12 add instruction"
Diana Picus [Wed, 21 Sep 2016 08:24:41 +0000 (08:24 +0000)]
Revert "AArch64: Set shift bit of TLSLE HI12 add instruction"

This reverts commit r282057 because it broke the buildbots - see e.g.
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12063

llvm-svn: 282058

8 years agoAArch64: Set shift bit of TLSLE HI12 add instruction
Lei Liu [Wed, 21 Sep 2016 07:41:41 +0000 (07:41 +0000)]
AArch64: Set shift bit of TLSLE HI12 add instruction

Summary: AArch64 LLVM assembler emits add instruction without shift bit to calculate the higher 12-bit address of TLS variables in local exec model.  This generates wrong code sequence to access TLS variables with thread offset larger than 0x1000.

Reviewers: t.p.northover, peter.smith, rovka

Subscribers: salim.nasser, aemerson, llvm-commits, rengolin

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

llvm-svn: 282057

8 years agoclang-format: [JS] do not wrapp @returns tags.
Martin Probst [Wed, 21 Sep 2016 06:56:38 +0000 (06:56 +0000)]
clang-format: [JS] do not wrapp @returns tags.

Summary: @returns is incorrect code, the standard is @return. However wrapping it can still confuse users.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 282056

8 years ago[AVX-512] Split the 3 different usages of the X86ISD::FSETCC opcode into 3 different...
Craig Topper [Wed, 21 Sep 2016 06:37:54 +0000 (06:37 +0000)]
[AVX-512] Split the 3 different usages of the X86ISD::FSETCC opcode into 3 different opcodes.

It turns out isel is really not robust against having different type profiles for the same opcode. It turns out that if you put an illegal rounding mode(i.e. not CUR_DIRECTION or NO_EXC) on a comiss intrinsic we would generate the FSETCC form with the rounding mode added, but then pattern match to an instruction with ROUND_CUR_DIRECTION.

We can probably get away with just one FSETCCM opcode that always contains the rounding mode and explicitly put ROUND_CUR_DIRECTION in the pattern, but I'll leave that for future work.

With this change the clang tests for the comiss intrinsics that used an incorrect rounding mode of 3 properly fail isel instead of silently doing the wrong thing. Those clang tests will be fixed in a follow up commit and I also plan to add rounding mode checking to clang.

llvm-svn: 282055

8 years ago[CMake] Rename back SIMPLE_SOURCE to compile as C++
Jonas Hahnfeld [Wed, 21 Sep 2016 05:44:06 +0000 (05:44 +0000)]
[CMake] Rename back SIMPLE_SOURCE to compile as C++

This was changed in rL276151 and causes problems if the C++ compiler does not
support the same arches as the C compiler.
For the builtins, only the C compiler is tested in try_compile_only.

Additionally, -fno-exceptions is passed in (if available) to work around
the case where no libunwind is available.

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

llvm-svn: 282054

8 years agollvm/test/CodeGen/NVPTX/zero-cs.ll: Relax an expression to match in -Asserts.
NAKAMURA Takumi [Wed, 21 Sep 2016 04:43:11 +0000 (04:43 +0000)]
llvm/test/CodeGen/NVPTX/zero-cs.ll: Relax an expression to match in -Asserts.

  LLVM ERROR: Cannot select: 0x3607bf0: i32 = ExternalSymbol'__powidf2'

llvm-svn: 282053

8 years ago[AVX-512] Don't add an additional rounding mode operand to the avx512 vcvtps2ph intri...
Craig Topper [Wed, 21 Sep 2016 03:58:44 +0000 (03:58 +0000)]
[AVX-512] Don't add an additional rounding mode operand to the avx512 vcvtps2ph intrinsic lowering.

There was no way to control its value so it was always FROUND_CURRENT making it unnecessary. The true rounding mode is encoded in the immediate operand of the instruction.

This also removes the pattern from the rb form of the instructions since there is no way to specify the FROUND_NO_EXC rounding mode it required.

llvm-svn: 282052

8 years ago[AVX-512] Simplify handling of INTR_TYPE_1OP_MASK_RM to remove support for the second...
Craig Topper [Wed, 21 Sep 2016 03:58:41 +0000 (03:58 +0000)]
[AVX-512] Simplify handling of INTR_TYPE_1OP_MASK_RM to remove support for the second opcode since its never used. This makes it consistent with INTR_TYPE_2OP_MASK_RM and INTR_TYPE_3OP_MASK_RM.

And even if it was used we were passing the same operands to both so it wouldn't make sense to have two opcodes.

llvm-svn: 282051

8 years ago[libFuzzer] fix libc++ build
Kostya Serebryany [Wed, 21 Sep 2016 03:50:37 +0000 (03:50 +0000)]
[libFuzzer] fix libc++ build

llvm-svn: 282050

8 years agoAccept sh_entsize = 0.
Rui Ueyama [Wed, 21 Sep 2016 03:22:18 +0000 (03:22 +0000)]
Accept sh_entsize = 0.

This surfaced again with Rust. As per bug 30435, rustc creates a
mergeable section with a sh_entsize zero. It bit us before, too.
I think we should relax the input check rather than being too picky.

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

llvm-svn: 282049

8 years ago[LV] When reporting about a specific instruction without debug location use loop's
Adam Nemet [Wed, 21 Sep 2016 03:14:20 +0000 (03:14 +0000)]
[LV] When reporting about a specific instruction without debug location use loop's

This can occur for example if some optimization drops the debug location.

llvm-svn: 282048

8 years ago[libFuzzer] more refactoring; NFC
Kostya Serebryany [Wed, 21 Sep 2016 02:05:39 +0000 (02:05 +0000)]
[libFuzzer] more refactoring; NFC

llvm-svn: 282047

8 years ago[AVX-512] Don't lower avx512 vcvtps2ph/vcvtph2ps nodes to ISD::FP16_TO_FP/ISD::FP_TO_...
Craig Topper [Wed, 21 Sep 2016 02:05:22 +0000 (02:05 +0000)]
[AVX-512] Don't lower avx512 vcvtps2ph/vcvtph2ps nodes to ISD::FP16_TO_FP/ISD::FP_TO_FP16 with an extra x86 specific rounding mode operand. We should use a target specific ISD opcode.

llvm-svn: 282046

8 years ago[NVPTX] Check if callsite is defined when computing argument allignment
Jacques Pienaar [Wed, 21 Sep 2016 01:57:57 +0000 (01:57 +0000)]
[NVPTX] Check if callsite is defined when computing argument allignment

Summary: In getArgumentAlignment check if the ImmutableCallSite pointer CS is non-null before dereferencing. If CS is 0x0 fall back to the ABI type alignment else compute the alignment as before.

Reviewers: eliben, jpienaar

Subscribers: jlebar, vchuravy, cfe-commits, jholewinski

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

llvm-svn: 282045

8 years ago[libFuzzer] refactoring: split the large header into many; NFC
Kostya Serebryany [Wed, 21 Sep 2016 01:50:50 +0000 (01:50 +0000)]
[libFuzzer] refactoring: split the large header into many; NFC

llvm-svn: 282044

8 years agoAdds tests for breakpoint names, and a FindBreakpointsByName.
Jim Ingham [Wed, 21 Sep 2016 01:21:19 +0000 (01:21 +0000)]
Adds tests for breakpoint names, and a FindBreakpointsByName.

Also if you set a breakpoint with an invalid name, we'll
refuse to set the breakpoint rather than silently ignoring
the name.

llvm-svn: 282043

8 years ago[libFuzzer] refactoring: move the Corpus into a separate class; delete two unused...
Kostya Serebryany [Wed, 21 Sep 2016 01:04:43 +0000 (01:04 +0000)]
[libFuzzer] refactoring: move the Corpus into a separate class; delete two unused experimental features

llvm-svn: 282042

8 years agoFix Clang initialization and Clang-tidy modernize-use-nullptr warnings in source...
Eugene Zelenko [Wed, 21 Sep 2016 00:59:22 +0000 (00:59 +0000)]
Fix Clang initialization and Clang-tidy modernize-use-nullptr warnings in source/Plugins/Process/Utility.

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

llvm-svn: 282041

8 years agoRevert "TableGen: Switch from a std::map to a DenseMap in CodeGenSubRegIndex. NFC"
Justin Bogner [Wed, 21 Sep 2016 00:25:45 +0000 (00:25 +0000)]
Revert "TableGen: Switch from a std::map to a DenseMap in CodeGenSubRegIndex. NFC"

It turns out we iterate over this map a fair amount and the order
matters for clang to be deterministic. See:

  http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160919/391315.html

This reverts r279875.

llvm-svn: 282040

8 years ago[InferAttributes] Don't access parameters that don't exist.
Michael Kuperstein [Tue, 20 Sep 2016 23:10:31 +0000 (23:10 +0000)]
[InferAttributes] Don't access parameters that don't exist.

Check for the correct number of parameters before querying their type.
This fixes PR30455.

llvm-svn: 282038

8 years ago[ThinLTO] Always emit a summary when compiling in ThinLTO mode
Teresa Johnson [Tue, 20 Sep 2016 23:07:17 +0000 (23:07 +0000)]
[ThinLTO] Always emit a summary when compiling in ThinLTO mode

Summary:
Emit an empty summary section, instead of no summary section, when
there are no global variables in the index. This ensures that LTO
will treat these files as ThinLTO inputs, instead of as regular
LTO inputs.

In addition to not being what the user likely intended when
compiling with -flto=thin, the current behavior is problematic for
distributed build systems that expect to get ThinLTO index and imports
files back for each input compiled with -flto=thin. Combining into
a single regular LTO module also reduces the backend parallelism.
And in the case where the index was suppressed due to uses in
inline assembly, combining into a single LTO module could provoke
renaming of duplicates that we were trying to prevent by suppressing
the index.

This change required a couple of fixes to handle the empty summary
section.

Reviewers: mehdi_amini

Subscribers: mehdi_amini, llvm-commits, pcc

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

llvm-svn: 282037

8 years agoAdd some more tests for breakpoint serialization.
Jim Ingham [Tue, 20 Sep 2016 22:54:49 +0000 (22:54 +0000)]
Add some more tests for breakpoint serialization.

Serialize breakpoint names & the hardware_requested attributes.
Also added a few missing affordances to SBBreakpoint whose absence
writing the tests pointed out.

<rdar://problem/12611863>

llvm-svn: 282036

8 years agoRevert "Revert "Only restrict order if both sections are in the script.""
Rafael Espindola [Tue, 20 Sep 2016 22:43:15 +0000 (22:43 +0000)]
Revert "Revert "Only restrict order if both sections are in the script.""
This reverts commit r282021, bringing back r282015.

The problem was that the comparison function was not a strict weak
ordering anymore, which this patch fixes.

Original message:

Only restrict order if both sections are in the script.

This matches gold and bfd behavior and is required to handle some scripts.

The script has to assume where PT_LOADs start in order to align that
spot. If we don't allow section it doesn't know about to move to the
middle, we can need more PT_LOADs and those will not be aligned.

llvm-svn: 282035

8 years agocode cleanup -- commoning IR travsersals
Xinliang David Li [Tue, 20 Sep 2016 22:39:47 +0000 (22:39 +0000)]
code cleanup -- commoning IR travsersals

llvm-svn: 282034

8 years agoRevert "[CMake] Explicitly add --target option to compiler flags"
Chris Bieneman [Tue, 20 Sep 2016 22:29:22 +0000 (22:29 +0000)]
Revert "[CMake] Explicitly add --target option to compiler flags"

This reverts commit r282024.

This broke some bots, and I'm going to revert while I figure it out.

See: http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/21120
llvm-svn: 282033

8 years agoUnbreak the NetBSD build after recent changes
Kamil Rytarowski [Tue, 20 Sep 2016 22:26:29 +0000 (22:26 +0000)]
Unbreak the NetBSD build after recent changes

Similar to r281922 "Try to fix freebsd and android builds."

Replace .AppendArgument(cstr) with .AppendArgument(llvm::StringRef(cstr))

llvm-svn: 282032

8 years agoRemove the default subtarget from the x86 port as it isn't necessary (or
Eric Christopher [Tue, 20 Sep 2016 22:19:33 +0000 (22:19 +0000)]
Remove the default subtarget from the x86 port as it isn't necessary (or
correct) anymore.

llvm-svn: 282031

8 years ago[scudo] Fix a bug in the new Secondary Allocator
Kostya Kortchinsky [Tue, 20 Sep 2016 22:17:59 +0000 (22:17 +0000)]
[scudo] Fix a bug in the new Secondary Allocator

Summary:
GetActuallyAllocatedSize() was not accounting for the last page of the mapping
being a guard page, and was returning the wrong number of actually allocated
bytes, which in turn would mess up with the realloc logic. Current tests didn't
find this as the size exercised was only serviced by the Primary.

Correct the issue by subtracting PageSize, and update the realloc test to
exercise paths in both the Primary and the Secondary.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 282030

8 years agoEnable clang attributes when using clang-cl.
Zachary Turner [Tue, 20 Sep 2016 22:15:07 +0000 (22:15 +0000)]
Enable clang attributes when using clang-cl.

llvm-svn: 282029

8 years agoRevert "Remove extra argument used once on
Eric Christopher [Tue, 20 Sep 2016 22:03:28 +0000 (22:03 +0000)]
Revert "Remove extra argument used once on
TargetMachine::getNameWithPrefix and inline the result into the singular
caller." and "Remove more guts of TargetMachine::getNameWithPrefix and
migrate one check to the TLOF mach-o version." temporarily until I can
get the whole call migrated out of the TargetMachine as we could hit
places where TLOF isn't valid.

This reverts commits r281981 and r281983.

llvm-svn: 282028

8 years ago[CMake] Fix error preventing simulator sanitizers from building
Chris Bieneman [Tue, 20 Sep 2016 21:36:33 +0000 (21:36 +0000)]
[CMake] Fix error preventing simulator sanitizers from building

This should be checking for sim archs not target archs. This bug has
been around for a long time.

llvm-svn: 282025

8 years ago[CMake] Explicitly add --target option to compiler flags
Chris Bieneman [Tue, 20 Sep 2016 21:36:30 +0000 (21:36 +0000)]
[CMake] Explicitly add --target option to compiler flags

Summary:
Much of the non-Darwin build system assumes that COMPILER_RT_DEFAULT_TARGET_TRIPLE is the default target triple for the compiler being used. With clang as your compiler this isn't necessarily true.

To ensure that the rest of the build system behaves as expected this patch adds "--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" to the compiler flags for C, CXX and ASM sources.

Reviewers: compnerd, rengolin, fjricci

Subscribers: llvm-commits

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

llvm-svn: 282024

8 years ago[RS4GC] Refactor code for Rematerializing in presence of phi. NFC
Anna Thomas [Tue, 20 Sep 2016 21:36:02 +0000 (21:36 +0000)]
[RS4GC] Refactor code for Rematerializing in presence of phi. NFC

Summary:
This is an NFC refactoring change as a precursor to the actual fix for rematerializing in
presence of phi.
https://reviews.llvm.org/D24399

Pasted from review:
findRematerializableChainToBasePointer changed to return the root of the
chain. instead of true or false.
move the PHI matching logic into the caller by inspecting the root return value.
This includes an assertion that the alternate root is in the liveset for the
call.

Tested with current RS4GC tests.

Reviewers: reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 282023

8 years ago[CodeGen] stop short-circuiting the SSP code for sspstrong.
George Burgess IV [Tue, 20 Sep 2016 21:30:01 +0000 (21:30 +0000)]
[CodeGen] stop short-circuiting the SSP code for sspstrong.

This check caused us to skip adding layout information for calls to
alloca in sspreq/sspstrong mode. We check properly for sspstrong later
on (and add the correct layout info when doing so), so removing this
shouldn't hurt.

No test is included, since testing this using lit seems to require
checking for exact offsets in asm, which is something that the lit tests
for this avoid. If someone cares deeply, I'm happy to write a unittest
or something to cover this, but that feels like overkill.

Patch by Daniel Micay.

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

llvm-svn: 282022

8 years agoRevert "Only restrict order if both sections are in the script."
Rafael Espindola [Tue, 20 Sep 2016 21:28:19 +0000 (21:28 +0000)]
Revert "Only restrict order if both sections are in the script."

This reverts commit r282015. It broke some bots.

llvm-svn: 282021

8 years ago[llvm-cov] Demangle names for hidden instantiation views
Vedant Kumar [Tue, 20 Sep 2016 21:27:48 +0000 (21:27 +0000)]
[llvm-cov] Demangle names for hidden instantiation views

llvm-svn: 282020

8 years ago[asan] Add C++17 aligned new/delete entrypoints. Patch by Jakub Jelinek, see https...
Kostya Serebryany [Tue, 20 Sep 2016 21:27:10 +0000 (21:27 +0000)]
[asan] Add C++17 aligned new/delete entrypoints. Patch by Jakub Jelinek, see https://reviews.llvm.org/D24771

llvm-svn: 282019

8 years agoXFAIL cfi/stats.cpp on Windows until we fix LLD
Reid Kleckner [Tue, 20 Sep 2016 21:09:31 +0000 (21:09 +0000)]
XFAIL cfi/stats.cpp on Windows until we fix LLD

llvm-svn: 282018

8 years ago[Profile] dump ic value profile value/site-count histogram
Xinliang David Li [Tue, 20 Sep 2016 21:04:22 +0000 (21:04 +0000)]
[Profile] dump ic value profile value/site-count histogram

Differential Revision: http://reviews.google.com/D24783

llvm-svn: 282017

8 years agoOnly restrict order if both sections are in the script.
Rafael Espindola [Tue, 20 Sep 2016 20:54:39 +0000 (20:54 +0000)]
Only restrict order if both sections are in the script.

This matches gold and bfd behavior and is required to handle some scripts.

The script has to assume where PT_LOADs start in order to align that
spot. If we don't allow section it doesn't know about to move to the
middle, we can need more PT_LOADs and those will not be aligned.

llvm-svn: 282015

8 years agoMake test less dependent on the section order.
Rafael Espindola [Tue, 20 Sep 2016 20:48:54 +0000 (20:48 +0000)]
Make test less dependent on the section order.

This means either relaxing CHECKs or listing more sections and
addresses in linker scripts.

llvm-svn: 282014

8 years ago[PECOFF] Use the COFF subsystem field when determining the Triple.
Zachary Turner [Tue, 20 Sep 2016 20:44:50 +0000 (20:44 +0000)]
[PECOFF] Use the COFF subsystem field when determining the Triple.

Patch by walter erquinigo
Differential revision: https://reviews.llvm.org/D24284

llvm-svn: 282013

8 years ago[asan] Fix GlobalAddressDescription::Print()
Filipe Cabecinhas [Tue, 20 Sep 2016 20:33:18 +0000 (20:33 +0000)]
[asan] Fix GlobalAddressDescription::Print()

Summary: Check bug_type for nullptr before calling internal_strcmp

Reviewers: kcc, vitalybuka, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 282012

8 years ago[analyzer] Add a checker that detects blocks in critical sections
Anna Zaks [Tue, 20 Sep 2016 20:28:50 +0000 (20:28 +0000)]
[analyzer] Add a checker that detects blocks in critical sections

This checker should find the calls to blocking functions (for example: sleep, getc, fgets,read,recv etc.) inside a critical section. When sleep(x) is called while a mutex is held, other threads cannot lock the same mutex. This might take some time, leading to bad performance or even deadlock.

Example:

mutex_t m;

void f() {
  sleep(1000); // Error: sleep() while m is locked! [f() is called from foobar() while m is locked]
  // do some work
}

void foobar() {
  lock(m);
  f();
  unlock(m);
}

A patch by zdtorok (Zoltán Dániel Török)!

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

llvm-svn: 282011

8 years agoMark ELF sections whose name start with .note as note
Petr Hosek [Tue, 20 Sep 2016 20:21:13 +0000 (20:21 +0000)]
Mark ELF sections whose name start with .note as note

Previously, such section would be marked as SHT_PROGBITS which
makes it impossible to use an initialized C variable declaration
to emit an (allocated) ELF note. The new behavior is also consistent
with ELF assembly parser.

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

llvm-svn: 282010

8 years ago[Profile] Do not annotate select insts not covered in profile.
Xinliang David Li [Tue, 20 Sep 2016 20:20:01 +0000 (20:20 +0000)]
[Profile] Do not annotate select insts not covered in profile.

Fixed PR/30466

llvm-svn: 282009

8 years agoNext set of additional error checks for invalid Mach-O files for bad load commands
Kevin Enderby [Tue, 20 Sep 2016 20:14:14 +0000 (20:14 +0000)]
Next set of additional error checks for invalid Mach-O files for bad load commands
that use the Mach::dylib_command type for the load commands that are
currently used in the MachOObjectFile constructor.

This contains the missing checks for LC_ID_DYLIB, LC_ID_DYLIB, etc.
load commands and the fields for the Mach::dylib_command type.

Also checks that only an MH_DYLIB or MH_STUB_DYLIB has an
LC_ID_DYLIB load command (and others filetype don’t) and there
is not more than one of these load commands.

llvm-svn: 282008

8 years agoRemove some boilerplate comments that don't explain anything.
Eric Christopher [Tue, 20 Sep 2016 19:45:06 +0000 (19:45 +0000)]
Remove some boilerplate comments that don't explain anything.

llvm-svn: 282007

8 years agoSimplify SORT and --sort-section command line option handling.
Rui Ueyama [Tue, 20 Sep 2016 19:42:41 +0000 (19:42 +0000)]
Simplify SORT and --sort-section command line option handling.

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

llvm-svn: 282006

8 years ago[x86] split up tests, regenerate checks
Sanjay Patel [Tue, 20 Sep 2016 19:31:30 +0000 (19:31 +0000)]
[x86] split up tests, regenerate checks

Note that we fail to eliminate 'or' with 0!

llvm-svn: 282005

8 years agoFix a regex error breaking tests.
Zachary Turner [Tue, 20 Sep 2016 19:10:56 +0000 (19:10 +0000)]
Fix a regex error breaking tests.

llvm-svn: 282004

8 years ago[CMake] Support overriding CLANG_VERSION_*
Chris Bieneman [Tue, 20 Sep 2016 19:09:21 +0000 (19:09 +0000)]
[CMake] Support overriding CLANG_VERSION_*

As with how we handle LLVM_VERSION_* variables we should support
overriding clang version variables.

llvm-svn: 282003

8 years ago[Profile] code refactoring: make getStep a method in base class
Xinliang David Li [Tue, 20 Sep 2016 19:07:22 +0000 (19:07 +0000)]
[Profile] code refactoring: make getStep a method in base class

llvm-svn: 282002

8 years agoRevert part of "AArch64: Do not test for CPUs, use SubtargetFeatures"
Evandro Menezes [Tue, 20 Sep 2016 19:02:09 +0000 (19:02 +0000)]
Revert part of "AArch64: Do not test for CPUs, use SubtargetFeatures"

This reverts part of commit 119e358d9635c8d1f3e7aee67e3ea3b8a62f8db6 by
removing FeatureUseRSqrt et al per request by Eric Christopher
<echristo@gmail.com> (v. http://bit.ly/2cmz6kW).

llvm-svn: 282001

8 years agoRevert "[AArch64] Use the reciprocal estimation machinery"
Evandro Menezes [Tue, 20 Sep 2016 19:02:06 +0000 (19:02 +0000)]
Revert "[AArch64] Use the reciprocal estimation machinery"

This reverts commit b7d42b0048f65346e9fa37fb65defeea7ce8c337 per request by
Eric Christopher <echristo@gmail.com> (v. http://bit.ly/2cmz6kW).

llvm-svn: 282000

8 years agoRevert "[AArch64] Properly validate the reciprocal estimation."
Evandro Menezes [Tue, 20 Sep 2016 19:02:02 +0000 (19:02 +0000)]
Revert "[AArch64] Properly validate the reciprocal estimation."

This reverts commit ad8ca1528242e2a4cb363e3779309e70eb7a430e per request by
Eric Christopher <echristo@gmail.com> (v. http://bit.ly/2cmz6kW).

llvm-svn: 281999

8 years agoAdd some entropy to the folder name in Driver/warning-options.cpp.
Zachary Turner [Tue, 20 Sep 2016 18:41:19 +0000 (18:41 +0000)]
Add some entropy to the folder name in Driver/warning-options.cpp.

It was trying to check that things behave correctly when a
non-existant folder was specified for -isysroot.  Incidentally,
I have a folder named FOO in the root of my drive, so this test
was failing.  Make this impossible by using %T to refer to a
definitely non-existant folder.:

llvm-svn: 281998

8 years agoCodeGen: further merge cstring literal construction
Saleem Abdulrasool [Tue, 20 Sep 2016 18:38:54 +0000 (18:38 +0000)]
CodeGen: further merge cstring literal construction

Use the new CreateCStringLiteral in an additional site.  Now all the C string
literals are created in one function.  Furthermore, mark the additional literal
as an `unnamed_addr constant`.

llvm-svn: 281997

8 years agoFix typo in documentation.
Nick Lewycky [Tue, 20 Sep 2016 18:37:25 +0000 (18:37 +0000)]
Fix typo in documentation.

Since this is a header it will break links to this section.

llvm-svn: 281996

8 years ago[cleanup] Remove excessive padding from TextTokenRetokenizer::Position
Alexander Shaposhnikov [Tue, 20 Sep 2016 18:32:48 +0000 (18:32 +0000)]
[cleanup] Remove excessive padding from TextTokenRetokenizer::Position

Reorder the fields of the struct TextTokenRetokenizer::Position to remove excessive padding.
Test plan: make -j8 check-clang

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

llvm-svn: 281995

8 years agoASAN: Don't drop debug info attachements for global variables.
Adrian Prantl [Tue, 20 Sep 2016 18:28:42 +0000 (18:28 +0000)]
ASAN: Don't drop debug info attachements for global variables.
This is a follow-up to r281284. Global Variables now can have
!dbg attachements, so ASAN should clone these when generating a
sanitized copy of a global variable.

<rdar://problem/24899262>

llvm-svn: 281994

8 years agoMake it so that one can register prefix matches as well as identical matches as extra...
Enrico Granata [Tue, 20 Sep 2016 18:26:30 +0000 (18:26 +0000)]
Make it so that one can register prefix matches as well as identical matches as extra cases for NSDictionary data formatting

llvm-svn: 281993

8 years agotsan: revert r281970
Dmitry Vyukov [Tue, 20 Sep 2016 18:05:06 +0000 (18:05 +0000)]
tsan: revert r281970

r281970 extended the check in a useful way,
but caused (true) failures on aarch64.
Revert it for now.

llvm-svn: 281992

8 years agoFix syntactical nit from r281990.
Adrian McCarthy [Tue, 20 Sep 2016 17:42:13 +0000 (17:42 +0000)]
Fix syntactical nit from r281990.

llvm-svn: 281991

8 years agoEmit S_COMPILE3 CodeView record
Adrian McCarthy [Tue, 20 Sep 2016 17:20:51 +0000 (17:20 +0000)]
Emit S_COMPILE3 CodeView record

CodeView has an S_COMPILE3 record to identify the compiler and source language of the compiland.  This record comes first in the debug$S section for the compiland. The debuggers rely on this record to know the source language of the code.

There was a little test fallout from introducing a new record into the symbols subsection.

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

llvm-svn: 281990

8 years agoDon't produce an error for undefined entry symbol.
Rafael Espindola [Tue, 20 Sep 2016 17:14:16 +0000 (17:14 +0000)]
Don't produce an error for undefined entry symbol.

This is particularly important when the symbol comes from a linker
script. It is common to use the same linker script for shared
libraries and executables. Without this we would always fail to link
shared libraries with -z,defs and a linker script with an ENTRY
directive.

llvm-svn: 281989

8 years ago[docs] Extend the code coverage docs some more
Vedant Kumar [Tue, 20 Sep 2016 17:11:18 +0000 (17:11 +0000)]
[docs] Extend the code coverage docs some more

Flesh out the section on interpreting coverage reports, mention the
coverage export feature, and add notes on how to build llvm with
coverage turned on.

llvm-svn: 281988

8 years ago[ScopDetection] Remove redundant checks for endless loops
Tobias Grosser [Tue, 20 Sep 2016 17:05:22 +0000 (17:05 +0000)]
[ScopDetection] Remove redundant checks for endless loops

Summary:
Both `canUseISLTripCount()` and `addOverApproximatedRegion()` contained checks
to reject endless loops which are now removed and replaced by a single check
in `isValidLoop()`.

For reporting such loops the `ReportLoopOverlapWithNonAffineSubRegion` is
renamed to `ReportLoopHasNoExit`. The test case
`ReportLoopOverlapWithNonAffineSubRegion.ll` is adapted and renamed as well.

The schedule generation in `buildSchedule()` is based on the following
assumption:

Given some block B that is contained in a loop L and a SESE region R,
we assume that L is contained in R or the other way around.

However, this assumption is broken in the presence of endless loops that are
nested inside other loops. Therefore, in order to prevent erroneous behavior
in `buildSchedule()`, r265280 introduced a corresponding check in
`canUseISLTripCount()` to reject endless loops. Unfortunately, it was possible
to bypass this check with -polly-allow-nonaffine-loops which was fixed by adding
another check to reject endless loops in `allowOverApproximatedRegion()` in
r273905. Hence there existed two separate locations that handled this case.

Thank you Johannes Doerfert for helping to provide the above background
information.

Reviewers: Meinersbur, grosser

Subscribers: _jdoerfert, pollydev

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

Contributed-by: Matthias Reisinger <d412vv1n@gmail.com>
llvm-svn: 281987

8 years agoX86: loosen an overly aggressive MachO assertion
Saleem Abdulrasool [Tue, 20 Sep 2016 17:05:04 +0000 (17:05 +0000)]
X86: loosen an overly aggressive MachO assertion

We would assert that the FP setup CFI used esp/rsp always.  This held up in
practice when the code was generated from IR.  However, with the integrated
assembler, it is possible to have the input be user specified assembly.  In such
a case, we cannot assume that the function implementation has a compact unwind
representation.  Loosen the assertion into a check and bail if we cannot
represent the frame pointer in the compact unwinding.

Addresses PR30453!

llvm-svn: 281986

8 years agoRedirect stderr to /dev/null. NFC.
Rafael Espindola [Tue, 20 Sep 2016 17:02:38 +0000 (17:02 +0000)]
Redirect stderr to /dev/null. NFC.

Makes the error output less confusing when this test fails.

llvm-svn: 281985

8 years ago[Writer] Fix a typo. NFC.
Davide Italiano [Tue, 20 Sep 2016 16:57:02 +0000 (16:57 +0000)]
[Writer] Fix a typo. NFC.

llvm-svn: 281984

8 years agoRemove more guts of TargetMachine::getNameWithPrefix and migrate one check to the...
Eric Christopher [Tue, 20 Sep 2016 16:05:02 +0000 (16:05 +0000)]
Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version.

NFC intended.

llvm-svn: 281983

8 years agoRemove a use of subtarget initialization in the X86 backend so we can get rid of...
Eric Christopher [Tue, 20 Sep 2016 16:04:59 +0000 (16:04 +0000)]
Remove a use of subtarget initialization in the X86 backend so we can get rid of the default subtarget.

NFC intended.

llvm-svn: 281982

8 years agoRemove extra argument used once on TargetMachine::getNameWithPrefix and inline the...
Eric Christopher [Tue, 20 Sep 2016 16:04:50 +0000 (16:04 +0000)]
Remove extra argument used once on TargetMachine::getNameWithPrefix and inline the result into the singular caller.

llvm-svn: 281981

8 years agoImprove the -debug output for Debug Range Extension (NFC)
Keith Walker [Tue, 20 Sep 2016 16:04:31 +0000 (16:04 +0000)]
Improve the -debug output for Debug Range Extension (NFC)

Include header messages and remove unnecessary blank lines.

llvm-svn: 281980

8 years agoReplace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which handles...
Nick Lewycky [Tue, 20 Sep 2016 15:49:58 +0000 (15:49 +0000)]
Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which handles more cases. Noticed by inspection.

Because of how the IR generation works, this isn't expected to cause an observable difference.

llvm-svn: 281979

8 years agoDisable --rosegment when we have linker scripts.
Rafael Espindola [Tue, 20 Sep 2016 15:22:27 +0000 (15:22 +0000)]
Disable --rosegment when we have linker scripts.

Linker scripts are responsible for aliging '.'. Since they are
designed for bfd which has no --rosegment, they don't align the RO to
RX transition.

llvm-svn: 281978

8 years agoGlobalISel: split aggregates for PCS lowering
Tim Northover [Tue, 20 Sep 2016 15:20:36 +0000 (15:20 +0000)]
GlobalISel: split aggregates for PCS lowering

This should match the existing behaviour for passing complicated struct and
array types, in particular HFAs come through like that from Clang.

For C & C++ we still need to somehow support all the weird ABI flags, or at
least those that are present in the IR (signext, byval, ...), and stack-based
parameter passing.

llvm-svn: 281977

8 years agoMake tests less dependent on the exact layout.
Rafael Espindola [Tue, 20 Sep 2016 15:08:24 +0000 (15:08 +0000)]
Make tests less dependent on the exact layout.

In most cases that means just not checking the address when we don't
need it.

For some tests it is easier to just set . to a known value.

llvm-svn: 281976

8 years ago[mips] MSA intrinsics header file
Simon Dardis [Tue, 20 Sep 2016 15:07:36 +0000 (15:07 +0000)]
[mips] MSA intrinsics header file

This patch adds the msa.h header file containing the shorter names for the
MSA instrinsics, e.g. msa_sll_b for builtin_msa_sll_b.

Reviewers: vkalintiris, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D24674

llvm-svn: 281975