platform/upstream/llvm.git
8 years agoIntroduce MemAccInst helper class; NFC
Michael Kruse [Wed, 27 Jan 2016 17:09:17 +0000 (17:09 +0000)]
Introduce MemAccInst helper class; NFC

MemAccInst wraps the common members of LoadInst and StoreInst. Also use
of this class in:
- ScopInfo::buildMemoryAccess
- BlockGenerator::generateLocationAccessed
- ScopInfo::addArrayAccess
- Scop::buildAliasGroups
- Replace every use of polly::getPointerOperand

Reviewers: jdoerfert, grosser

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

llvm-svn: 258947

8 years ago[IndVars] Hoist DataLayout load out of loop; NFC
Sanjoy Das [Wed, 27 Jan 2016 17:05:09 +0000 (17:05 +0000)]
[IndVars] Hoist DataLayout load out of loop; NFC

llvm-svn: 258946

8 years ago[IndVars] Use isSCEVable; NFC
Sanjoy Das [Wed, 27 Jan 2016 17:05:06 +0000 (17:05 +0000)]
[IndVars] Use isSCEVable; NFC

llvm-svn: 258945

8 years ago[IndVars] Use range-for; NFC
Sanjoy Das [Wed, 27 Jan 2016 17:05:03 +0000 (17:05 +0000)]
[IndVars] Use range-for; NFC

llvm-svn: 258944

8 years agoXFail TestCPPAuto on Windows until we can find the root problem.
Adrian McCarthy [Wed, 27 Jan 2016 17:03:25 +0000 (17:03 +0000)]
XFail TestCPPAuto on Windows until we can find the root problem.

llvm.org/pr26339

llvm-svn: 258943

8 years agoMove SafeStack to CodeGen.
Benjamin Kramer [Wed, 27 Jan 2016 16:53:42 +0000 (16:53 +0000)]
Move SafeStack to CodeGen.

It depends on the target machinery, that's not available for
instrumentation passes.

llvm-svn: 258942

8 years ago[X86][SSE] Test insertps instrinsic calls with masks that can't combine to something...
Simon Pilgrim [Wed, 27 Jan 2016 16:51:57 +0000 (16:51 +0000)]
[X86][SSE] Test insertps instrinsic calls with masks that can't combine to something simpler

For these basic tests of the intrinsic, make sure the mask can't simplify to movss, blend-with-zero or something else

llvm-svn: 258941

8 years agoRemove redundant variable.
Rafael Espindola [Wed, 27 Jan 2016 16:41:24 +0000 (16:41 +0000)]
Remove redundant variable.

llvm-svn: 258940

8 years agoRename TargetSelectionDAGInfo into SelectionDAGTargetInfo and move it to CodeGen/
Benjamin Kramer [Wed, 27 Jan 2016 16:32:26 +0000 (16:32 +0000)]
Rename TargetSelectionDAGInfo into SelectionDAGTargetInfo and move it to CodeGen/

It's a SelectionDAG thing, not a Target thing.

llvm-svn: 258939

8 years agoMove passes that live in lib/CodeGen out of Scalar.h
Benjamin Kramer [Wed, 27 Jan 2016 16:05:42 +0000 (16:05 +0000)]
Move passes that live in lib/CodeGen out of Scalar.h

llvm-svn: 258938

8 years agoMake some headers self-contained, remove unused includes that violate layering.
Benjamin Kramer [Wed, 27 Jan 2016 16:05:37 +0000 (16:05 +0000)]
Make some headers self-contained, remove unused includes that violate layering.

llvm-svn: 258937

8 years agoAMDGPU/SI: Fix commuting of 32-bit VOPC instructions
Tom Stellard [Wed, 27 Jan 2016 15:53:52 +0000 (15:53 +0000)]
AMDGPU/SI: Fix commuting of 32-bit VOPC instructions

Summary:
We didn't have entries in the commuting table for the 32-bit
instructions.  I don't think we hit this problem now, but we
will once uniform branching is enabled.  Tests will come in
a later commit.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 258936

8 years agoAdding back in a test that I inadvertently removed in r258862
Chris Bieneman [Wed, 27 Jan 2016 15:51:56 +0000 (15:51 +0000)]
Adding back in a test that I inadvertently removed in r258862

llvm-svn: 258935

8 years agoImplement modf math builtin
Tom Stellard [Wed, 27 Jan 2016 14:52:10 +0000 (14:52 +0000)]
Implement modf math builtin

V2: use the reference implementation as suggested by Matt Arsenault

Patch By: Pavel Ondračka

llvm-svn: 258933

8 years agoAdd _CLC_V_V_VP_VECTORIZE macro
Tom Stellard [Wed, 27 Jan 2016 14:52:07 +0000 (14:52 +0000)]
Add _CLC_V_V_VP_VECTORIZE macro

Patch by: Pavel Ondračka

llvm-svn: 258932

8 years ago[DebugInfo] Support zero-length CIE in the _eh_frame parser
Igor Laevsky [Wed, 27 Jan 2016 14:05:35 +0000 (14:05 +0000)]
[DebugInfo] Support zero-length CIE in the _eh_frame parser

MCJIT emits zero-length CIE at the end of the _eh_frame section. This change
ensures that parser inside DebugInfo will not crash and correctly record such cases.
We are now recording DW_EH_PE_omit as a default value for FDE and LSDA encodings.
Also Offset != EndAugmentationOffset assertion check will only happen if augmentation
string had 'z' letter in it.

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

