platform/upstream/llvm.git
9 years ago[compiler-rt] Enable ASAN for powerpc64le-linux
Will Schmidt [Wed, 15 Oct 2014 18:34:04 +0000 (18:34 +0000)]
[compiler-rt] Enable ASAN for powerpc64le-linux

Whitespace update for lint check by myself (Will).  Otherwise code and comments by Peter Bergner, as previously seen on llvm-commits.

    The following patch gets ASAN somewhat working on powerpc64le-linux.
    It currently assumes the LE kernel uses 46-bit addressing, which is
    true, but it doesn't solve the case for BE where it may be 44 or
    46 bits.  That can be fixed with a follow on patch.

    There are some test suite fails even with this patch that I haven't had
    time to solve yet, but this is better than the state it is in now.
    The limited debugging of those test suite fails seems to show that the
    address map for 46-bit addressing has changed and so we'll need to
    modify the shadow memory location slightly.  Again, that can be fixed
    with a follow on patch.

llvm-svn: 219827

9 years agoEnable the instruction printer in HexagonMCTargetDesc
Sid Manning [Wed, 15 Oct 2014 18:27:40 +0000 (18:27 +0000)]
Enable the instruction printer in HexagonMCTargetDesc

This adds the MCInstPrinter to the LLVMHexagonDesc library and removes
the dependency LLVMHexagonAsmPrinter had on LLVMHexagonDesc. This is
a prerequisite needed by the disassembler.

Phabricator Revision: http://reviews.llvm.org/D5734

llvm-svn: 219826

9 years ago[CMake] Cleanup CMake rules after r219302. NFC.
Alexey Samsonov [Wed, 15 Oct 2014 18:23:57 +0000 (18:23 +0000)]
[CMake] Cleanup CMake rules after r219302. NFC.

llvm-svn: 219825

9 years ago[macho] Create references from __eh_frame FDEs to their function.
Tim Northover [Wed, 15 Oct 2014 18:19:31 +0000 (18:19 +0000)]
[macho] Create references from __eh_frame FDEs to their function.

We'll also need references back to the CIE eventually, but for now making sure
we can work out what an FDE is referring to is enough.

The actual kind of reference needs to be different between architectures,
probably because of MachO's chronic shortage of relocation types but I don't
really want to know in case I find out something that distresses me even more.

rdar://problem/18208653

llvm-svn: 219824

9 years agoR600/SI: Also try to use 0 base for misaligned 8-byte DS loads.
Matt Arsenault [Wed, 15 Oct 2014 18:06:43 +0000 (18:06 +0000)]
R600/SI: Also try to use 0 base for misaligned 8-byte DS loads.

llvm-svn: 219823

9 years ago[UBSan] [MIPS] Adding support of UBSan for mipsel arch
Alexey Samsonov [Wed, 15 Oct 2014 18:04:42 +0000 (18:04 +0000)]
[UBSan] [MIPS] Adding support of UBSan for mipsel arch

Summary:
Changed files:
config-ix.cmake: Added mipsel to UBSAN_SUPPORTED_ARCH

Reviewers: rsmith, kcc, dsanders, petarj, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits, mohit.bhakkad, farazs, kumarsukhani

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

llvm-svn: 219822

9 years agoAllow ThreadLauncher::LaunchThread() to specify a minimum stack byte size when launch...
Greg Clayton [Wed, 15 Oct 2014 18:03:59 +0000 (18:03 +0000)]
Allow ThreadLauncher::LaunchThread() to specify a minimum stack byte size when launching threads.

This defaults to zero, which means to use the system default.

NOTE: Windows will need to implement this.

<rdar://problem/18644448>

llvm-svn: 219821

9 years agoAdd llvm_unreachable after switch to avoid warnings about a missing
Kaelyn Takata [Wed, 15 Oct 2014 18:03:26 +0000 (18:03 +0000)]
Add llvm_unreachable after switch to avoid warnings about a missing
return.

Forgot to add this in r219818.

llvm-svn: 219820

9 years agoR600: Fix miscompiles when BFE has multiple uses
Matt Arsenault [Wed, 15 Oct 2014 17:58:34 +0000 (17:58 +0000)]
R600: Fix miscompiles when BFE has multiple uses

SimplifyDemandedBits would break the other uses of the operand.

llvm-svn: 219819

9 years agoDrop unneccessary default case from switch introduced in r219809
Kaelyn Takata [Wed, 15 Oct 2014 17:46:18 +0000 (17:46 +0000)]
Drop unneccessary default case from switch introduced in r219809

This silences:
../tools/clang/tools/libclang/CIndex.cpp:6451:3: warning: default label
in switch which covers all enumeration values [-Wcovered-switch-default]

llvm-svn: 219818

9 years agocorrect const-ness with auto and dyn_cast
Sanjay Patel [Wed, 15 Oct 2014 17:45:13 +0000 (17:45 +0000)]
correct const-ness with auto and dyn_cast

1. Use const with autos.
2. Don't bother with explicit const in cast ops because they do it automagically.

Thanks, David B. / Aaron B. / Reid K.

llvm-svn: 219817

9 years ago[SLPVectorize] Basic ephemeral-value awareness
Hal Finkel [Wed, 15 Oct 2014 17:35:01 +0000 (17:35 +0000)]
[SLPVectorize] Basic ephemeral-value awareness

