7 years ago[CMake] llvm/test/YAMLParser requires yaml-bench. This fixes r236754.
NAKAMURA Takumi [Thu, 7 May 2015 22:24:58 +0000 (22:24 +0000)]
[CMake] llvm/test/YAMLParser requires yaml-bench. This fixes r236754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236787 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call init"
Ismail Pazarbasi [Thu, 7 May 2015 22:17:48 +0000 (22:17 +0000)]
Revert "SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call init"

Will fix tomorrow. Unbreak build bots now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236786 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typo.
Matthias Braun [Thu, 7 May 2015 22:16:10 +0000 (22:16 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236785 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoClear kill flags in tail duplication.
Pete Cooper [Thu, 7 May 2015 21:48:26 +0000 (21:48 +0000)]
Clear kill flags in tail duplication.

If we duplicate an instruction then we must also clear kill flags on any uses we rewrite.
Otherwise we might be killing a register which was used in other BBs.

For example, here the entry BB ended up with these instructions, the ADD having been tail duplicated.

%vreg24<def> = t2ADDri %vreg10<kill>, 1, pred:14, pred:%noreg, opt:%noreg; GPRnopc:%vreg24 rGPR:%vreg10
%vreg22<def> = COPY %vreg10; GPR:%vreg22 rGPR:%vreg10

The copy here is inserted after the add and so needs vreg10 to be live.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236782 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWhen checking msan.module_ctor, use CHECK-LABEL instead of CHECK
Ismail Pazarbasi [Thu, 7 May 2015 21:47:25 +0000 (21:47 +0000)]
When checking msan.module_ctor, use CHECK-LABEL instead of CHECK

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236781 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSanitizerCoverage: Use `createSanitizerCtor` to create ctor and call init
Ismail Pazarbasi [Thu, 7 May 2015 21:43:28 +0000 (21:43 +0000)]
SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call init

Reviewers: kcc, samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236780 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMSan: Use `createSanitizerCtor` to create ctor, and call `__msan_init`
Ismail Pazarbasi [Thu, 7 May 2015 21:41:52 +0000 (21:41 +0000)]
MSan: Use `createSanitizerCtor` to create ctor, and call `__msan_init`

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236779 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTSan: Use `createSanitizerCtor` to create ctor, and call `__tsan_init`
Ismail Pazarbasi [Thu, 7 May 2015 21:41:23 +0000 (21:41 +0000)]
TSan: Use `createSanitizerCtor` to create ctor, and call `__tsan_init`

Reviewers: kcc, dvyukov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236778 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoASan: Use `createSanitizerCtor` to create ctor, and call `__asan_init`
Ismail Pazarbasi [Thu, 7 May 2015 21:40:46 +0000 (21:40 +0000)]
ASan: Use `createSanitizerCtor` to create ctor, and call `__asan_init`

Reviewers: kcc, samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236777 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange getTargetNodeName() to produce compiler warnings for missing cases, fix them
Matthias Braun [Thu, 7 May 2015 21:33:59 +0000 (21:33 +0000)]
Change getTargetNodeName() to produce compiler warnings for missing cases, fix them

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236775 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Fuzzer] change the way we use taint information for fuzzing. Now, we run a singl...
Kostya Serebryany [Thu, 7 May 2015 21:02:11 +0000 (21:02 +0000)]
[lib/Fuzzer] change the way we use taint information for fuzzing. Now, we run a single unit and collect suggested mutations based on tracing+taint data, then apply the suggested mutations one by one. The previous scheme was slower and more complex.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236772 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse auto instead of the long type name. NFC.
Steven Wu [Thu, 7 May 2015 19:56:23 +0000 (19:56 +0000)]
Use auto instead of the long type name. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236768 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Fix sext/zext folding in address arithmetic.
Pete Cooper [Thu, 7 May 2015 19:21:36 +0000 (19:21 +0000)]
[AArch64] Fix sext/zext folding in address arithmetic.

We were accidentally folding a sign/zero extend in to address arithmetic in a different BB when the extend wasn't available there.

Cross BB fast-isel isn't safe, so restrict this to only when the extend is in the same BB as the use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236764 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix r236754: Add the missing yaml-bench dir to the makefile for utils.
Alex Lorenz [Thu, 7 May 2015 18:48:48 +0000 (18:48 +0000)]
Fix r236754: Add the missing yaml-bench dir to the makefile for utils.

This commit adds the missing yaml-bench utility to the
makefile in utils. It was missing before and it caused
the regression tests to fail on some buildbots when llvm-lit
couldn't find yaml-bench when llvm was built without
cmake after I committed r236754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236761 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDisable r235989 "Reapply r235977 "[DebugInfo] Add debug locations to constant SD...
Sergey Dmitrouk [Thu, 7 May 2015 18:33:50 +0000 (18:33 +0000)]
Disable r235989 "Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes""

Will be re-enabled with missing changes for ConstantFPSDNode and
fixes for wrong locations due to constant coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236758 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Fuzzer] minor refactoring/simplification, NFC
Kostya Serebryany [Thu, 7 May 2015 18:32:29 +0000 (18:32 +0000)]
[lib/Fuzzer] minor refactoring/simplification, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236757 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd VSX Scalar loads and stores to the PPC back end
Nemanja Ivanovic [Thu, 7 May 2015 18:24:05 +0000 (18:24 +0000)]
Add VSX Scalar loads and stores to the PPC back end