llvm-svn: 258931

8 years agoDecorarte TestInferiorAssert xfails on AArch64 Linux
Omair Javaid [Wed, 27 Jan 2016 13:57:33 +0000 (13:57 +0000)]
Decorarte TestInferiorAssert xfails on AArch64 Linux

This patch decorates some of TestInferiorAssert test cases with expectedFailureLinux on AArch64.

llvm-svn: 258930

8 years agoReapply commit r258404 with fix
Matthew Simpson [Wed, 27 Jan 2016 13:43:27 +0000 (13:43 +0000)]
Reapply commit r258404 with fix

This patch is the second attempt to reapply commit r258404. There was bug in
the initial patch and subsequent fix (mentioned below).

The initial patch caused an assertion because we were computing smaller type
sizes for instructions that cannot be demoted. The fix first determines the
instructions that will be demoted, and then applies the smaller type size to
only those instructions.

This should fix PR26239 and PR26307.

llvm-svn: 258929

8 years agoRemove superfluous call to std::to_string that's breaking the cygwin build.
Benjamin Kramer [Wed, 27 Jan 2016 13:22:39 +0000 (13:22 +0000)]
Remove superfluous call to std::to_string that's breaking the cygwin build.

llvm-svn: 258928

8 years agoRevert "Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed."
Benjamin Kramer [Wed, 27 Jan 2016 12:44:12 +0000 (12:44 +0000)]
Revert "Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed."

and "Add a missing test case for r258847."

This reverts commit r258847, r258848. Causes miscompilations and backend
errors.

llvm-svn: 258927

8 years ago[clang-tidy] Fix documentation.
Alexander Kornienko [Wed, 27 Jan 2016 11:37:19 +0000 (11:37 +0000)]
[clang-tidy] Fix documentation.

Fixed broken links to cppcoreguidelines (anchors specified in the .md file
should be used, not automatic anchors generated by github).

Fixed formatting, array_view -> span, fixed sphinx errors in
misc-definitions-in-headers.rst.

llvm-svn: 258926

8 years ago[clang-tidy] Use relative URL for redirection.
Alexander Kornienko [Wed, 27 Jan 2016 11:37:12 +0000 (11:37 +0000)]
[clang-tidy] Use relative URL for redirection.

llvm-svn: 258925

8 years agoAdd clang-tools-extra documentation to the CMake build.
Alexander Kornienko [Wed, 27 Jan 2016 11:37:08 +0000 (11:37 +0000)]
Add clang-tools-extra documentation to the CMake build.

llvm-svn: 258924

8 years agoAdd missing build attribute regression tests for Cortex-A8
Sjoerd Meijer [Wed, 27 Jan 2016 11:34:51 +0000 (11:34 +0000)]
Add missing build attribute regression tests for Cortex-A8

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

llvm-svn: 258923

8 years agoAMDGPU/SI: Stoney has only 16 LDS banks
Marek Olsak [Wed, 27 Jan 2016 11:19:45 +0000 (11:19 +0000)]
AMDGPU/SI: Stoney has only 16 LDS banks

Summary:
This is a candidate for stable, along with all patches that add the "stoney"
processor.

Reviewers: tstellarAMD

Subscribers: arsenm

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

llvm-svn: 258922

8 years agoFix linking with LLVM_LINK_LLVM_DYLIB=ON
Pavel Labath [Wed, 27 Jan 2016 11:02:02 +0000 (11:02 +0000)]
Fix linking with LLVM_LINK_LLVM_DYLIB=ON

Linking with LLVM shared libraries currently produces linker errors.  This works around the issue
(pr24953) by disabling linking with llvm so for lldb libraries.

Patch by Evangelos Foutras.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 258921