The SLP vectorizer should not vectorize ephemeral values. These are used to
express information to the optimizer, and vectorizing them does not lead to
faster code (because the ephemeral values are dropped prior to code generation,
vectorized or not), and obscures the information the instructions are
attempting to communicate (the logic that interprets the arguments to
@llvm.assume generically does not understand vectorized conditions).

Also, uses by ephemeral values are free (because they, and the necessary
extractelement instructions, will be dropped prior to code generation).

llvm-svn: 219816

9 years agoTreat the WorkSet used to find ephemeral values as double-ended
Hal Finkel [Wed, 15 Oct 2014 17:34:48 +0000 (17:34 +0000)]
Treat the WorkSet used to find ephemeral values as double-ended

We need to make sure that we visit all operands of an instruction before moving
deeper in the operand graph. We had been pushing operands onto the back of the work
set, and popping them off the back as well, meaning that we might visit an
instruction before visiting all of its uses that sit in between it and the call
to @llvm.assume.

To provide an explicit example, given the following:
  %q0 = extractelement <4 x float> %rd, i32 0
  %q1 = extractelement <4 x float> %rd, i32 1
  %q2 = extractelement <4 x float> %rd, i32 2
  %q3 = extractelement <4 x float> %rd, i32 3
  %q4 = fadd float %q0, %q1
  %q5 = fadd float %q2, %q3
  %q6 = fadd float %q4, %q5
  %qi = fcmp olt float %q6, %q5
  call void @llvm.assume(i1 %qi)

%q5 is used by both %qi and %q6. When we visit %qi, it will be marked as
ephemeral, and we'll queue %q6 and %q5. %q6 will be marked as ephemeral and
we'll queue %q4 and %q5. Under the old system, we'd then visit %q4, which
would become ephemeral, %q1 and then %q0, which would become ephemeral as
well, and now we have a problem. We'd visit %rd, but it would not be marked as
ephemeral because we've not yet visited %q2 and %q3 (because we've not yet
visited %q5).

This will be covered by a test case in a follow-up commit that enables
ephemeral-value awareness in the SLP vectorizer.

llvm-svn: 219815

9 years agoRemove some unnecessary headers from Host.cpp
Zachary Turner [Wed, 15 Oct 2014 17:27:11 +0000 (17:27 +0000)]
Remove some unnecessary headers from Host.cpp

After the recent migration of code out of Host.cpp, many
unnecessary headers were still being included.  This prunes the
include list down to only what is still necessary.

llvm-svn: 219814

9 years agoRevert "Fix late template parsing leak with incremental processing"
Reid Kleckner [Wed, 15 Oct 2014 17:22:56 +0000 (17:22 +0000)]
Revert "Fix late template parsing leak with incremental processing"

This reverts commit r219810.

The test suite appears broken.

llvm-svn: 219813

9 years ago[analyzer] Perl scripts are run differently from makefiles. Sometimes additional...
Anton Yartsev [Wed, 15 Oct 2014 17:13:02 +0000 (17:13 +0000)]
[analyzer] Perl scripts are run differently from makefiles. Sometimes additional utilities are involved, e.g. 'env' utility that present in MSYS but is missing in MinGW. The patch unifies launch of "c++-analyzer" and "ccc-analyzer".

llvm-svn: 219812

9 years ago[MC] Make bundle alignment mode setting idempotent and support nested bundles
Derek Schuff [Wed, 15 Oct 2014 17:10:04 +0000 (17:10 +0000)]
[MC] Make bundle alignment mode setting idempotent and support nested bundles

Summary:
Currently an error is thrown if bundle alignment mode is set more than once
per module (either via the API or the .bundle_align_mode directive). This
change allows setting it multiple times as long as the alignment doesn't
change.

Also nested bundle_lock groups are currently not allowed. This change allows
them, with the effect that the group stays open until all nests are exited,
and if any of the bundle_lock directives has the align_to_end flag, the
group becomes align_to_end.

These changes make the bundle aligment simpler to use in the compiler, and
also better match the corresponding support in GNU as.

Reviewers: jvoung, eliben

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

llvm-svn: 219811

9 years agoFix late template parsing leak with incremental processing
Reid Kleckner [Wed, 15 Oct 2014 17:08:33 +0000 (17:08 +0000)]
Fix late template parsing leak with incremental processing

Add a second late template parser callback meant to cleanup any
resources allocated by late template parsing.  Call it from the
Sema::ActOnEndOfTranslationUnit method after all pending template
instantiations have been completed.  Teach Parser::ParseTopLevelDecl to
install the cleanup callback when incremental processing is enabled so
that Parser::TemplateIds can be freed.

Patch by Brad King!

llvm-svn: 219810

9 years ago[libclang] Add function to retrieve storage class in libclang.
Argyrios Kyrtzidis [Wed, 15 Oct 2014 17:05:31 +0000 (17:05 +0000)]
[libclang] Add function to retrieve storage class in libclang.

Patch by guibufolo!

llvm-svn: 219809

9 years agoDI: Make comments "brief"-er, NFC
Duncan P. N. Exon Smith [Wed, 15 Oct 2014 17:01:28 +0000 (17:01 +0000)]
DI: Make comments "brief"-er, NFC

Follow-up to r219801.  Post-commit review pointed out that all comments
require a `\brief` description [1], so I converted many and recrafted a
few to be briefer or to include a brief intro.  (If I'm going to clean
them up, I should do it right!)

[1]: http://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments

llvm-svn: 219808