This patch corresponds to review:

It adds a new register class to the PPC back end to contain single precision
values in VSX registers. Additionally, it adds scalar loads and stores for
VSX registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236755 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoYAML: Enable the YAMLParser tests.
Alex Lorenz [Thu, 7 May 2015 18:08:46 +0000 (18:08 +0000)]
YAML: Enable the YAMLParser tests.

This commit enables the tests located in test/YAMLParser directory.
Those tests were never actually enabled, as llvm-lit didn't pick up the
files with the 'data' extension. The commit renames those test files to files
with the 'test' extension so that llvm-lit would find them.

This commit also modifies yaml-bench so that it returns an error status
if an error occurred during parsing. It also adds the '-use-color'
command line option to yaml-bench (to make sure that file check matches
the error messages in the output stream).

This commit modifies some of the renamed tests so that they wouldn't
fail. It gets rid of XFAILs and uses the 'not' command instead for
some of the tests that have to fail during parsing. This commit
also adds some 'FIXME' comments to a couple of tests that are
supposed to fail but currently pass because of various bugs
in the implementation of the yaml parser.

Reviewers: Justin Bogner

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236754 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRecommit r236670: [opaque pointer type] Pass explicit pointer type through GEP consta...
David Blaikie [Thu, 7 May 2015 17:28:58 +0000 (17:28 +0000)]
Recommit r236670: [opaque pointer type] Pass explicit pointer type through GEP constant folding""

Clang regressions were caused by more stringent assertion checking
introduced by this change. Small fix needed to clang has been committed
in r236751.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236752 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix information loss in branch probability computation.
Diego Novillo [Thu, 7 May 2015 17:22:06 +0000 (17:22 +0000)]
Fix information loss in branch probability computation.

This addresses PR 22718. When branch weights are too large, they were
being clamped to the range [1, MaxWeightForBB]. But this clamping is
only applied to edges that go outside the range, so it distorts the
relative branch probabilities.

This patch changes the weight calculation to scale every branch so the
relative probabilities are preserved. The scaling is done differently
now. First, all the branch weights are added up, and if the sum exceeds
32 bits, it computes an integer scale to bring all the weights within
the range.

The patch fixes an existing test that had slightly wrong branch
probabilities due to the previous clamping. It now gets branch weights
scaled accordingly.

Reviewers: dexonsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236750 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips][microMIPSr6] Implement JIALC and JIC instructions
Jozef Kolek [Thu, 7 May 2015 17:12:23 +0000 (17:12 +0000)]
[mips][microMIPSr6] Implement JIALC and JIC instructions

This patch implements JIALC and JIC instructions using mapping.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236748 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPopulate list of vectorizable functions for Accelerate library.
Michael Zolotukhin [Thu, 7 May 2015 17:11:51 +0000 (17:11 +0000)]
Populate list of vectorizable functions for Accelerate library.

This patch adds majority of supported by Accelerate library functions to the
list of vectorizable functions.

The full list of available vector functions could be found here:

Test Plan: Unit tests are added.

Reviewers: hfinkel, aschwaighofer, nadav

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236747 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoR600: Fix comment that mentions AMDIL
Matt Arsenault [Thu, 7 May 2015 17:02:32 +0000 (17:02 +0000)]
R600: Fix comment that mentions AMDIL

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236745 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse intrinsic pattern to make a simpler match
Sanjay Patel [Thu, 7 May 2015 16:51:12 +0000 (16:51 +0000)]
Use intrinsic pattern to make a simpler match

This is a follow-on to r236740 where I took Andrea's advice
in D9504 to remove a redundant pattern...except that I removed
the wrong pattern!

AFAICT, there is no change in the final code produced because
subsequent passes would clean up the extra instructions created
by the more complicated pattern.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236743 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix another hang caused by ManagedStatic in SignalHandler
Steven Wu [Thu, 7 May 2015 16:20:51 +0000 (16:20 +0000)]
Fix another hang caused by ManagedStatic in SignalHandler

Fix two other variables that might cause the same hang fixed in r235914.
The hang is caused by constructing ManagedStatic in signalhandler. In
this case, if FileToRemove or CallBacksToRun is not contructed, it means
there is no work to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236741 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] eliminate unnecessary shuffling/moves with unary scalar math ops (PR21507)
Sanjay Patel [Thu, 7 May 2015 15:48:53 +0000 (15:48 +0000)]
[x86] eliminate unnecessary shuffling/moves with unary scalar math ops (PR21507)

Finish the job that was abandoned in D6958 following the refactoring in

1. Uncomment the intrinsic def for the AVX r_Int instruction.
2. Add missing r_Int entries to the load folding tables; there are already
   tests that check these in "test/Codegen/X86/fold-load-unops.ll", so I
   haven't added any more in this patch.