8 years ago[libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.
Daniel Sanders [Wed, 27 Jan 2016 10:45:07 +0000 (10:45 +0000)]
[libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

Summary:
These are the tests that didn't fail in the release candidate because they were
covered by another 'REQUIRES' directive.

Reviewers: mclow.lists, hans, bcraig, EricWF

Subscribers: EricWF, dim, cfe-commits

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

llvm-svn: 258920

8 years ago[LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
Bhushan D. Attarde [Wed, 27 Jan 2016 10:16:30 +0000 (10:16 +0000)]
[LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS

    SUMMARY:
    Get the load address for the address given by symbol and function.
    Earlier, this was done for function only, this patch does it for symbol too.
    This patch also adds TestAvoidBreakpointInDelaySlot.py to test this change.

    Reviewers: clayborg
    Subscribers: labath, zturner, mohit.bhakkad, sagar, jaydeep, lldb-commits
    Differential Revision: http://reviews.llvm.org/D16049

llvm-svn: 258919

8 years agoUpdate for LLVM change.
Benjamin Kramer [Wed, 27 Jan 2016 10:01:30 +0000 (10:01 +0000)]
Update for LLVM change.

llvm-svn: 258918

8 years agoMove MCTargetAsmParser.h to llvm/MC/MCParser where it belongs.
Benjamin Kramer [Wed, 27 Jan 2016 10:01:28 +0000 (10:01 +0000)]
Move MCTargetAsmParser.h to llvm/MC/MCParser where it belongs.

llvm-svn: 258917

8 years ago[compiler-rt] list_union() is actually an intersect operation. Rename it.
Daniel Sanders [Wed, 27 Jan 2016 09:28:01 +0000 (09:28 +0000)]
[compiler-rt] list_union() is actually an intersect operation. Rename it.

Summary:
Given:
  set(T1 a b c)
  set(T2 b c d)
  message("T1=${T1}")
  message("T2=${T2}")
  list_union(T3 T1 T2)
  message("T3=${T3}")
cmake emitted:
  T1=a;b;c
  T2=b;c;d
  T3=b;c

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 258916

8 years agoAVX512: Fix vpmovzxbw predicate for AVX1/2 instructions.
Igor Breger [Wed, 27 Jan 2016 08:57:46 +0000 (08:57 +0000)]
AVX512: Fix vpmovzxbw predicate for AVX1/2 instructions.

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

llvm-svn: 258915

8 years agoAVX512: Add store mask patterns.
Igor Breger [Wed, 27 Jan 2016 08:43:25 +0000 (08:43 +0000)]
AVX512: Add store mask patterns.

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

llvm-svn: 258914

8 years agoFix a bug in test case (both ir,fe instr were turned on
Xinliang David Li [Wed, 27 Jan 2016 07:42:41 +0000 (07:42 +0000)]
Fix a bug in test case (both ir,fe instr were turned on

llvm-svn: 258913

8 years ago[IndVarSimplify] Rewrite loop exit values with their initial values from loop preheader
Chen Li [Wed, 27 Jan 2016 07:40:41 +0000 (07:40 +0000)]
[IndVarSimplify] Rewrite loop exit values with their initial values from loop preheader

Summary:
This is a revised version of D13974, and the following quoted summary are from D13974

"This patch adds support to check if a loop has loop invariant conditions which lead to loop exits. If so, we know that if the exit path is taken, it is at the first loop iteration. If there is an induction variable used in that exit path whose value has not been updated, it will keep its initial value passing from loop preheader. We can therefore rewrite the exit value with
its initial value. This will help remove phis created by LCSSA and enable other optimizations like loop unswitch."

D13974 was committed but failed one lnt test. The bug was that we only checked the condition from loop exit's incoming block was a loop invariant. But there could be another condition from loop header to that incoming block not being a loop invariant. This would produce miscompiled code.

This patch fixes the issue by checking if the incoming block is loop header, and if not, don't perform the rewrite. The could be further improved by recursively checking all conditions leading to loop exit block, but I'd like to check in this simple version first and improve it with future patches.

Reviewers: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 258912

8 years agoFix array index out of bounds
Daniel Marjamaki [Wed, 27 Jan 2016 07:33:50 +0000 (07:33 +0000)]
Fix array index out of bounds

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

llvm-svn: 258911

8 years agoChange whitespace to test commit access
Jonas Hahnfeld [Wed, 27 Jan 2016 07:24:03 +0000 (07:24 +0000)]
Change whitespace to test commit access

llvm-svn: 258910

8 years ago[SLPVectorizer] Swap the checking order of isCommutative and isConsecutiveAccess
Haicheng Wu [Wed, 27 Jan 2016 04:59:05 +0000 (04:59 +0000)]
[SLPVectorizer] Swap the checking order of isCommutative and isConsecutiveAccess

NFC

llvm-svn: 258909

8 years agoSmallPtrSet: Inline the part of insert_imp in the small case
Matthias Braun [Wed, 27 Jan 2016 04:20:24 +0000 (04:20 +0000)]
SmallPtrSet: Inline the part of insert_imp in the small case

Most of the time we only hit the small case, so it is beneficial to pull
it out of the insert_imp() implementation. This improves compile time
at least for non-LTO builds.

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

llvm-svn: 258908

8 years agoFunction: Slightly simplify code by using existing hasFnAttribute() convenience function
Matthias Braun [Wed, 27 Jan 2016 03:45:25 +0000 (03:45 +0000)]
Function: Slightly simplify code by using existing hasFnAttribute() convenience function

llvm-svn: 258907

8 years ago[Coverage] Fix more bugs in covmap V1 documentation
Xinliang David Li [Wed, 27 Jan 2016 03:13:09 +0000 (03:13 +0000)]
[Coverage] Fix more bugs in covmap V1 documentation

llvm-svn: 258906

8 years agoRevert "Revert "[SimplifyCFG] allow speculation of exactly one expensive instruction...
David Majnemer [Wed, 27 Jan 2016 02:59:41 +0000 (02:59 +0000)]
Revert "Revert "[SimplifyCFG] allow speculation of exactly one expensive instruction (PR24818)""

This reverts commit r258903 which reverted r255660.  r258903 was an
accidental commit and should not have been committed.

llvm-svn: 258905

8 years ago[SimplifyCFG] Don't mistake icmp of and for a tree of comparisons
David Majnemer [Wed, 27 Jan 2016 02:43:28 +0000 (02:43 +0000)]
[SimplifyCFG] Don't mistake icmp of and for a tree of comparisons

SimplifyCFG tries to turn complex branch conditions into a switch.
Some of it's logic attempts to reason about bitwise arithmetic produced
by InstCombine.  InstCombine can turn things like (X == 2) || (X == 3)
into (X & 1) == 2 and so SimplifyCFG tries to detect when this occurs so
that it can produce a switch instruction.

However, the legality checking was not sufficient to determine whether
or not this had occured.  Correctly check this case by requiring that
the right-hand side of the comparison be a power of two.

This fixes PR26323.

llvm-svn: 258904

8 years agoRevert "[SimplifyCFG] allow speculation of exactly one expensive instruction (PR24818)"
David Majnemer [Wed, 27 Jan 2016 02:43:22 +0000 (02:43 +0000)]
Revert "[SimplifyCFG] allow speculation of exactly one expensive instruction (PR24818)"

This reverts commit r255660.

llvm-svn: 258903

8 years agoAdding a test for PR25717.
Yunzhong Gao [Wed, 27 Jan 2016 02:18:28 +0000 (02:18 +0000)]
Adding a test for PR25717.

The test tries to produce a large preprocessed output to the console, and checks
that we do not see any unexpected fatal errors.

The test is not enabled unless a lit parameter "--param enable_console=1" is
passed on the command line to lit.py.

llvm-svn: 258902

8 years agoAMDGPU: Fix default device handling
Matt Arsenault [Wed, 27 Jan 2016 02:17:49 +0000 (02:17 +0000)]
AMDGPU: Fix default device handling

When no device name is specified, default to kaveri
for HSA since SI is not supported and it woud fail.

Default to "tahiti" instead of "SI" since these are
effectively the same, and tahiti is an actual device.

Move default device handling to the TargetMachine
rather than the AMDGPUSubtarget. The module ISA version
is computed from the device name provided with the target
machine, so the attributes printed by the AsmPrinter were
inconsistent with those computed in the subtarget.

Also remove DevName field from subtarget since it's redundant
with getCPU() in the superclass.

llvm-svn: 258901

8 years ago[libcxx] Remove -Wpadded from buildit script.
Akira Hatanaka [Wed, 27 Jan 2016 01:55:11 +0000 (01:55 +0000)]
[libcxx] Remove -Wpadded from buildit script.

Per discussion with Eric and Joerg, this commit removes -Wpadded to
silence the warning about the padding inserted at the tail of struct
_Rep_base.

rdar://problem/23932550

llvm-svn: 258900

8 years ago[cmake] Remove /Og- flag which was working around PR24785
Reid Kleckner [Wed, 27 Jan 2016 01:52:46 +0000 (01:52 +0000)]
[cmake] Remove /Og- flag which was working around PR24785

With r258897, MSVC 2013 now successfully compiles Function.cpp.

llvm-svn: 258899

8 years agoAdd "/dev/tty" as a special file name for lit tests.
Yunzhong Gao [Wed, 27 Jan 2016 01:48:20 +0000 (01:48 +0000)]
Add "/dev/tty" as a special file name for lit tests.

If a lit test has a RUN line that includes a redirection to "/dev/tty", the
redirection goes to the special device file corresponding to the console. It
is /dev/tty on UNIX-like systems and "CON" on Windows.

This patch is needed to implement a test like PR25717 (caused by the size limit
of the Windows system call WriteConsole() prior to Windows 8) where the test
only breaks when outputing to the console and won't fail if using a pipe.

llvm-svn: 258898

8 years ago[llvm-tblgen] Avoid StringMatcher for GCC and MS builtin names
Reid Kleckner [Wed, 27 Jan 2016 01:43:12 +0000 (01:43 +0000)]
[llvm-tblgen] Avoid StringMatcher for GCC and MS builtin names

This brings the compile time of Function.cpp from ~40s down to ~4s for
me locally. It also shaves off about 400KB of object file size in a
release+asserts build.

I also realized that the AMDGPU backend does not have any GCC builtin
names to match, so the extra lookup was a no-op. I removed it to silence
a zero-length string table array warning. There should be no functional
change here.

This change really ends the story of PR11951.

llvm-svn: 258897

8 years ago[analyzer] ObjCDeallocChecker: Only operate on classes with retained properties.
Devin Coughlin [Wed, 27 Jan 2016 01:41:58 +0000 (01:41 +0000)]
[analyzer] ObjCDeallocChecker: Only operate on classes with retained properties.

Previously the ObjC Dealloc Checker only checked classes with ivars, not
retained properties, which caused three bugs:

- False positive warnings about a missing -dealloc method in classes with only
ivars.
- Missing warnings about a missing -dealloc method on classes with only
properties.
- Missing warnings about an over-released or under-released ivar associated with
a retained property in classes with only properties.

The fix is to check only classes with at least one retained synthesized
property.

This also exposed a bug when reporting an over-released or under-released
property that did not contain a synthesize statement. The checker tried to
associate the warning with an @synthesize statement that did not exist, which
caused an assertion failure in debug builds. The fix is to fall back to the
@property statement in this case.

A patch by David Kilzer!

Part of rdar://problem/6927496

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

llvm-svn: 258896

8 years ago[WebAssembly] Add a test for the mem-intrinsic code in WebAssemblyPeephole.cpp
Dan Gohman [Wed, 27 Jan 2016 01:37:52 +0000 (01:37 +0000)]
[WebAssembly] Add a test for the mem-intrinsic code in WebAssemblyPeephole.cpp

llvm-svn: 258895

8 years agoRevert "Change of UserLabelPrefix default value from "_" to """
James Y Knight [Wed, 27 Jan 2016 01:04:51 +0000 (01:04 +0000)]
Revert "Change of UserLabelPrefix default value from "_" to """

This reverts commit r258504.

This commit breaks (at least) sparc-rtems -- the OS (RTEMS) used to
override UserLabelPrefix to "", despite the arch (SPARC) having set it
to "_". Now, the OS doesn't override anymore, but the arch sets it to
"_", resulting in the wrong value. I expect this probably breaks other
OSes that overrode to "" before, as well. (Clearly we have some missing
test cases, here...)

llvm-svn: 258894

8 years agoFix broken commit r258888. I missed adding two pointer conversions
Eric Fiselier [Wed, 27 Jan 2016 00:49:20 +0000 (00:49 +0000)]
Fix broken commit r258888. I missed adding two pointer conversions

llvm-svn: 258893

8 years agotest-release.sh: Ignore LC_CTYPE in sed invocation on Darwin
Hans Wennborg [Wed, 27 Jan 2016 00:19:05 +0000 (00:19 +0000)]
test-release.sh: Ignore LC_CTYPE in sed invocation on Darwin

Here, sed is used to prepare object files for comparison via cmp. On my Darwin
15.4.0 machine, LC_CTYPE is set to UTF-8 (by default, I believe). Under these
circumstances, anything sed is made to read will be treated as UTF-8, prompting
it to signal an error if it is not, like so:

% sed s/a/b/ <(head -n1 /dev/random) >/dev/null; echo $?
sed: RE error: illegal byte sequence
1
%

To make sed work as expected, I need to set LC_CTYPE to C:

% env LC_CTYPE=C sed s/a/b/ <(head -n1 /dev/random) >/dev/null; echo $?
0
%

Without this change, sed will exit with an error for every single file that it
compares between phase 2 and phase 3, thereby making it look as if the
differences were far larger than they are.

Patch by Elias Pipping!

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

llvm-svn: 258891

8 years agoSync up with master file
Xinliang David Li [Wed, 27 Jan 2016 00:14:15 +0000 (00:14 +0000)]
Sync up with master file

llvm-svn: 258890

8 years ago[PGO] Make header portable for C /NFC
Xinliang David Li [Wed, 27 Jan 2016 00:13:39 +0000 (00:13 +0000)]
[PGO] Make header portable for C /NFC

llvm-svn: 258889

8 years ago[libcxx] Fix undefined behavior in forward_list
Eric Fiselier [Wed, 27 Jan 2016 00:11:54 +0000 (00:11 +0000)]
[libcxx] Fix undefined behavior in forward_list

Summary:
This patch is similar to the <list> fix but it has a few differences. This patch doesn't use a `__link_pointer` typedef because we don't need to change the linked list pointers because `forward_list` never stores a  `__forward_begin_node` in the linked list itself.

The issue with `forward_list` is that the iterators store pointers to `__forward_list_node` and not `__forward_begin_node`. This is incorrect because `before_begin()` and `cbefore_begin()` return iterators that point to a `__forward_begin_node`. This means we incorrectly downcast the `__forward_begin_node` pointer to a `__node_pointer`. This downcast itself is sometimes UB but it cannot be safely removed until ABI v2. The more common cause of UB is when we deference the downcast pointer. (for example `__ptr_->__next_`). This can be fixed without an ABI break by upcasting `__ptr_` before accessing it.

The fix is as follows:

1. Introduce a `__iter_node_pointer` typedef that works  similar to `__link_pointer` in the last patch. In ABI v2 it is always a typedef for `__begin_node_pointer`.
2. Change the `__before_begin()` method to return the correct pointer type (`__begin_node_pointer`),
    Previously it incorrectly downcasted  the  `__forward_begin_node` to a `__node_pointer`  so it could be used to constructor the iterator types.
3. Change `__forward_list_iterator` and `__forward_list_const_iterator`  in the following way:
    1. Change `__node_pointer __ptr_;` member to  have the `__iter_node_pointer` type instead.
    2. Add additional private constructors that accept `__begin_node_pointer` in addition to `__node_pointer` and then correctly cast them to the stored `__iter_node_pointer` type.
    3. Add  `__get_begin()` and `__get_node_unchecked()` accessor methods that correctly cast `__ptr_` to the expected pointer type. `__get_begin()` is always safe to use and should be
       preferred. `__get_node_unchecked()` can only be used on a deferencible iterator.
4. Replace direct access to `__forward_list_iterator::__ptr_`  with the safe accessor methods.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 258888

8 years ago[analyzer] Body farm: Look for property ivar in shadowing readwrite property.
Devin Coughlin [Tue, 26 Jan 2016 23:58:48 +0000 (23:58 +0000)]
[analyzer] Body farm: Look for property ivar in shadowing readwrite property.

After r251874, readonly properties that are shadowed by a readwrite property
in a class extension no longer have an instance variable, which caused the body
farm to not synthesize getters. Now, if a readonly property does not have an
instance variable look for a shadowing property and try to get the instance
variable from there.

rdar://problem/24060091

llvm-svn: 258886

8 years agoDisable all standard lib functions for NVVM.
Justin Lebar [Tue, 26 Jan 2016 23:51:06 +0000 (23:51 +0000)]
Disable all standard lib functions for NVVM.

Summary:
NVVM doesn't have a standard library, as currently implemented, so this
just isn't going to work.  I'd like to revisit this, since it's hiding
opportunities for optimization, but correctness comes first.

Thank you to hfinkel for pointing me in the right direction here.

Reviewers: tra

Subscribers: echristo, jhen, llvm-commits, hfinkel

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

llvm-svn: 258884

8 years agoFix identify_magic() to check that a file that starts with MH_MAGIC is
Kevin Enderby [Tue, 26 Jan 2016 23:43:37 +0000 (23:43 +0000)]
Fix identify_magic() to check that a file that starts with MH_MAGIC is
at least as big as the mach header to be identified as a Mach-O file and
make sure smaller files are not identified as a Mach-O files but as
unknown files. Also fix identify_magic() so it looks at all 4 bytes of
the filetype field when determining the type of the Mach-O file.
Then fix the macho-invalid-header test case to check that it is an
unknown file and make sure it does not get the error for
object_error::parse_failed.  And also update the unit tests.

llvm-svn: 258883

8 years ago[GVN] Split AvailableValueInBlock into two parts [NFC]
Philip Reames [Tue, 26 Jan 2016 23:43:16 +0000 (23:43 +0000)]
[GVN] Split AvailableValueInBlock into two parts [NFC]

AvailableValue is the part that represents the potential rematerialization.  AvailableValueInBlock is simply a pair of an AvailableValue and a BB which we might materialize it in.

This is motivated by http://reviews.llvm.org/D16608.  The intent is that we'll have a single function which handles the local case which both local and non-local will use to identify available values.  Once that's done, the local case can rematerialize at the use site and the non-local case can do the SSA construction as it does currently.

llvm-svn: 258882

8 years ago[cfi] Exclude __cfi_slowpath_diag from the non-diag rtl.
Evgeniy Stepanov [Tue, 26 Jan 2016 23:42:41 +0000 (23:42 +0000)]
[cfi] Exclude __cfi_slowpath_diag from the non-diag rtl.

Calls to __cfi_slowpath_diag are only emitted when building with
diagnostics, and linking the diag rtl.

llvm-svn: 258881

8 years ago[CUDA] Implemented device-side support functions in <cmath>.
Artem Belevich [Tue, 26 Jan 2016 23:37:29 +0000 (23:37 +0000)]
[CUDA] Implemented device-side support functions in <cmath>.

CUDA expects math functions in std:: namespace to work on device side.
In order to make it work with clang without allowing device-side code
generation for functions w/o appropriate target attributes, this patch
provides device-side implementations for <cmath> functions. Most of
them call global-scope math functions provided by CUDA headers. In few
cases we use clang builtins.

Tested out-of tree by compiling and running thrust's unit_tests.
https://github.com/thrust/thrust/tree/master/testing

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

llvm-svn: 258880

8 years ago[cfi] Better handling of wild target address.
Evgeniy Stepanov [Tue, 26 Jan 2016 23:36:28 +0000 (23:36 +0000)]
[cfi] Better handling of wild target address.

This change enables diagnostics when the target address for a CFI
check is out of bounds of any known library, or even not in the
limits of the address space. This happens when casting pointers to
uninitialized memory.

Ubsan code does not yet handle some of these situations correctly,
so it is still possible to see a segmentation fault instead of a
proper diagnostic message once in a while.

llvm-svn: 258879

8 years ago[docs] Fix a typo
Sanjoy Das [Tue, 26 Jan 2016 23:26:25 +0000 (23:26 +0000)]
[docs] Fix a typo

llvm-svn: 258878

8 years ago[WinEH] Annotate calls to __RTtypeid with a funclet bundle
David Majnemer [Tue, 26 Jan 2016 23:14:47 +0000 (23:14 +0000)]
[WinEH] Annotate calls to __RTtypeid with a funclet bundle

Clang's CodeGen has several paths which end up invoking or calling a
function. The one that we used for calls to __RTtypeid did not
appropriately annotate the call with a funclet bundle.

This fixes PR26329.

llvm-svn: 258877

8 years ago[PGO] allow pgo name collector to disable compression (for testing)/NFC
Xinliang David Li [Tue, 26 Jan 2016 23:13:00 +0000 (23:13 +0000)]
[PGO] allow pgo name collector to disable compression (for testing)/NFC

llvm-svn: 258876

8 years ago[llvm-tblgen] Stop emitting the intrinsic name matching code
Reid Kleckner [Tue, 26 Jan 2016 23:01:21 +0000 (23:01 +0000)]
[llvm-tblgen] Stop emitting the intrinsic name matching code

The AMDGPU backend was the last user of the old StringMatcher
recognition code. Move it over to the new lookupLLVMIntrinsicName
funciton, which is now improved to handle all of the interesting edge
cases exposed by AMDGPU intrinsic names.

llvm-svn: 258875

8 years ago[sanitizers] execve & waitpid on mac.
Mike Aizatsky [Tue, 26 Jan 2016 22:53:52 +0000 (22:53 +0000)]
[sanitizers] execve & waitpid on mac.

llvm-svn: 258874

8 years agoFixing the documentation builds
Chris Bieneman [Tue, 26 Jan 2016 22:53:12 +0000 (22:53 +0000)]
Fixing the documentation builds

I broke the documentation builds when I deleted the MakefileGuide as part of the autoconf removal. At some point I'll need to do a more in-depth pass updating the documentation to remove references to the old build system.

llvm-svn: 258873

8 years ago[WebAssembly] Omit no-op adds for non-mem uses of FrameIndex
Derek Schuff [Tue, 26 Jan 2016 22:47:43 +0000 (22:47 +0000)]
[WebAssembly] Omit no-op adds for non-mem uses of FrameIndex

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

llvm-svn: 258872

8 years agoHandle more edge cases in intrinsic name binary search
Reid Kleckner [Tue, 26 Jan 2016 22:33:19 +0000 (22:33 +0000)]
Handle more edge cases in intrinsic name binary search

I tried to make the AMDGPU intrinsic info table use this instead of
another StringMatcher, and some issues arose.

llvm-svn: 258871

8 years agoFix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserter...
Eugene Zelenko [Tue, 26 Jan 2016 22:32:24 +0000 (22:32 +0000)]
Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes.

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

llvm-svn: 258870

8 years ago[X86][SSE] Added 8i8 to 8i64 sext/zext tests
Simon Pilgrim [Tue, 26 Jan 2016 22:19:22 +0000 (22:19 +0000)]
[X86][SSE] Added 8i8 to 8i64 sext/zext tests

llvm-svn: 258868

8 years ago[x86] make the subtarget member a const reference, not a pointer ; NFCI
Sanjay Patel [Tue, 26 Jan 2016 22:08:58 +0000 (22:08 +0000)]
[x86] make the subtarget member a const reference, not a pointer ; NFCI

It's passed in as a reference; it's not optional; it's not a pointer.

llvm-svn: 258867

8 years ago[OMPT]: Fix the order of implicit_task_end_events
Jonathan Peyton [Tue, 26 Jan 2016 21:45:21 +0000 (21:45 +0000)]
[OMPT]: Fix the order of implicit_task_end_events

For implcit barriers in simple parallel for loops, the order of the OMPT events
was wrong.  The barrier_{begin,end} events came after the implcit_task_end
event for the implcit barrier at the end of the parallel region. This is wrong
because the implicit task executes the barrier before ending. This patch fixes
the order of the event: It will be triggerd now just before
__kmp_pop_current_task_from_thread() is called.

Patch by Tim Cramer

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

llvm-svn: 258866

8 years ago[X86] Add support for zeroed shuffle elements to getShuffleScalarElt
Simon Pilgrim [Tue, 26 Jan 2016 21:39:25 +0000 (21:39 +0000)]
[X86] Add support for zeroed shuffle elements to getShuffleScalarElt

Enable handling of SM_SentinelZero shuffle elements to getShuffleScalarElt. Improves VZEXT_LOAD matches in EltsFromConsecutiveLoads.

llvm-svn: 258865

8 years agoRemove autoconf support
Chris Bieneman [Tue, 26 Jan 2016 21:31:36 +0000 (21:31 +0000)]
Remove autoconf support

Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"Now I am become Death, the destroyer of worlds."
-J. Robert Oppenheimer

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: cfe-commits, klimek

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

llvm-svn: 258864

8 years agoRemove autoconf support for building runtime libraries.
Chris Bieneman [Tue, 26 Jan 2016 21:31:12 +0000 (21:31 +0000)]
Remove autoconf support for building runtime libraries.

Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

    "I am the punishment of God... If [autoconf] had not committed great sins, God would not have sent a punishment like me upon [it]."
    -Genghis Khan

Reviewers: chandlerc, grosbach, bob.wilson, zaks.anna, kubabrecka, samsonov, echristo

Subscribers: iains, llvm-commits

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

llvm-svn: 258863

8 years agoRemove autoconf support
Chris Bieneman [Tue, 26 Jan 2016 21:30:40 +0000 (21:30 +0000)]
Remove autoconf support

Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

    "This is the way [autoconf] ends
    Not with a bang but a whimper."
    -T.S. Eliot

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: klimek, cfe-commits

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

llvm-svn: 258862

8 years agoRemove autoconf support
Chris Bieneman [Tue, 26 Jan 2016 21:29:08 +0000 (21:29 +0000)]
Remove autoconf support

Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

llvm-svn: 258861

8 years ago[WebAssembly] Remove check for FrameIndex operands in WebAssemblyPeephole
Derek Schuff [Tue, 26 Jan 2016 21:08:27 +0000 (21:08 +0000)]
[WebAssembly] Remove check for FrameIndex operands in WebAssemblyPeephole

This pass runs after FrameIndex elimination, so it should never see FI
operands. NFC

llvm-svn: 258860

8 years ago[cfi] Hide runtime implementation in a namespace.
Evgeniy Stepanov [Tue, 26 Jan 2016 21:06:26 +0000 (21:06 +0000)]
[cfi] Hide runtime implementation in a namespace.

Move all internal stuff into namespace __cfi.
Remove the double underscore prefix from anything that's now inside
the namespace.

llvm-svn: 258859

8 years ago[x86] add materializeVectorConstant() helper function; NFC
Sanjay Patel [Tue, 26 Jan 2016 21:05:00 +0000 (21:05 +0000)]
[x86] add materializeVectorConstant() helper function; NFC

LowerBUILD_VECTOR is still over 300 lines long, but it's a start...

llvm-svn: 258858

8 years ago[cfi] Support for dlopen and dlclose.
Evgeniy Stepanov [Tue, 26 Jan 2016 20:53:09 +0000 (20:53 +0000)]
[cfi] Support for dlopen and dlclose.

Add dlopen/dlclose interceptors to update CFI shadow for loaded/unloaded libraries.

llvm-svn: 258857

8 years agoFix comparison warning (r258845)
Hemant Kulkarni [Tue, 26 Jan 2016 20:38:15 +0000 (20:38 +0000)]
Fix comparison warning (r258845)

llvm-svn: 258856

8 years agoRemove dead code missed in r258852.
Eric Fiselier [Tue, 26 Jan 2016 20:31:01 +0000 (20:31 +0000)]
Remove dead code missed in r258852.

llvm-svn: 258855

8 years agoFixes build break introduced by r258845
Hemant Kulkarni [Tue, 26 Jan 2016 20:28:15 +0000 (20:28 +0000)]
Fixes build break introduced by r258845

llvm-svn: 258854

8 years agoWebAssembly NFC: update error message
JF Bastien [Tue, 26 Jan 2016 20:24:51 +0000 (20:24 +0000)]
WebAssembly NFC: update error message

I forgot to update this one in my previous patch.

llvm-svn: 258853

8 years agoFix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael...
Eric Fiselier [Tue, 26 Jan 2016 20:24:30 +0000 (20:24 +0000)]
Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.

llvm-svn: 258852

8 years agoWebAssembly: don't optimize memcpy/memmove/memcpy to frame index
JF Bastien [Tue, 26 Jan 2016 20:22:42 +0000 (20:22 +0000)]
WebAssembly: don't optimize memcpy/memmove/memcpy to frame index

r258781 optimized memcpy/memmove/memcpy so the intrinsic call can return its first argument, but missed the frame index case. Teach it to ignore that case so C code doesn't assert out in these cases.

llvm-svn: 258851

8 years agoDo not define GXX_RTTI macro for C.
Yunzhong Gao [Tue, 26 Jan 2016 20:15:02 +0000 (20:15 +0000)]
Do not define GXX_RTTI macro for C.
This is same as GCC behavior (tested with GCC 4.8.2).

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

llvm-svn: 258850

8 years ago[sanitizers] extracted process management functions
Mike Aizatsky [Tue, 26 Jan 2016 20:10:01 +0000 (20:10 +0000)]
[sanitizers] extracted process management functions

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

llvm-svn: 258849

8 years agoAdd a missing test case for r258847.
Cong Hou [Tue, 26 Jan 2016 20:09:38 +0000 (20:09 +0000)]
Add a missing test case for r258847.

llvm-svn: 258848

8 years agoAllow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed.
Cong Hou [Tue, 26 Jan 2016 20:08:01 +0000 (20:08 +0000)]
Allow X86::COND_NE_OR_P and X86::COND_NP_OR_E to be reversed.

Currently, AnalyzeBranch() fails non-equality comparison between floating points
on X86 (see https://llvm.org/bugs/show_bug.cgi?id=23875). This is because this
function can modify the branch by reversing the conditional jump and removing
unconditional jump if there is a proper fall-through. However, in the case of
non-equality comparison between floating points, this can turn the branch
"unanalyzable". Consider the following case:

jne.BB1
jp.BB1
jmp.BB2
.BB1:
...
.BB2:
...

AnalyzeBranch() will reverse "jp .BB1" to "jnp .BB2" and then "jmp .BB2" will be
removed:

jne.BB1
jnp.BB2
.BB1:
...
.BB2:
...

However, AnalyzeBranch() cannot analyze this branch anymore as there are two
conditional jumps with different targets. This may disable some optimizations
like block-placement: in this case the fall-through behavior is enforced even if
the fall-through block is very cold, which is suboptimal.

Actually this optimization is also done in block-placement pass, which means we
can remove this optimization from AnalyzeBranch(). However, currently
X86::COND_NE_OR_P and X86::COND_NP_OR_E are not reversible: there is no defined
negation conditions for them.

In order to reverse them, this patch defines two new CondCode X86::COND_E_AND_NP
and X86::COND_P_AND_NE. It also defines how to synthesize instructions for them.
Here only the second conditional jump is reversed. This is valid as we only need
them to do this "unconditional jump removal" optimization.

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

llvm-svn: 258847

8 years ago[llvm-nm] Roll several conditions into a single if. NFCI.
Davide Italiano [Tue, 26 Jan 2016 19:57:42 +0000 (19:57 +0000)]
[llvm-nm] Roll several conditions into a single if.  NFCI.

llvm-svn: 258846

8 years ago[llvm-readobj] Add -elf-section-groups option
Hemant Kulkarni [Tue, 26 Jan 2016 19:46:39 +0000 (19:46 +0000)]
[llvm-readobj] Add -elf-section-groups option

Adds a way to inspect SHT_GROUP sections in ELF objects.
Displays signature, member sections of these sections.

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

llvm-svn: 258845

8 years agoBypass Perl modules in build system
Jonathan Peyton [Tue, 26 Jan 2016 19:44:31 +0000 (19:44 +0000)]
Bypass Perl modules in build system

This change fixes the bug: https://llvm.org/bugs/show_bug.cgi?id=25975
by bypassing the perl module files which try to deduce system information.
These perl modules files don't offer useful information and are from the
original build system. They can be removed after this change.

llvm-svn: 258843

8 years ago[ScheduleDAGInstrs] Simplify logic to improve readability. NFC.
Chad Rosier [Tue, 26 Jan 2016 19:33:57 +0000 (19:33 +0000)]
[ScheduleDAGInstrs] Simplify logic to improve readability. NFC.

The call to isInvariantLoad() already returns false for non-load instructions.

llvm-svn: 258841