9 years agoAdding attributes to the IndirectFieldDecl that we generate for anonymous struct...
Aaron Ballman [Wed, 15 Oct 2014 16:58:18 +0000 (16:58 +0000)]
Adding attributes to the IndirectFieldDecl that we generate for anonymous struct/union fields. This fixes PR20930.

llvm-svn: 219807

9 years agoDon't use a global_ctors comdat for globals that aren't externally visible
Reid Kleckner [Wed, 15 Oct 2014 16:38:00 +0000 (16:38 +0000)]
Don't use a global_ctors comdat for globals that aren't externally visible

In particular, if you have two identical templates in different TUs in
anonymous namespaces, we would use the same global_ctors comdat key for
both. As a result, only one would be run.

llvm-svn: 219806

9 years agoCodeGen: Cleanup CGRecordLowering::lowerUnion a little
David Majnemer [Wed, 15 Oct 2014 16:36:11 +0000 (16:36 +0000)]
CodeGen: Cleanup CGRecordLowering::lowerUnion a little

Remove some duplicated state, no functionality change intended.

llvm-svn: 219805

9 years agoUse 'auto' for easier reading; no functional change intended.
Sanjay Patel [Wed, 15 Oct 2014 16:21:37 +0000 (16:21 +0000)]
Use 'auto' for easier reading; no functional change intended.

llvm-svn: 219804

9 years agoremove function names from comments; NFC
Sanjay Patel [Wed, 15 Oct 2014 16:20:45 +0000 (16:20 +0000)]
remove function names from comments; NFC

llvm-svn: 219803

9 years agoFix for PR21254 - Assertion in comment parser
Dario Domizioli [Wed, 15 Oct 2014 16:18:20 +0000 (16:18 +0000)]
Fix for PR21254 - Assertion in comment parser

The size of the ID field in CommandInfo was narrow, leading to potential
wrap-around of command IDs, causing misinterpretation later on.
The patch does the following:
- It extends the ID bitfield from 8 to 20 bits.
- It provides a DRY definition of the number of bits for the field to
  avoid using literal numbers in different files.
- It introduces a new assertion that checks for the wrap-around.
- It adds the testcase from PR21254.

llvm-svn: 219802

9 years agoDI: Cleanup comments, NFC
Duncan P. N. Exon Smith [Wed, 15 Oct 2014 16:15:15 +0000 (16:15 +0000)]
DI: Cleanup comments, NFC

A number of comment cleanups:

  - Remove duplicated function and class names from comments.

  - Remove duplicated comments from source file (some of which were
    out-of-sync).

  - Move any unduplicated comments from source file to header.

  - Remove some noisy comments entirely (e.g., a comment for
    `DIDescriptor::print()` saying "print descriptor" just gets in the
    way of reading the code).

llvm-svn: 219801

9 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 15 Oct 2014 16:12:57 +0000 (16:12 +0000)]
Update for llvm api change.

llvm-svn: 219800

9 years agoSimplify handling of --noexecstack by using getNonexecutableStackSection.
Rafael Espindola [Wed, 15 Oct 2014 16:12:52 +0000 (16:12 +0000)]
Simplify handling of --noexecstack by using getNonexecutableStackSection.

llvm-svn: 219799

9 years agoDI: Use a `DenseMap` instead of named metadata, NFC
Duncan P. N. Exon Smith [Wed, 15 Oct 2014 16:11:41 +0000 (16:11 +0000)]
DI: Use a `DenseMap` instead of named metadata, NFC

Remove a strange round-trip through named metadata to assign preserved
local variables to their subprograms.

llvm-svn: 219798

9 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 15 Oct 2014 15:44:25 +0000 (15:44 +0000)]
Update for llvm api change.

llvm-svn: 219797

9 years agoMove getNonexecutableStackSection up to the base ELF class.
Rafael Espindola [Wed, 15 Oct 2014 15:44:16 +0000 (15:44 +0000)]
Move getNonexecutableStackSection up to the base ELF class.

The .note.GNU-stack section is not SystemZ/X86 specific.

llvm-svn: 219796

9 years agoTurned Sema::HandleDelayedAvailabilityCheck into a static function; NFC.
Aaron Ballman [Wed, 15 Oct 2014 15:37:51 +0000 (15:37 +0000)]
Turned Sema::HandleDelayedAvailabilityCheck into a static function; NFC.

Did a bit of drive-by reformatting as well since it required rearranging some other static functions in the file.

llvm-svn: 219795