3. Add patterns to solve PR21507 ( https://llvm.org/bugs/show_bug.cgi?id=21507 ).

So instead of this:

  movaps %xmm0, %xmm1
  rcpss %xmm1, %xmm1
  movss %xmm1, %xmm0

We should now get:

  rcpss %xmm0, %xmm0

And instead of this:

  vsqrtss %xmm0, %xmm0, %xmm1
  vblendps $1, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm1[0],xmm0[1,2,3]

We should now get:

  vsqrtss %xmm0, %xmm0, %xmm0

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236740 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSwitch lowering: handle zero-weight branch probabilities
Hans Wennborg [Thu, 7 May 2015 15:47:15 +0000 (15:47 +0000)]
Switch lowering: handle zero-weight branch probabilities

After r236617, branch probabilities are no longer guaranteed to be >= 1. This
patch makes the swich lowering code handle that correctly, without bumping the
branch weights by 1 which might cause overflow and skews the probabilities.

Covered by @zero_weight_tree in test/CodeGen/X86/switch.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236739 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[obj2yaml/yaml2obj] Add SHT_MIPS_ABIFLAGS section support
Simon Atanasyan [Thu, 7 May 2015 15:40:48 +0000 (15:40 +0000)]
[obj2yaml/yaml2obj] Add SHT_MIPS_ABIFLAGS section support

This change adds support for the SHT_MIPS_ABIFLAGS section
reading/writing to the obj2yaml and yaml2obj tools.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236738 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-readobj] Print .MIPS.abiflags section content
Simon Atanasyan [Thu, 7 May 2015 15:40:35 +0000 (15:40 +0000)]
[llvm-readobj] Print .MIPS.abiflags section content

This change adds new flag -mips-abi-flags to the llvm-readobj. This flag
forces printing of .MIPS.abiflags section content.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236737 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MIPS] Move MIPS ABI flags structure constants to the separate header
Simon Atanasyan [Thu, 7 May 2015 14:57:04 +0000 (14:57 +0000)]
[MIPS] Move MIPS ABI flags structure constants to the separate header


The separate header file allows to reuse the MIPS ABI flags structure
constants in other LLVM tools like the llvm-readobj.

No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236732 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-readobj/obj2yaml/yaml2obj] Support more MIPS ELF header flags
Simon Atanasyan [Thu, 7 May 2015 14:04:44 +0000 (14:04 +0000)]
[llvm-readobj/obj2yaml/yaml2obj] Support more MIPS ELF header flags

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236728 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMasked Gather and Scatter intrinsics - updated documentation.
Elena Demikhovsky [Thu, 7 May 2015 12:25:11 +0000 (12:25 +0000)]
Masked Gather and Scatter intrinsics - updated documentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236721 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAVX-512: Added all forms of FP compare instructions for KNL and SKX.
Elena Demikhovsky [Thu, 7 May 2015 11:24:42 +0000 (11:24 +0000)]
AVX-512: Added all forms of FP compare instructions for KNL and SKX.
Added intrinsics for the instructions. CC parameter of the intrinsics was changed from i8 to i32 according to the spec.

By Igor Breger (igor.breger@intel.com)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236714 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] Add the SoftFloat MipsSubtarget feature.
Toma Tabacu [Thu, 7 May 2015 10:29:52 +0000 (10:29 +0000)]
[mips] Add the SoftFloat MipsSubtarget feature.

Summary: This will enable the IAS to reject floating point instructions if soft-float is enabled.

Reviewers: dsanders, echristo

Reviewed By: dsanders

Subscribers: jfb, llvm-commits, mpf

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236713 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAttributes.h: Fix incorrect \brief introduced in r236666. [-Wdocumentation]
NAKAMURA Takumi [Thu, 7 May 2015 10:18:56 +0000 (10:18 +0000)]
Attributes.h: Fix incorrect \brief introduced in r236666. [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236712 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoScalar/PlaceSafepoints.cpp: Fix a warning introduced in r228090. [-Wunused-variable]
NAKAMURA Takumi [Thu, 7 May 2015 10:18:46 +0000 (10:18 +0000)]
Scalar/PlaceSafepoints.cpp: Fix a warning introduced in r228090. [-Wunused-variable]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236711 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm/test/CodeGen/X86/llc-override-mcpu-mattr.ll: Tweak not to be affected by x64...
NAKAMURA Takumi [Thu, 7 May 2015 10:18:28 +0000 (10:18 +0000)]
llvm/test/CodeGen/X86/llc-override-mcpu-mattr.ll: Tweak not to be affected by x64 Calling Convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236710 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate InstCombine to transform aggregate loads into scalar loads.
Mehdi Amini [Thu, 7 May 2015 05:52:40 +0000 (05:52 +0000)]
Update InstCombine to transform aggregate loads into scalar loads.

One step further getting aggregate loads and store being optimized
properly. This will only handle struct with one element at this point.

Test Plan: Added unit tests for the new supported cases.

Reviewers: chandlerc, joker-eph, joker.eph, majnemer

Reviewed By: majnemer

Subscribers: pete, llvm-commits

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

Patch by Amaury Sechet.

From: Amaury Sechet <amaury@fb.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236695 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SanitizerCoverage] Introduce SanitizerCoverageOptions struct.
Alexey Samsonov [Thu, 7 May 2015 01:00:31 +0000 (01:00 +0000)]
[SanitizerCoverage] Introduce SanitizerCoverageOptions struct.

This gives frontend more precise control over collected coverage
information. User can still override these options by passing
-mllvm flags.

No functionality change.

Test Plan: regression test suite.

Reviewers: kcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236687 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIR: Initialize DerefOrNullBytes in the AttrBuilder constructors
Justin Bogner [Thu, 7 May 2015 00:56:34 +0000 (00:56 +0000)]
IR: Initialize DerefOrNullBytes in the AttrBuilder constructors

MSAN pointed out that this value is used uninitialized:


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236686 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoInstrProf: Simplify looking up sections for coverage data
Justin Bogner [Thu, 7 May 2015 00:31:58 +0000 (00:31 +0000)]
InstrProf: Simplify looking up sections for coverage data

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236685 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[JumpThreading] Simplify comparisons when simplifying branches
Philip Reames [Thu, 7 May 2015 00:19:14 +0000 (00:19 +0000)]
[JumpThreading] Simplify comparisons when simplifying branches

If we have recognized that a conditional is constant at a particular location in the code (while trying to decide if we can simplify a conditional branch), we can eagerly replace that condition with a constant if it's definition is post dominated by the branch in question.

In practice, this ends up being a compile time savings at most. JumpThreading would have visited each using branch anyways. CVP would have visited the cmp itself again. Unless LVI gives up early, we shouldn't gain any addition power by doing this transformation early. What we do gain is simplicity and compile time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236684 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Fuzzer] add dfsan_weak_hook_memcmp, enable the test that uses it, simplify the...
Kostya Serebryany [Thu, 7 May 2015 00:11:33 +0000 (00:11 +0000)]
[lib/Fuzzer] add dfsan_weak_hook_memcmp, enable the test that uses it, simplify the test runner

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236683 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdded support for building against Android API-9 SDK
Vince Harron [Thu, 7 May 2015 00:05:26 +0000 (00:05 +0000)]
Added support for building against Android API-9 SDK

Created an abstraction for log2, llvm::Log2 in Support/MathExtras.h

Hid Android problems inside of it

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236680 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[opaque pointer type] Pass explicit pointer type through GEP constant folding"
David Blaikie [Wed, 6 May 2015 23:56:21 +0000 (23:56 +0000)]
Revert "[opaque pointer type] Pass explicit pointer type through GEP constant folding"

Causes regressions in Clang. Reverting while I investigate.

This reverts commit r236670.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236678 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLet llc and opt override "-target-cpu" and "-target-features" via command line
Akira Hatanaka [Wed, 6 May 2015 23:54:14 +0000 (23:54 +0000)]
Let llc and opt override "-target-cpu" and "-target-features" via command line

This commit fixes a bug in llc and opt where "-mcpu" and "-mattr" wouldn't
override function attributes "-target-cpu" and "-target-features" in the IR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236677 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86MCInst] Move LowerSTATEPOINT to inside X86AsmPrinter. NFC.
Sanjoy Das [Wed, 6 May 2015 23:53:26 +0000 (23:53 +0000)]
[X86MCInst] Move LowerSTATEPOINT to inside X86AsmPrinter.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236676 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86MCInst] Clean up LowerSTATEPOINT: variable names. NFC.
Sanjoy Das [Wed, 6 May 2015 23:53:24 +0000 (23:53 +0000)]
[X86MCInst] Clean up LowerSTATEPOINT: variable names.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236675 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoints] Clean up PlaceSafepoints.cpp: de-duplicate code.
Sanjoy Das [Wed, 6 May 2015 23:53:21 +0000 (23:53 +0000)]
[Statepoints] Clean up PlaceSafepoints.cpp: de-duplicate code.

Common duplicated code and remove unnecessary code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236674 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoints] Clean up PlaceSafepoints.cpp: variable naming.
Sanjoy Das [Wed, 6 May 2015 23:53:19 +0000 (23:53 +0000)]
[Statepoints] Clean up PlaceSafepoints.cpp: variable naming.

Use CamelCase.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236673 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IRBuilder] Add a CreateGCStatepointInvoke.
Sanjoy Das [Wed, 6 May 2015 23:53:09 +0000 (23:53 +0000)]
[IRBuilder] Add a CreateGCStatepointInvoke.

Renames the original CreateGCStatepoint to CreateGCStatepointCall, and
moves invoke creating functionality from PlaceSafepoints.cpp to

This changes the labels generated for PlaceSafepoints/invokes.ll so use
a regex there to make the basic block labels more resilient.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236672 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFactor out a function which determines the cpu and feature strings based on
Akira Hatanaka [Wed, 6 May 2015 23:49:24 +0000 (23:49 +0000)]
Factor out a function which determines the cpu and feature strings based on
command line options -mcpu and -mattr. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236671 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[opaque pointer type] Pass explicit pointer type through GEP constant folding
David Blaikie [Wed, 6 May 2015 23:49:14 +0000 (23:49 +0000)]
[opaque pointer type] Pass explicit pointer type through GEP constant folding

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoYAML: Fix crash in the skip method of KeyValueNode class.
Alex Lorenz [Wed, 6 May 2015 23:21:29 +0000 (23:21 +0000)]
YAML: Fix crash in the skip method of KeyValueNode class.