9 years ago[analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.
Anton Yartsev [Wed, 15 Oct 2014 15:11:45 +0000 (15:11 +0000)]
[analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.

llvm-svn: 219794

9 years agor600: Use llvm intrinsic to read work dimension information
Jan Vesely [Wed, 15 Oct 2014 15:08:06 +0000 (15:08 +0000)]
r600: Use llvm intrinsic to read work dimension information

v2: Fix function declaration
    Add range metadata to r600 implementation
v3: change prefix to AMDGPU

Reviewed-by: Tom Stellard <tom@stellard.net>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 219793

9 years agoSpeed up hasName() matcher.
Samuel Benzaquen [Wed, 15 Oct 2014 14:58:46 +0000 (14:58 +0000)]
Speed up hasName() matcher.

Summary:
Speed up hasName() matcher by skipping the expensive generation of the
fully qualified name unless we need it.
In the common case of matching an unqualified name, we don't need to
generate the full name. We might not even need to copy any string at
all.
This change speeds up our clang-tidy benchmark by ~10%

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 219792

9 years ago[Tsan] Fix the sunrpc.cc test to build on FreeBSD
Viktor Kutuzov [Wed, 15 Oct 2014 12:47:48 +0000 (12:47 +0000)]
[Tsan] Fix the sunrpc.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5730

llvm-svn: 219791

9 years ago[Tsan] Make the mutex_robust tests Linux-specific
Viktor Kutuzov [Wed, 15 Oct 2014 12:43:04 +0000 (12:43 +0000)]
[Tsan] Make the mutex_robust tests Linux-specific
Differential Revision: http://reviews.llvm.org/D5729

llvm-svn: 219790

9 years agoFix llvm-header-guard check.
Alexander Kornienko [Wed, 15 Oct 2014 12:18:35 +0000 (12:18 +0000)]
Fix llvm-header-guard check.

Summary:
This patch makes the check work better for LLVM code:
  * always fix existing #endif comments
  * use one space before the comment (+allow customization for other styles)

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 219789

9 years agoReformatted code samples in the unit test. No functional changes.
Alexander Kornienko [Wed, 15 Oct 2014 11:36:48 +0000 (11:36 +0000)]
Reformatted code samples in the unit test. No functional changes.

llvm-svn: 219788

9 years agoFixed a comment. No functional changes.
Alexander Kornienko [Wed, 15 Oct 2014 11:03:39 +0000 (11:03 +0000)]
Fixed a comment. No functional changes.

llvm-svn: 219787

9 years ago[clang-tidy] Move some of the misc checks to readability/
Alexander Kornienko [Wed, 15 Oct 2014 10:51:57 +0000 (10:51 +0000)]
[clang-tidy] Move some of the misc checks to readability/

Summary:
Some of the misc checks belong to readability/. I'm moving them there
without changing check names for now. As the next step, I want to register some
of these checks in the google and llvm modules with suitable settings (e.g.
BracesAroundStatementsCheck). I'm not sure if we want to create a "readability"
module, probably not.

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

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

llvm-svn: 219786

9 years agoFixes PR21157 'tuple: non-default constructible tuple hard failure' Thanks to Louis...
Marshall Clow [Wed, 15 Oct 2014 10:33:02 +0000 (10:33 +0000)]
Fixes PR21157 'tuple: non-default constructible tuple hard failure' Thanks to Louis Dionne for the bug report and the patch.

llvm-svn: 219785

9 years agotsan: fix false positive related to signals
Dmitry Vyukov [Wed, 15 Oct 2014 08:56:43 +0000 (08:56 +0000)]
tsan: fix false positive related to signals
Write interceptor calls malloc, which causes a false
unsafe-call-in-signal-handler report. See the test.

llvm-svn: 219784

9 years agotsan: use a different dir for llvm build
Dmitry Vyukov [Wed, 15 Oct 2014 08:56:15 +0000 (08:56 +0000)]
tsan: use a different dir for llvm build
build is used as gtest temp build dir, and is cleared during every build

llvm-svn: 219783

9 years agoImprove the handling of kalimba ELF file section type recognition.
Matthew Gardiner [Wed, 15 Oct 2014 08:21:54 +0000 (08:21 +0000)]
Improve the handling of kalimba ELF file section type recognition.

Recognise the SHT_NOBITS property in kalimba ELF, and determine this to be
of type zerofilled. Subsequently recognise this type to represent bytes
on the target's DATA address space, and therefore be sized accordingly.

llvm-svn: 219782

9 years agoCodeGen: Use the initing member's type for a union's storage type more often
David Majnemer [Wed, 15 Oct 2014 07:57:41 +0000 (07:57 +0000)]
CodeGen: Use the initing member's type for a union's storage type more often

Unions are initialized with the default initialization of their first
named member.  If that member is not zero initialized, then we should
prefer that member's type.  Otherwise, we might try to make an otherwise
unsuitable type (like an array) which we cannot easily initialize with a
pointer to member.

llvm-svn: 219781

9 years agoCodeGen: Fix a typo in a comment
David Majnemer [Wed, 15 Oct 2014 07:57:38 +0000 (07:57 +0000)]
CodeGen: Fix a typo in a comment

No functionality change intended.

llvm-svn: 219780

9 years agotsan: remove dead code
Dmitry Vyukov [Wed, 15 Oct 2014 05:38:49 +0000 (05:38 +0000)]
tsan: remove dead code

llvm-svn: 219779

9 years agoR600: Use existing variable
Matt Arsenault [Wed, 15 Oct 2014 05:07:00 +0000 (05:07 +0000)]
R600: Use existing variable

llvm-svn: 219778

9 years agoR600: Remove outdated comment
Matt Arsenault [Wed, 15 Oct 2014 05:06:57 +0000 (05:06 +0000)]
R600: Remove outdated comment

llvm-svn: 219777

9 years agoRevert "[FastISel][AArch64] Add custom lowering for GEPs."
Juergen Ributzka [Wed, 15 Oct 2014 04:55:48 +0000 (04:55 +0000)]
Revert "[FastISel][AArch64] Add custom lowering for GEPs."

This breaks our internal build bots. Reverting it to get the bots green again.

llvm-svn: 219776

9 years agoMS ABI: Use the correct this arg when generating implicit array copy ctor
David Majnemer [Wed, 15 Oct 2014 04:54:54 +0000 (04:54 +0000)]
MS ABI: Use the correct this arg when generating implicit array copy ctor

We assumed the last argument of the copy constructor was the this
pointer.  However, this is not the case under the MS ABI.

llvm-svn: 219775

9 years agoImprovements to -Wnull-conversion
Richard Trieu [Wed, 15 Oct 2014 03:42:06 +0000 (03:42 +0000)]
Improvements to -Wnull-conversion

Split logic to separate checking function
Refine the macro checking
Catch nullptr->bool conversions
Add some explanatory comments

llvm-svn: 219774

9 years ago[MachineSink] Use the real post dominator tree
Jingyue Wu [Wed, 15 Oct 2014 03:27:43 +0000 (03:27 +0000)]
[MachineSink] Use the real post dominator tree

Summary:
Fixes a FIXME in MachineSinking. Instead of using the simple heuristics in
isPostDominatedBy, use the real MachinePostDominatorTree and MachineLoopInfo.
The old heuristics caused instructions to sink unnecessarily, and might create
register pressure.

This is the second try of the fix. The first one (D4814) caused a performance
regression due to failing to sink instructions out of loops (PR21115). This
patch fixes PR21115 by sinking an instruction from a deeper loop to a shallower
one regardless of whether the target block post-dominates the source.

Thanks Alexey Volkov for reporting PR21115!

Test Plan:
Added a NVPTX codegen test to verify that our change prevents the backend from
over-sinking. It also shows the unnecessary register pressure caused by
over-sinking.

Added an X86 test to verify we can sink instructions out of loops regardless of
the dominance relationship. This test is reduced from Alexey's test in PR21115.

Updated an affected test in X86.

Also ran SPEC CINT2006 and llvm-test-suite for compilation time and runtime
performance. Results are attached separately in the review thread.

Reviewers: Jiangning, resistor, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, bruno, volkalexey, llvm-commits, meheff, eliben, jholewinski

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

llvm-svn: 219773

9 years agoBe more consistent about null checks for the Process and ABI
Jason Molenda [Wed, 15 Oct 2014 03:11:37 +0000 (03:11 +0000)]
Be more consistent about null checks for the Process and ABI
in GetFullUnwindPlanForFrame() - the code was mostly checking
that we had an active Process and ABI but not always.
clang static analyzer fixit.

llvm-svn: 219772

9 years agoMake sure local var cu is non-NULL before dereferencing.
Jason Molenda [Wed, 15 Oct 2014 03:07:39 +0000 (03:07 +0000)]
Make sure local var cu is non-NULL before dereferencing.
(it was checked for NULL-ness in some places, not in others)
clang static analyzer fixit.

llvm-svn: 219771

9 years agoRemove unneeded local var initialization.
Jason Molenda [Wed, 15 Oct 2014 03:06:23 +0000 (03:06 +0000)]
Remove unneeded local var initialization.
clang static analyzer fixit.

llvm-svn: 219770

9 years agoMake sure is_indirect local var is initialized; there
Jason Molenda [Wed, 15 Oct 2014 03:05:38 +0000 (03:05 +0000)]
Make sure is_indirect local var is initialized; there
exists a code path where it could be used while uninitialized.
clang static analyzer fixit.

llvm-svn: 219769

9 years agoEnsure that m_syntax is initialized in all the FileSpec
Jason Molenda [Wed, 15 Oct 2014 03:04:33 +0000 (03:04 +0000)]
Ensure that m_syntax is initialized in all the FileSpec
constructors.
clang static analyzer fixit.

llvm-svn: 219768

9 years agoARM: drop check for triple that's no longer used.
Tim Northover [Wed, 15 Oct 2014 01:05:01 +0000 (01:05 +0000)]
ARM: drop check for triple that's no longer used.

Early attempts to support AAPCS bare metal MachO targets based the decision on
the CPU being compiled for. This was not a particularly great idea and we've
got a better option now, but this check remained.

No functional change for any target we care about.

llvm-svn: 219767

9 years agoFrontend: Don't accept null DiagnosticsEngines when building ASTUnits
Justin Bogner [Wed, 15 Oct 2014 00:33:06 +0000 (00:33 +0000)]
Frontend: Don't accept null DiagnosticsEngines when building ASTUnits

The various ways to create an ASTUnit all take a refcounted pointer to
a diagnostics engine as an argument, and if it isn't pointing at
anything they initialize it. This is a pretty confusing API, and it
really makes more sense for the caller to initialize the thing since
they control the lifetime anyway.

This fixes the one caller that didn't bother initializing the pointer
and asserts that the argument is initialized.

llvm-svn: 219752

9 years agoRemove unused variable.
Eric Christopher [Wed, 15 Oct 2014 00:15:26 +0000 (00:15 +0000)]
Remove unused variable.

llvm-svn: 219751

9 years agoRemove unused variable.
Eric Christopher [Wed, 15 Oct 2014 00:09:07 +0000 (00:09 +0000)]
Remove unused variable.

llvm-svn: 219750

9 years agoNo need to cache this unused variable.
Eric Christopher [Tue, 14 Oct 2014 23:58:51 +0000 (23:58 +0000)]
No need to cache this unused variable.

Patch by Ehsan Akhgari.

llvm-svn: 219749

9 years ago[AArch64] Wrong CC access in CSINC-conditional branch sequence
Gerolf Hoflehner [Tue, 14 Oct 2014 23:55:00 +0000 (23:55 +0000)]
[AArch64] Wrong CC access in CSINC-conditional branch sequence

This is a follow up to commit r219742. It removes the CCInMI variable
and accesses the CC in CSCINC directly. In the case of a conditional
branch accessing the CC with CCInMI was wrong.

llvm-svn: 219748

9 years agoFrontend: Remove some unused arguments in ASTUnit (NFC)
Justin Bogner [Tue, 14 Oct 2014 23:36:06 +0000 (23:36 +0000)]
Frontend: Remove some unused arguments in ASTUnit (NFC)

llvm-svn: 219747

9 years ago[llvm-objdump] Update error message and add test case for mach-o file with bad librar...
Nick Kledzik [Tue, 14 Oct 2014 23:29:38 +0000 (23:29 +0000)]
[llvm-objdump] Update error message and add test case for mach-o file with bad library ordinals

llvm-svn: 219746

9 years agovadefs.h: be even more conservative and only define the macros if already defined
Hans Wennborg [Tue, 14 Oct 2014 23:20:25 +0000 (23:20 +0000)]
vadefs.h: be even more conservative and only define the macros if already defined

llvm-svn: 219745

9 years agoclang-cl: Diagnose the usage of ASAN with a debug runtime library
Ehsan Akhgari [Tue, 14 Oct 2014 23:15:44 +0000 (23:15 +0000)]
clang-cl: Diagnose the usage of ASAN with a debug runtime library

Summary:
AddressSanitizer currently doesn't support this configuration, and binaries
built with it will just get into an infinite loop during startup.

Test Plan: Includes an automated test.

Reviewers: samsonov

Subscribers: cfe-commits

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

llvm-svn: 219744

9 years agoSort files list in lib/Headers/CMakeLists.txt
Hans Wennborg [Tue, 14 Oct 2014 23:15:43 +0000 (23:15 +0000)]
Sort files list in lib/Headers/CMakeLists.txt

majnemer pointed out that vadefs.h was added in the wrong place. Might
as well sort the rest too.

llvm-svn: 219743

9 years ago[AAarch64] Optimize CSINC-branch sequence
Gerolf Hoflehner [Tue, 14 Oct 2014 23:07:53 +0000 (23:07 +0000)]
[AAarch64] Optimize CSINC-branch sequence

Peephole optimization that generates a single conditional branch
for csinc-branch sequences like in the examples below. This is
possible when the csinc sets or clears a register based on a condition
code and the branch checks that register. Also the condition
code may not be modified between the csinc and the original branch.

Examples:

1. Convert csinc w9, wzr, wzr, <CC>;tbnz w9, #0, 0x44
   to b.<invCC>

2. Convert csinc w9, wzr, wzr, <CC>; tbz w9, #0, 0x44
   to b.<CC>

rdar://problem/18506500

llvm-svn: 219742

9 years ago[LoopVectorize] Ignore @llvm.assume for cost estimates and legality
Hal Finkel [Tue, 14 Oct 2014 22:59:49 +0000 (22:59 +0000)]
[LoopVectorize] Ignore @llvm.assume for cost estimates and legality

A few minor changes to prevent @llvm.assume from interfering with loop
vectorization. First, treat @llvm.assume like the lifetime intrinsics, which
are scalarized (but don't otherwise interfere with the legality checking).
Second, ignore the cost of ephemeral instructions in the loop (these will go
away anyway during CodeGen).

Alignment assumptions and other uses of @llvm.assume can often end up inside of
loops that should be vectorized (this is not uncommon for assumptions generated
by __attribute__((align_value(n))), for example).

llvm-svn: 219741

9 years agoMS Compat: interpose vadefs.h to fix definitions of _crt_va_{start,end,arg} (PR21247)
Hans Wennborg [Tue, 14 Oct 2014 22:35:42 +0000 (22:35 +0000)]
MS Compat: interpose vadefs.h to fix definitions of _crt_va_{start,end,arg} (PR21247)

Differential revision: http://reviews.llvm.org/D5784

llvm-svn: 219740

9 years agoMC, COFF: Make bigobj test compatible with python3
David Majnemer [Tue, 14 Oct 2014 22:35:11 +0000 (22:35 +0000)]
MC, COFF: Make bigobj test compatible with python3

No functionality change intended.

llvm-svn: 219739

9 years ago[X86][SSE] pslldq/psrldq shuffle mask decodes
Simon Pilgrim [Tue, 14 Oct 2014 22:31:34 +0000 (22:31 +0000)]
[X86][SSE] pslldq/psrldq shuffle mask decodes

Patch to provide shuffle decodes and asm comments for the sse pslldq/psrldq SSE2/AVX2 byte shift instructions.

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

llvm-svn: 219738

9 years agoMC: Rewrite bigobj test in python
David Majnemer [Tue, 14 Oct 2014 22:26:49 +0000 (22:26 +0000)]
MC: Rewrite bigobj test in python

This makes the test easier to work with.  No functionality change
intended.

llvm-svn: 219737

9 years agoDebugInfo: Lazily built static member variable declarations should use the canonical...
David Blaikie [Tue, 14 Oct 2014 22:22:17 +0000 (22:22 +0000)]
DebugInfo: Lazily built static member variable declarations should use the canonical declaration for line/file information.

When lazily constructing static member variable declarations (when
the vtable optimization fires and the definition of the type is omitted
(or built later, lazily), but the out of line definition of the static
member is provided and must be described in debug info) ensure we use
the canonical declaration when computing the file, line, etc for that
declaration (rather than the definition, which is also a declaration,
but not the canonical one).

llvm-svn: 219736

9 years agoARM: remove ARM/Thumb distinction for preferred alignment.
Tim Northover [Tue, 14 Oct 2014 22:12:21 +0000 (22:12 +0000)]
ARM: remove ARM/Thumb distinction for preferred alignment.

Thumb1 has legitimate reasons for preferring 32-bit alignment of types
i1/i8/i16, since the 16-bit encoding of "add rD, sp, #imm" requires #imm to be
a multiple of 4. However, this is a trade-off betweem code size and RAM usage;
the DataLayout string is not the best place to represent it even if desired.

So this patch removes the extra Thumb requirements, hopefully making ARM and
Thumb completely compatible in this respect.

llvm-svn: 219735

9 years agoARM: remove ARM/Thumb distinction for preferred alignment.
Tim Northover [Tue, 14 Oct 2014 22:12:17 +0000 (22:12 +0000)]
ARM: remove ARM/Thumb distinction for preferred alignment.

Thumb1 has legitimate reasons for preferring 32-bit alignment of types
i1/i8/i16, since the 16-bit encoding of "add rD, sp, #imm" requires #imm to be
a multiple of 4. However, this is a trade-off betweem code size and RAM usage;
the DataLayout string is not the best place to represent it even if desired.

So this patch removes the extra Thumb requirements, hopefully making ARM and
Thumb completely compatible in this respect.

llvm-svn: 219734

9 years agoARM: allow misaligned local variables in Thumb1 mode.
Tim Northover [Tue, 14 Oct 2014 22:12:14 +0000 (22:12 +0000)]
ARM: allow misaligned local variables in Thumb1 mode.

There's no hard requirement on LLVM to align local variable to 32-bits, so the
Thumb1 frame handling needs to be able to deal with variables that are only
naturally aligned without falling over.

llvm-svn: 219733

9 years agoBe smarter when parsing variable declarations with unknown types.
Kaelyn Takata [Tue, 14 Oct 2014 21:57:21 +0000 (21:57 +0000)]
Be smarter when parsing variable declarations with unknown types.

Specifically, avoid typo-correcting the variable name into a type before
typo-correcting the actual type name in the declaration. Doing so
results in a very unpleasant cascade of errors, with the typo correction
of the actual type name being buried in the middle.

llvm-svn: 219732

9 years agoCreate a process launcher abstraction.
Zachary Turner [Tue, 14 Oct 2014 21:55:08 +0000 (21:55 +0000)]
Create a process launcher abstraction.

This implements Host::LaunchProcess for windows, and in doing so
does some minor refactor to move towards a more modular process
launching design.

The original motivation for this is that launching processes on
windows needs some very windows specific code, which would live
most appropriately in source/Host/windows somewhere.  However,
there is already some common code that all platforms use when
launching a process before delegating to the platform specific
stuff, which lives in source/Host/common/Host.cpp which would
be nice to reuse without duplicating.

This commonality has been abstracted into MonitoringProcessLauncher,
a class which abstracts out the notion of launching a process using
an arbitrary algorithm, and then monitoring it for state changes.

The windows specific launching code lives in ProcessLauncherWindows,
and the posix specific launching code lives in ProcessLauncherPosix.
When launching a process MonitoringProcessLauncher is created, and
then an appropriate delegate launcher is created and given to the
MonitoringProcessLauncher.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5781

llvm-svn: 219731

9 years agoFix a path concatenation issue related to windows paths.
Zachary Turner [Tue, 14 Oct 2014 21:54:14 +0000 (21:54 +0000)]
Fix a path concatenation issue related to windows paths.

llvm-svn: 219730

9 years agoAdd a test for writing COFF BigObj
David Majnemer [Tue, 14 Oct 2014 21:47:53 +0000 (21:47 +0000)]
Add a test for writing COFF BigObj

llvm-svn: 219729

9 years agoWhen PlatformDarwinKernel::ExamineKextForMatchingUUID is given
Jason Molenda [Tue, 14 Oct 2014 21:47:45 +0000 (21:47 +0000)]
When PlatformDarwinKernel::ExamineKextForMatchingUUID is given
a FileSpec, UUID, and ArchSpec, and it's opening all the kexts
with the same bundle id to see if they're a match, don't set
the Arch in the ModuleSpec.  If Module::GetObjectFile() sees
that the architecture of the kext is a mismatch for the arch
we're looking for, it'll spew a warning message to the dev (r217251).

Rely on the UUID match to get the correct file if we have
a UUID -- we'll get no warning if it's a mismatch.

<rdar://problem/18641477>

llvm-svn: 219728

9 years agoUse isa<> and cast<> instead of definition().
Rui Ueyama [Tue, 14 Oct 2014 21:42:08 +0000 (21:42 +0000)]
Use isa<> and cast<> instead of definition().

No functionality change intended.

llvm-svn: 219727

9 years ago[FastISel][AArch64] Add custom lowering for GEPs.
Juergen Ributzka [Tue, 14 Oct 2014 21:41:23 +0000 (21:41 +0000)]
[FastISel][AArch64] Add custom lowering for GEPs.

This is mostly a copy of the existing FastISel GEP code, but on AArch64 we bail
out even for simple cases, because the standard fastEmit functions don't cover
MUL and ADD is lowered inefficientily.

llvm-svn: 219726

9 years ago[x86 asm] allow fwait alias in both At&t and Intel modes (PR21208)
Hans Wennborg [Tue, 14 Oct 2014 21:41:17 +0000 (21:41 +0000)]
[x86 asm] allow fwait alias in both At&t and Intel modes (PR21208)

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

llvm-svn: 219725

9 years agoRemove dead code.
Rui Ueyama [Tue, 14 Oct 2014 21:37:33 +0000 (21:37 +0000)]
Remove dead code.

Because we use cast<> at the beginning of this function, it will
abort there if a given atom is not a DefinedAtom.

In the switch statement, we checked if a given atom is a DefinedAtom
again by evaluating definition() == Atom::definitionRegular.
This was always true. So we can remove the outer switch statement.

llvm-svn: 219724

9 years agoUse isa<> instead of checking return value of definition().
Rui Ueyama [Tue, 14 Oct 2014 21:20:01 +0000 (21:20 +0000)]
Use isa<> instead of checking return value of definition().

definition() is supposed to be used through isa, dyn_cast or cast.
It's better to not call that directly.

llvm-svn: 219723

9 years agoFix compiler-rt build on FreeBSD 10.1
Ed Maste [Tue, 14 Oct 2014 21:08:35 +0000 (21:08 +0000)]
Fix compiler-rt build on FreeBSD 10.1

We have to #define _WANT_RTENTRY to get struct rtentry, and add headers
that it depends on.

SIOCADDRT and SIOCDELRT also do not exist in FreeBSD 10.1 and were removed
in FreeBSD rev. 263203:

  Garbage collect long time obsoleted (or never used) stuff from routing
  API.

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

llvm-svn: 219722

9 years agoRe-enable ASAN/UBSAN tests on ARM, with VFP3 they began to pass
Renato Golin [Tue, 14 Oct 2014 21:00:22 +0000 (21:00 +0000)]
Re-enable ASAN/UBSAN tests on ARM, with VFP3 they began to pass

When compiling with -mfpu=vfpv3, those tests began to pass, like the others
with "Illegal Instruction" error, so removing the XFAIL from them should
get the bot green (and have more tests!).

llvm-svn: 219721

9 years agoARM: set preferred aggregate alignment to 32 universally.
Tim Northover [Tue, 14 Oct 2014 20:57:29 +0000 (20:57 +0000)]
ARM: set preferred aggregate alignment to 32 universally.

Before, ARM and Thumb mode code had different preferred alignments, which could
lead to some rather unexpected results. There's justification for reducing it
from the default 64-bits (wasted space), but I don't think there is for going
below 32-bits.

There's no actual ABI change here, just to reassure people.

llvm-svn: 219720

9 years agoARM: set preferred aggregate alignment to 32 universally.
Tim Northover [Tue, 14 Oct 2014 20:57:26 +0000 (20:57 +0000)]
ARM: set preferred aggregate alignment to 32 universally.

Before, ARM and Thumb mode code had different preferred alignments, which could
lead to some rather unexpected results. There's justification for reducing it
from the default 64-bits (wasted space), but I don't think there is for going
below 32-bits.

There's no actual ABI change here, just to reassure people.

llvm-svn: 219719

9 years ago[CFL-AA] CFL-AA should not assert on an va_arg instruction
Hal Finkel [Tue, 14 Oct 2014 20:51:26 +0000 (20:51 +0000)]
[CFL-AA] CFL-AA should not assert on an va_arg instruction

The CFL-AA implementation was missing a visit* routine for va_arg instructions,
causing it to assert when run on a function that had one. For now, handle these
in a conservative way.

Fixes PR20954.

llvm-svn: 219718

9 years agoOptimize away fabs() calls when input is squared (known positive).
Sanjay Patel [Tue, 14 Oct 2014 20:43:11 +0000 (20:43 +0000)]
Optimize away fabs() calls when input is squared (known positive).

Eliminate library calls and intrinsic calls to fabs when the input
is a squared value.

Note that no unsafe-math / fast-math assumptions are needed for
this optimization.

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

llvm-svn: 219717

9 years ago[FastISel][AArch64] Fix sign-/zero-extend folding when SelectionDAG is involved.
Juergen Ributzka [Tue, 14 Oct 2014 20:36:02 +0000 (20:36 +0000)]
[FastISel][AArch64] Fix sign-/zero-extend folding when SelectionDAG is involved.

Sign-/zero-extend folding depended on the load and the integer extend to be
both selected by FastISel. This cannot always be garantueed and SelectionDAG
might interfer. This commit adds additonal checks to load and integer extend
lowering to catch this.

Related to rdar://problem/18495928.

llvm-svn: 219716

9 years agoAdd complex multiply/divide functions to arm64 iOS libclang_rt libraries.
Bob Wilson [Tue, 14 Oct 2014 20:33:36 +0000 (20:33 +0000)]
Add complex multiply/divide functions to arm64 iOS libclang_rt libraries.

Clang r219557 introduces libcalls to complex multiply/divide functions.
Since these functions are not available in iOS for arm64 devices, add them to
the static libraries.

llvm-svn: 219715

9 years agoFactor code into CXXRecordDecl::getTemplateInstantiationPattern() helper
Reid Kleckner [Tue, 14 Oct 2014 20:28:40 +0000 (20:28 +0000)]
Factor code into CXXRecordDecl::getTemplateInstantiationPattern() helper

This moves some code from SemaType.cpp's hasVisibleDefinition() into
DeclCXX.cpp so that it can be used elsewhere. I found one other instance
of code trying to do the same thing, there are probably more. Search for
getInstantiatedFrom() to try to find more.

No functionality change.

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 219714