This commit changes the 'skip' method in the 'KeyValueNode' class
to ensure that it doesn't dereference a null pointer when calling
the 'skip' method of its value child node. It also adds a unittest
that ensures that the crash doesn't occur.

This change is motivated by a patch that implements parsing
of YAML block scalars (http://reviews.llvm.org/D9503), as one
of the unittests in that patch triggered this problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236669 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange typeIncompatible to return an AttrBuilder instead of new-ing an AttributeSet.
Pete Cooper [Wed, 6 May 2015 23:19:56 +0000 (23:19 +0000)]
Change typeIncompatible to return an AttrBuilder instead of new-ing an AttributeSet.

This makes use of the new API which can remove attributes from a set given a builder.

This is much faster than creating a temporary set and reduces llc time by about 0.3% which was all spent creating temporary attributes sets on the context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236668 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate all comments to match the previous commit. NFC
Pete Cooper [Wed, 6 May 2015 23:19:51 +0000 (23:19 +0000)]
Update all comments to match the previous commit.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236667 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd remove method to operate on AttrBuilder instead of AttributeSet.
Pete Cooper [Wed, 6 May 2015 23:19:43 +0000 (23:19 +0000)]
Add remove method to operate on AttrBuilder instead of AttributeSet.

Prior to this change we would have to construct a temporary AttributeSet (which isn't temporary at all given that its allocated on the context), just to contain the attributes in the builder, then call remove on that.

Now we can just remove any attributes from the (lightweight and really temporary) builder itself.

Will be used in a future commit to remove some temporary attributes sets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236666 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoInstrProf: Give coverage its own errors instead of piggy backing on instrprof
Justin Bogner [Wed, 6 May 2015 23:19:35 +0000 (23:19 +0000)]
InstrProf: Give coverage its own errors instead of piggy backing on instrprof

Since the coverage mapping reader and the instrprof reader were
emitting a shared set of error codes, the error messages you'd get
back from llvm-cov were ambiguous about what was actually wrong. Add
another error category to fix this.

I've also improved the wording on a couple of the instrprof errors,
for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236665 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoInstrProf: Remove a function that just returns its argument (NFC)
Justin Bogner [Wed, 6 May 2015 23:15:55 +0000 (23:15 +0000)]
InstrProf: Remove a function that just returns its argument (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236664 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoYAML: Extract the code that skips a comment into a separate method, NFC.
Alex Lorenz [Wed, 6 May 2015 23:00:45 +0000 (23:00 +0000)]
YAML: Extract the code that skips a comment into a separate method, NFC.

This commit extracts the code that skips over a YAML comment from
the 'scanToNextToken' method into a separate 'skipComment' method.

This refactoring is motivated by a patch that implements parsing
of YAML block scalars (http://reviews.llvm.org/D9503), as the
method that parses a block scalar reuses the 'skipComment' method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236663 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unnecessary #ifndef NDEBUG guard around assert. NFC.
Pete Cooper [Wed, 6 May 2015 22:55:46 +0000 (22:55 +0000)]
Remove unnecessary #ifndef NDEBUG guard around assert.  NFC.

Found by Hal Finkel in the review of AttributeSets.  http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150504/275058.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236662 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoBitcode: Set LastDL after writing DebugLocs
Duncan P. N. Exon Smith [Wed, 6 May 2015 22:51:12 +0000 (22:51 +0000)]
Bitcode: Set LastDL after writing DebugLocs

Somehow I dropped this in r233585, and we haven't had `DEBUG_LOC_AGAIN`
records since.  Add it back.  Also tests that the output assembly looks

Fixes PR23436.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236661 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoHandle dead defs in the if converter.
Pete Cooper [Wed, 6 May 2015 22:51:04 +0000 (22:51 +0000)]
Handle dead defs in the if converter.

We had code such as this:
  r2 = ...

  ldr ... r2

  return r2<dead, def>

The if converter was transforming this to
   r2<def> = ...
   return [pred] r2<dead,def>
   ldr <r2, kill>

which fails the machine verifier because the ldr now reads from a dead def.

The fix here detects dead defs in stepForward and passes them back to the caller in the clobbers list.  The caller then clears the dead flag from the def is the value is live.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236660 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Fuzzer] remove dfsan_fuzzer_abi.list -- its contents are now moved to dfsan...
Kostya Serebryany [Wed, 6 May 2015 22:47:24 +0000 (22:47 +0000)]
[lib/Fuzzer] remove dfsan_fuzzer_abi.list -- its contents are now moved to dfsan proper

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236659 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RegisterCoalescer] Make sure each live-range has only one component, as
Quentin Colombet [Wed, 6 May 2015 22:41:50 +0000 (22:41 +0000)]
[RegisterCoalescer] Make sure each live-range has only one component, as
demanded by the machine verifier.
After shrinking a live-range to its uses, it is possible to create several
smaller live-ranges. When this happens, shrinkToUses returns true and we need to
split the different components into their own live-ranges.

The problem does not reproduce on any in-tree target but Jonas Paulsson
<jonas.paulsson@ericsson.com>, who reported the problem, checked that this patch
fixes the issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236658 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Fuzzer] add a fuzzer test for memcmp (does not work yet)
Kostya Serebryany [Wed, 6 May 2015 22:36:00 +0000 (22:36 +0000)]
[lib/Fuzzer] add a fuzzer test for memcmp (does not work yet)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236656 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix link failure on MinGW due to use of CoInitialize.
Zachary Turner [Wed, 6 May 2015 22:26:51 +0000 (22:26 +0000)]
Fix link failure on MinGW due to use of CoInitialize.

ole32 is considered a default library with MSVC, but apparently
not with MinGW.  Since we use CoInitialize, we need to explicitly
link against it in LLVMSupport for a MinGW build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236654 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoA few fixes for llvm-symbolizer on Windows.
Zachary Turner [Wed, 6 May 2015 22:26:30 +0000 (22:26 +0000)]
A few fixes for llvm-symbolizer on Windows.

Specifically, this patch correctly respects the -demangle option,
and additionally adds a hidden --relative-address option allows
input addresses to be relative to the module load address instead
of absolute addresses into the image.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236653 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Fuzzer] rename TestOneInput to LLVMFuzzerTestOneInput to make it more unique
Kostya Serebryany [Wed, 6 May 2015 22:19:00 +0000 (22:19 +0000)]
[lib/Fuzzer] rename TestOneInput to LLVMFuzzerTestOneInput to make it more unique

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236652 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix incorrect kill flags in fastisel.
Pete Cooper [Wed, 6 May 2015 22:09:29 +0000 (22:09 +0000)]
Fix incorrect kill flags in fastisel.

If called twice in the same BB on the same constant, FastISel::fastEmit_ri_ was marking the materialized vreg as killed on each use, instead of only the last use.

Change this to only mark the last use as killed by making earlier uses check if the vreg is already used elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236650 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] Fix register class of folded load index reg.
Pete Cooper [Wed, 6 May 2015 21:37:19 +0000 (21:37 +0000)]
[x86] Fix register class of folded load index reg.

When folding a load in to another instruction, we need to fix the class of the index register
Otherwise, it could be something like GR64 not GR64_NOSP and would fail the machine verifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236644 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SanitizerCoverage] Fix a couple of typos. NFC.
Alexey Samsonov [Wed, 6 May 2015 21:35:25 +0000 (21:35 +0000)]
[SanitizerCoverage] Fix a couple of typos. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236643 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMC: Skip names of temporary symbols in object streamer
Duncan P. N. Exon Smith [Wed, 6 May 2015 21:34:34 +0000 (21:34 +0000)]
MC: Skip names of temporary symbols in object streamer

Don't create names for temporary symbols when using an object streamer.
The names never make it to the output anyway.  From the starting point
of r236629, my heap profile says this drops peak memory usage from 1100
MB to 1058 MB for CodeGen of `verify-uselistorder`, a savings of almost
4% on peak memory, and removes `StringMap<bool, BumpPtrAllocator...>`
from the profile entirely.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236642 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: move over-zealous assert into actual if statement.
Tim Northover [Wed, 6 May 2015 20:07:38 +0000 (20:07 +0000)]
CodeGen: move over-zealous assert into actual if statement.

It's quite possible to encounter an insertvalue instruction that's more deeply
nested than the value we're looking for, but when that happens we really
mustn't compare beyond the end of the index array.

Since I couldn't see any guarantees about what comparisons std::equal makes, we
probably need to directly check the size beforehand. In practice, I suspect
most std::equal implementations would probably bail early, which would be OK.
But just in case...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236635 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDwarfDebug: Emit number of bytes in .debug_loc entry directly
Duncan P. N. Exon Smith [Wed, 6 May 2015 19:11:20 +0000 (19:11 +0000)]
DwarfDebug: Emit number of bytes in .debug_loc entry directly

Emit the number of bytes in a `.debug_loc` entry directly.  The old code
created temp labels (expensive), emitted the difference between them,
and then emitted one on each side of the relevant bytes.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`
(the optimized version of ld64's `-save-temps` when linking the
`verify-uselistorder` executable in an LTO bootstrap).  I've hacked
`MCContext::Allocate()` to just call `malloc()` instead of using the
`BumpPtrAllocator` so that the heap profile is easier to read.  As far
as peak memory is concerned, `MCContext::Allocate()` is equivalent to a
leak, since it only gets freed at process teardown.

In my heap profile, this patch drops memory usage of
`DwarfDebug::emitDebugLoc()` from 132.56 MB (11.4%) down to 29.86 MB
(2.7%) at peak memory.  Some of that must be noise from `SmallVector`
(or other) allocations -- peak memory only dropped from 1160 MB down to
1100 MB -- but this nevertheless shaves 5% off the top.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236629 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImplement `createSanitizerCtor`, common helper function for all sanitizers
Ismail Pazarbasi [Wed, 6 May 2015 18:48:22 +0000 (18:48 +0000)]
Implement `createSanitizerCtor`, common helper function for all sanitizers

This helper function creates a ctor function, which calls sanitizer's
init function with given arguments. This constructor is then expected
to be added to module's ctors. The patch helps unifying how sanitizer
constructor functions are created, and how init functions are called
across all sanitizers.

Reviewers: kcc, samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236627 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WinEH] Improve fatal error message about failed demotion
Reid Kleckner [Wed, 6 May 2015 18:45:24 +0000 (18:45 +0000)]
[WinEH] Improve fatal error message about failed demotion

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236626 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG] Delete SelectionDAGBuilder::removeValue. NFC.
Sanjoy Das [Wed, 6 May 2015 18:02:10 +0000 (18:02 +0000)]
[SelectionDAG] Delete SelectionDAGBuilder::removeValue. NFC.

SelectionDAGBuilder::removeValue is dead now, after rL236563.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236618 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAllow 0-weight branches in BranchProbabilityInfo.
Diego Novillo [Wed, 6 May 2015 17:55:11 +0000 (17:55 +0000)]
Allow 0-weight branches in BranchProbabilityInfo.

When computing branch weights in BPI, we used to disallow branches with
weight 0. This is a minor nuisance, because a branch with weight 0 is
different to "don't have information". In the context of
instrumentation, it may mean "never executed", in the context of
sampling, it means "never or seldom executed".

In allowing 0 weight branches, I ran into issues with the switch
expansion code in selection DAG. It is currently hardwired to not handle
branches with weight 0. To maintain the current behaviour, I changed it
to use 1 when it finds 0, but perhaps the algorithm needs changes to
tolerate branches with weight zero.

Reviewers: hansw

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236617 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing dereferenceable_or_null getters
Sanjoy Das [Wed, 6 May 2015 17:41:54 +0000 (17:41 +0000)]
Add missing dereferenceable_or_null getters

Summary: Add missing dereferenceable_or_null getters required for
http://reviews.llvm.org/D9253 change. Separated from the D9253 review.

Patch by Artur Pilipenko!

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236615 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Disable loop unrolling in loop vectorization pass when VF is 1.
Wei Mi [Wed, 6 May 2015 17:12:25 +0000 (17:12 +0000)]
[X86] Disable loop unrolling in loop vectorization pass when VF is 1.

The patch disabled unrolling in loop vectorization pass when VF==1 on x86 architecture,
by setting MaxInterleaveFactor to 1. Unrolling in loop vectorization pass may introduce
the cost of overflow check, memory boundary check and extra prologue/epilogue code when
regular unroller will unroll the loop another time. Disable it when VF==1 remove the
unnecessary cost on x86. The same can be done for other platforms after verifying
interleaving/memory bound checking to be not perf critical on those platforms.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236613 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd ChangeTo* to MachineOperand for symbols
Matt Arsenault [Wed, 6 May 2015 17:05:54 +0000 (17:05 +0000)]
Add ChangeTo* to MachineOperand for symbols

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236612 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd bitcode test to verify functions can be materialized out of order.
Derek Schuff [Wed, 6 May 2015 16:52:35 +0000 (16:52 +0000)]
Add bitcode test to verify functions can be materialized out of order.

Adds test to check that when getLazyBitcodeModule is called:
1) Functions are not materailzed by default.
2) Only the requested function gets materialized (if no block addresses
   are used).

Reviewers: jvoung, rafael

Reviewed By: rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236611 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReadd the regression test from r236584. Calling convention fixed to linux.
Pawel Bylica [Wed, 6 May 2015 16:43:21 +0000 (16:43 +0000)]
Readd the regression test from r236584. Calling convention fixed to linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236610 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fast-Isel was incorrectly selecting <2 x double> adds.
Pete Cooper [Wed, 6 May 2015 16:39:17 +0000 (16:39 +0000)]
[ARM] Fast-Isel was incorrectly selecting <2 x double> adds.

With neon enabled, we reach SelectBinaryFPOp and are able to get registers for a <2 x double> add.

However, we shouldn't actually attempt arithmetic on it as ARMIselLowering says "v2f64 is legal so that QR subregs can be extracted as f64 elements, but neither Neon nor VFP support any arithmetic operations on it."

This commit disables SelectBinaryFPOp for any vector types.  There's already a FIXME to try handle neon.  Doing so would require fixing this conditional which isn't safe for vectors 'VT == MVT::f64 || VT == MVT::i64'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236609 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PPC64LE] Adjust vector splats during VSX swap optimization
Bill Schmidt [Wed, 6 May 2015 15:40:46 +0000 (15:40 +0000)]
[PPC64LE] Adjust vector splats during VSX swap optimization

The initial code drop for VSX swap optimization permitted the
optimization only when all operations in a web of related computation
are lane-insensitive.  For some lane-sensitive operations, we can
still permit the optimization provided that we make adjustments to
those operations.  This patch adds special handling for vector splats
so that their presence doesn't kill the optimization.

Vector splats are lane-sensitive since they identify by number a
vector element to be used as the source of a splat.  When swap
optimizations take place, the desired vector element will move to the
opposite doubleword of the quadword vector.  We thus replace the index
I by (I + N/2) % N, where N is the number of elements in the vector.

A new test case is added to test that swap optimization succeeds when
vector splats are present, and that the proper input element is used
as the source of the splat.

An ancillary change removes SH_BUILDVEC as one of the kinds of special
handling that may be required by VSX swap optimization.  From
experience with GCC, I had expected to need some modifications for
vector build operations, but I did not find that to be the case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236606 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReformat.
NAKAMURA Takumi [Wed, 6 May 2015 14:03:22 +0000 (14:03 +0000)]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236601 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r236546, "propagate IR-level fast-math-flags to DAG nodes (NFC)"
NAKAMURA Takumi [Wed, 6 May 2015 14:03:12 +0000 (14:03 +0000)]
Revert r236546, "propagate IR-level fast-math-flags to DAG nodes (NFC)"

It caused undefined behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236600 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] generate VMAXNM/VMINNM for a compare followed by a select, in safe math mode too
Artyom Skrobov [Wed, 6 May 2015 11:44:10 +0000 (11:44 +0000)]
[ARM] generate VMAXNM/VMINNM for a compare followed by a select, in safe math mode too

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236590 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert regression test from r236584.
Pawel Bylica [Wed, 6 May 2015 10:41:46 +0000 (10:41 +0000)]
Revert regression test from r236584.

Temporary remove a regression test added in r236584. It fails on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236586 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSelectionDAG: Handle out-of-bounds index in extract vector element
Pawel Bylica [Wed, 6 May 2015 10:19:14 +0000 (10:19 +0000)]
SelectionDAG: Handle out-of-bounds index in extract vector element

Summary: This patch correctly handles undef case of EXTRACT_VECTOR_ELT node where the element index is constant and not less than vector size.

Test Plan:
CodeGen for X86 test included.
Also one incorrect regression test fixed.

Reviewers: qcolombet, chandlerc, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236584 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DomTree] verifyDomTree to unconditionally perform DT verification
Adam Nemet [Wed, 6 May 2015 08:18:41 +0000 (08:18 +0000)]
[DomTree] verifyDomTree to unconditionally perform DT verification

I folded the check for the flag -verify-dom-info into the only caller
where I think it is supposed to be checked: verifyAnalysis.  (The idea
of the flag is to enable this expensive verification in

I'm assuming that when manually scheduling the verification pass
with -passes=verify<domtree>, we do want to perform the verification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236575 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM][FastISel] Use TST #1 instead of CMP #0 for select.
Ahmed Bougacha [Wed, 6 May 2015 04:14:02 +0000 (04:14 +0000)]
[ARM][FastISel] Use TST #1 instead of CMP #0 for select.

Since r234249, i1 are sext instead of zext; because of that, doing
"CMP rN, #0; IT EQ/NE" isn't correct anymore.

"TST #1" is the conservatively correct alternative - the tradeoff being
that it doesn't have a 16-bit encoding -, so use that instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236569 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoints] Remove broken test case.
Sanjoy Das [Wed, 6 May 2015 02:51:46 +0000 (02:51 +0000)]
[Statepoints] Remove broken test case.

statepoint-indirect-return.ll breaks on linux systems.  Delete the test
case to make the bots green while I figure out what the right fix is.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236568 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IRBuilder] Fix indentation. NFC.
Sanjoy Das [Wed, 6 May 2015 02:36:34 +0000 (02:36 +0000)]
[IRBuilder] Fix indentation.  NFC.

Whitespace-only change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236567 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoint] Clean up StatepointLowering: symbolic constants.
Sanjoy Das [Wed, 6 May 2015 02:36:31 +0000 (02:36 +0000)]
[Statepoint] Clean up StatepointLowering: symbolic constants.

For accessors in the `Statepoint` class, use symbolic constants for
offsets into the argument vector instead of literals.  This makes the
code intent clearer and simpler to change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236566 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoint] Clean up Statepoint.h: clang-format.
Sanjoy Das [Wed, 6 May 2015 02:36:28 +0000 (02:36 +0000)]
[Statepoint] Clean up Statepoint.h: clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236565 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoint] Clean up Statepoint.h: accessor names.
Sanjoy Das [Wed, 6 May 2015 02:36:26 +0000 (02:36 +0000)]
[Statepoint] Clean up Statepoint.h: accessor names.

Use getFoo() as accessors consistently and some other naming changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236564 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[StatepointLowering] Don't create temporary instructions. NFCI.
Sanjoy Das [Wed, 6 May 2015 02:36:20 +0000 (02:36 +0000)]
[StatepointLowering] Don't create temporary instructions.  NFCI.

Instead of creating a temporary call instruction and lowering that, use

Reviewers: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236563 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WinEH] Reset WinEHPrepare::SEHExceptionCodeSlot when we're done.
Ahmed Bougacha [Wed, 6 May 2015 01:28:58 +0000 (01:28 +0000)]
[WinEH] Reset WinEHPrepare::SEHExceptionCodeSlot when we're done.

This caused a use-after-free on test/CodeGen/X86/win32-eh.ll
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236561 91177308-0d34-0410-b5e6-96231b3b80d8