]> granicus.if.org Git - llvm/log
llvm
9 years agoAMDGPU/SI: Refactor fixup handling for constant addrspace variables
Tom Stellard [Tue, 14 Jun 2016 20:29:59 +0000 (20:29 +0000)]
AMDGPU/SI: Refactor fixup handling for constant addrspace variables

Summary:
We now use a standard fixup type applying the pc-relative address of
constant address space variables, and we have the GlobalAddress lowering
code add the required 4 byte offset to the global address rather than
doing it as part of the fixup.

This refactoring will make it easier to use the same code for global
address space variables and also simplifies the code.

Re-commit this after fixing a bug where we were trying to use a
reference to a Triple object that had already been destroyed.

Reviewers: arsenm, kzhuravl

Subscribers: arsenm, kzhuravl, llvm-commits

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

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

9 years agoMake sure attribute kind and attributes are named respectively Kind and Attr consiste...
Amaury Sechet [Tue, 14 Jun 2016 20:27:35 +0000 (20:27 +0000)]
Make sure attribute kind and attributes are named respectively Kind and Attr consistently. Historically they used to be the same the terminology is very confused in the codebase. NFC.

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

9 years ago[ValueTracking] Calls to @llvm.assume always return
Sanjoy Das [Tue, 14 Jun 2016 20:23:16 +0000 (20:23 +0000)]
[ValueTracking] Calls to @llvm.assume always return

This change teaches llvm::isGuaranteedToTransferExecutionToSuccessor
that calls to @llvm.assume always terminate.  Most other relevant
intrinsics should be covered by the "CS.onlyReadsMemory() ||
CS.onlyAccessesArgMemory()" bit but we were missing @llvm.assumes
because we state that it clobbers memory.

Added an LICM test case, but this change is not specific to LICM.

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

9 years ago[TailDuplication] Split up NumInstrDups statistic.
Geoff Berry [Tue, 14 Jun 2016 19:40:10 +0000 (19:40 +0000)]
[TailDuplication] Split up NumInstrDups statistic.

Summary:
Split NumInstrDups statistic into separate added/removed counts to avoid
negative stat being printed as unsigned.

Subscribers: mcrosier, llvm-commits

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

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

9 years ago[LibFuzzer] Disable the ``fuzzer-trace-pc.test`` test on non-linux platforms.
Dan Liew [Tue, 14 Jun 2016 19:15:13 +0000 (19:15 +0000)]
[LibFuzzer] Disable the ``fuzzer-trace-pc.test`` test on non-linux platforms.

On OSX this test sometimes fails due to the
``LLVMFuzzer-FullCoverageSetTest-TracePC`` program going over the
default 2GiB memory limit. This shouldn't be happening and needs
investigating. For now just disable the test so we can set up an
OSX buildbot.

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

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

9 years ago[X86] Reduce the width of multiplification when its operands are extended from i8...
Wei Mi [Tue, 14 Jun 2016 18:53:20 +0000 (18:53 +0000)]
[X86] Reduce the width of multiplification when its operands are extended from i8 or i16

For <N x i32> type mul, pmuludq will be used for targets without SSE41, which
often introduces many extra pack and unpack instructions in vectorized loop
body because pmuludq generates <N/2 x i64> type value. However when the operands
of <N x i32> mul are extended from smaller size values like i8 and i16, the type
of mul may be shrunk to use pmullw + pmulhw/pmulhuw instead of pmuludq, which
generates better code. For targets with SSE41, pmulld is supported so no
shrinking is needed.

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

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

9 years agoRevert "[pdb] Actually write a PDB to disk from YAML."
Zachary Turner [Tue, 14 Jun 2016 18:51:35 +0000 (18:51 +0000)]
Revert "[pdb] Actually write a PDB to disk from YAML."

This reverts commit 879139e1c6577b09df52de56a6bab856a19ed185.

This was committed accidentally when I blindly typed git svn
dcommit instead of the command to generate a patch.

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

9 years ago[pdb] Actually write a PDB to disk from YAML.
Zachary Turner [Tue, 14 Jun 2016 18:49:36 +0000 (18:49 +0000)]
[pdb] Actually write a PDB to disk from YAML.

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

9 years ago[CFLAA] Tag arguments as escaped instead of unknown.
George Burgess IV [Tue, 14 Jun 2016 18:12:28 +0000 (18:12 +0000)]
[CFLAA] Tag arguments as escaped instead of unknown.

This patch also includes some refactoring.

Prior to this patch, we tagged all CFLAA attributes as unknown. This is
suboptimal, since it meant that any Value used as an argument would be
considered to alias any other Value that existed.

Now that we have the machinery to tag sets below the set for an
arbitrary value with attributes, it's okay to be less conservative with
arguments. (Specifically, we still tag the set under an argument with
unknown).

Patch by Jia Chen.

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

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

9 years ago[CFLAA] Refactor graph-building code. NFC.
George Burgess IV [Tue, 14 Jun 2016 18:02:27 +0000 (18:02 +0000)]
[CFLAA] Refactor graph-building code. NFC.

This patch refactors CFLAA's graph building code. This makes keeping
track of common state (TargetLibraryInfo, ...) easier.

Patch by Jia Chen.

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

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

9 years ago[docs] Update AMDGPU relocation information
Konstantin Zhuravlyov [Tue, 14 Jun 2016 17:20:29 +0000 (17:20 +0000)]
[docs] Update AMDGPU relocation information
  - Added new notation for specifying relocation calculation
  - Renamed:
    - R_AMDGPU_32_LOW -> R_AMDGPU_ABS32_LO
    - R_AMDGPU_32_HIGH -> R_AMDGPU_ABS32_HI
    - R_AMDGPU_64 -> R_AMDGPU_ABS64
  - Added:
    - R_AMDGPU_REL32
    - R_AMDGPU_REL64
    - R_AMDGPU_ABS32
  - Updated calculations for relative relocations

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

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

9 years ago[FileCheck] Document --check-prefixes.
Daniel Sanders [Tue, 14 Jun 2016 16:42:05 +0000 (16:42 +0000)]
[FileCheck] Document --check-prefixes.

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

9 years agoFix some typos in the Kaleidoscope tutorial (PR28120)
Hans Wennborg [Tue, 14 Jun 2016 16:05:12 +0000 (16:05 +0000)]
Fix some typos in the Kaleidoscope tutorial (PR28120)

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

9 years agoRevert "AMDGPU/SI: Refactor fixup handling for constant addrspace variables"
Tom Stellard [Tue, 14 Jun 2016 15:16:35 +0000 (15:16 +0000)]
Revert "AMDGPU/SI: Refactor fixup handling for constant addrspace variables"

This reverts commit r272675.

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

9 years agoAMDGPU/SI: Refactor fixup handling for constant addrspace variables
Tom Stellard [Tue, 14 Jun 2016 15:11:01 +0000 (15:11 +0000)]
AMDGPU/SI: Refactor fixup handling for constant addrspace variables

Summary:
We now use a standard fixup type applying the pc-relative address of
constant address space variables, and we have the GlobalAddress lowering
code add the required 4 byte offset to the global address rather than
doing it as part of the fixup.

This refactoring will make it easier to use the same code for global
address space variables and also simplifies the code.

Reviewers: arsenm, kzhuravl

Subscribers: arsenm, kzhuravl, llvm-commits

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

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

9 years agoFix BSS global handling in AsmPrinter
Nirav Dave [Tue, 14 Jun 2016 15:09:30 +0000 (15:09 +0000)]
Fix BSS global handling in AsmPrinter

Change EmitGlobalVariable to check final assembler section is in BSS
before using .lcomm/.comm directive. This prevents globals from being
put into .bss erroneously when -data-sections is used.

This fixes PR26570.

Reviewers: echristo, rafael

Subscribers: llvm-commits, mehdi_amini

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

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

9 years ago[AMDGPU][llvm-mc] Predefined symbols to access -mcpu from the assembly source (.optio...
Artem Tamazov [Tue, 14 Jun 2016 15:03:59 +0000 (15:03 +0000)]
[AMDGPU][llvm-mc] Predefined symbols to access -mcpu from the assembly source (.option.machine_version...)

The feature allows for conditional assembly etc.
TODO: make those symbols read-only.
Test added.

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

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

9 years agoLoopRotate: restructure code to simplify functions
Sebastian Pop [Tue, 14 Jun 2016 14:44:05 +0000 (14:44 +0000)]
LoopRotate: restructure code to simplify functions

We move the loop rotate functions in a separate class to avoid passing multiple
parameters to each function.  This cleanup will help with further development of
loop rotation.  NFC.

Patch written by Aditya Kumar and Sebastian Pop.

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

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

9 years ago[FileCheck] Add --check-prefixes as a shorthand for multiple --check-prefix options.
Daniel Sanders [Tue, 14 Jun 2016 14:28:04 +0000 (14:28 +0000)]
[FileCheck] Add --check-prefixes as a shorthand for multiple --check-prefix options.

Summary:
This new alias takes a comma separated list of prefixes which allows
'--check-prefix=A --check-prefix=B --check-prefix=C' to be written as
'--check-prefixes=A,B,C'.

Reviewers: probinson

Subscribers: probinson, llvm-commits, dsanders

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

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

9 years ago[mips] Optimize stack pointer adjustments.
Simon Dardis [Tue, 14 Jun 2016 13:39:43 +0000 (13:39 +0000)]
[mips] Optimize stack pointer adjustments.

Instead of always using addu to adjust the stack pointer when the
size out is of the range of an addiu instruction, use subu so that
a smaller constant can be generated.

This can give savings of ~3 instructions whenever a function has a
a stack frame whose size is out of range of an addiu instruction.

This change may break some naive stack unwinders.

Partially resolves PR/26291.

Thanks to David Chisnall for reporting the issue.

Reviewers: dsanders, vkalintiris

Differential Review: http://reviews.llvm.org/D21321

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

9 years ago[Thumb] Fix off-by-one error in r272007
James Molloy [Tue, 14 Jun 2016 13:33:07 +0000 (13:33 +0000)]
[Thumb] Fix off-by-one error in r272007

We can only generate immediates up to #510 with a MOV+ADD, not #511, because there's no such instruction as add #256.

Found by Oliver Stannard and csmith!

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

9 years agoAMDGPU: mark {exp,log}10{,f,l} library functions as unavailable
Nicolai Haehnle [Tue, 14 Jun 2016 13:14:53 +0000 (13:14 +0000)]
AMDGPU: mark {exp,log}10{,f,l} library functions as unavailable

Summary:
The SimplifyLibCalls part of InstCombine generates calls to those otherwise.

I wonder if at some point we shouldn't just call disableAllFunctions() and
then enable functions on a whitelist basis...

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96495

Reviewers: arsenm, tstellarAMD

Subscribers: llvm-commits, kzhuravl

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

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

9 years ago[MergedLoadStoreMotion] Before quering AA verify the loads are the same.
Chad Rosier [Tue, 14 Jun 2016 12:47:18 +0000 (12:47 +0000)]
[MergedLoadStoreMotion] Before quering AA verify the loads are the same.

Basicaa stats show the number of queries in Spec2k6 are reduced by 4540
or ~.67% overall.

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

9 years agoAdd a Musl environment to the triple.
Rafael Espindola [Tue, 14 Jun 2016 12:45:33 +0000 (12:45 +0000)]
Add a Musl environment to the triple.

It will be used in clang.

Patch by Lei Zhang.

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

9 years ago[mips][atomics] Fix atomic instruction descriptions and uses.
Simon Dardis [Tue, 14 Jun 2016 11:29:28 +0000 (11:29 +0000)]
[mips][atomics] Fix atomic instruction descriptions and uses.

PR27458 highlights that the MIPS backend does not have well formed
MIR for atomic operations (among other errors).

This patch adds expands and corrects the LL/SC descriptions and uses
for MIPS(64).

Reviewers: dsanders, vkalintiris

Differential Review: http://reviews.llvm.org/D19719

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

9 years ago[mips][ias] Implement one N32 case (of two) for .cpsetup.
Daniel Sanders [Tue, 14 Jun 2016 10:13:47 +0000 (10:13 +0000)]
[mips][ias] Implement one N32 case (of two) for .cpsetup.

This patch implements the N32 case where -mno-shared is in effect. The case
where -mshared is in effect will be added later since doing that now requires
additional changes to how we handle %hi(%neg(%gp_rel(foo))) expressions to
emit the three relocations as three relocations (currently only one of the
three would be emitted) which then requires further changes to our MCFixup
handling.

While we could fix both cases together, fixing the -mno-shared case allows us
to fix the ELFCLASS bug (where N32 incorrectly uses ELFCLASS64 instead of
ELFCLASS32) in a way that allows cpsetup.s to check for a correct output instead
of another incorrect output.

Reviewers: sdardis

Subscribers: dsanders, llvm-commits, sdardis

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

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

9 years ago[X86][SSE4A] Added patterns for nontemporal stores of scalar float/doubles using...
Simon Pilgrim [Tue, 14 Jun 2016 09:43:38 +0000 (09:43 +0000)]
[X86][SSE4A] Added patterns for nontemporal stores of scalar float/doubles using MOVNTSD/MOVNTSS

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

9 years ago[LoopVer] Remove an assert that's redundant now. NFC
Adam Nemet [Tue, 14 Jun 2016 09:39:01 +0000 (09:39 +0000)]
[LoopVer] Remove an assert that's redundant now. NFC

Ensuring that the PHI are all single-operand is not performed in the
second pass added by the previous pass.  This removes the assert from
the first pass.

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

9 years ago[LoopVer] Update all existing PHIs in the exit block
Adam Nemet [Tue, 14 Jun 2016 09:38:54 +0000 (09:38 +0000)]
[LoopVer] Update all existing PHIs in the exit block

We only used to add the edge from the cloned loop to PHIs that
corresponded to values defined by the loop.  We need to do this for all
PHIs obviously since we need a PHI operand for each incoming edge.

This includes things like PHIs with a constant value or with values
defined before the original loop (see the testcases).

After the patch the PHIs are added to the exit block in two passes.

In the first pass we ensure there is a single-operand (LCSSA) PHI for
each value defined by the loop.

In the second pass we loop through each (single-operand) PHI and add the
value for the edge from the cloned loop.  If the value is defined in the
loop we'll use the cloned instruction from the cloned loop.

Fixes PR28037

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

9 years ago[mips] MIPS32/64 itineraries
Simon Dardis [Tue, 14 Jun 2016 09:35:29 +0000 (09:35 +0000)]
[mips] MIPS32/64 itineraries

Itineraries for some pre MIPSR6 and EVA instructions. Some pseudo expanded
instructions are marked as having no scheduling info.

Reviewers: dsanders, vkalintiris

Differential Review: http://reviews.llvm.org/D20418

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

9 years ago[mips][dsp] Fix use without def on DSPCtrl registers read by rddsp intrinsic.
Daniel Sanders [Tue, 14 Jun 2016 09:29:46 +0000 (09:29 +0000)]
[mips][dsp] Fix use without def on DSPCtrl registers read by rddsp intrinsic.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

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

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

9 years ago[mips][msa] copyPhysReg() should not set RegState::Define on result of CTCMSA.
Daniel Sanders [Tue, 14 Jun 2016 09:11:33 +0000 (09:11 +0000)]
[mips][msa] copyPhysReg() should not set RegState::Define on result of CTCMSA.

Summary:
The machine verifier reports 'Explicit operand marked as def' when it is
manually specified even though it agrees with the operand info.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

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

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

9 years ago[SelectionDAG] Remove exit-on-error flag from test (PR27765)
Diana Picus [Tue, 14 Jun 2016 07:30:20 +0000 (07:30 +0000)]
[SelectionDAG] Remove exit-on-error flag from test (PR27765)

The exit-on-error flag in the ARM test is necessary in order to avoid an
unreachable in the DAGTypeLegalizer, when trying to expand a physical register.
We can also avoid this situation by introducing a bitcast early on, where the
invalid scalar-to-vector conversion is detected.

We also add a test for PowerPC, which goes through a similar code path in the
SelectionDAGBuilder.

Fixes PR27765.

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

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

9 years agore-generate the tests using the update_llc_test_checks.py script
Igor Breger [Tue, 14 Jun 2016 07:05:10 +0000 (07:05 +0000)]
re-generate the tests using the update_llc_test_checks.py script

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

9 years ago[PM] Port Mem2Reg to the new pass manager.
Davide Italiano [Tue, 14 Jun 2016 03:22:22 +0000 (03:22 +0000)]
[PM] Port Mem2Reg to the new pass manager.

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

9 years ago[AVX512] Use AND32ri8 instead of AND32ri when anding with 1 to create single bit...
Craig Topper [Tue, 14 Jun 2016 03:13:03 +0000 (03:13 +0000)]
[AVX512] Use AND32ri8 instead of AND32ri when anding with 1 to create single bit masks. This results in a smaller encoding.

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

9 years ago[AVX512] Use MOVZX32 instead of MOVZ16 for loading single v8/v4/v2/v1 masks when...
Craig Topper [Tue, 14 Jun 2016 03:13:00 +0000 (03:13 +0000)]
[AVX512] Use MOVZX32 instead of MOVZ16 for loading single v8/v4/v2/v1 masks when KMOVB is not available. This has better behavior with respect to partial register stalls since it won't need to preserve the upper 16-bits of the GPR.

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

9 years ago[AVX512] Add patterns for zero-extending a mask that use the def of KMOVW/KMOVB witho...
Craig Topper [Tue, 14 Jun 2016 03:12:54 +0000 (03:12 +0000)]
[AVX512] Add patterns for zero-extending a mask that use the def of KMOVW/KMOVB without going through an EXTRACT_SUBREG and a MOVZX.

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

9 years ago[AVX512] Add tests for zero extending masks that show an unnecessary movzx instructio...
Craig Topper [Tue, 14 Jun 2016 03:12:48 +0000 (03:12 +0000)]
[AVX512] Add tests for zero extending masks that show an unnecessary movzx instruction. A followup patch will remove that instruction, but adding the tests first to make the more obvious.

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

9 years agoFix for (benign) uninitialized read caught by UBSan bot.
Sean Silva [Tue, 14 Jun 2016 02:45:01 +0000 (02:45 +0000)]
Fix for (benign) uninitialized read caught by UBSan bot.

What happened here is that in the new PM there is a bunch of new copying
(actually, moving) and so this reads the HasProfileData member in
situations where it used to not be read.
It used to only be read strictly in the "runOnFunction" method and its
callees, where is *is* initialized (even after my patch).
So this ends up being benign as far as functional behavior of the
compiler (since we set HasProfileData in the "runImpl" method before we
ever make decisions based on it).

It's awesome that UBSan caught this. It highlights one more thing to
watch out for when porting passes.

Sanitizer bot log was:

-- Testing: 17049 tests, 32 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: LLVM :: Transforms/JumpThreading/thread-loads.ll (15184 of 17049)
******************** TEST 'LLVM :: Transforms/JumpThreading/thread-loads.ll' FAILED ********************
Script:
--
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/opt < /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll -jump-threading -S | /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/opt < /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll -passes=jump-threading -S | /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll
--
Exit Code: 2

Command Output (stderr):
--
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Transforms/Scalar/JumpThreading.h:90:57: runtime error: load of value 136, which is not a valid value for type 'bool'
    #0 0x2c33ba1 in llvm::JumpThreadingPass::JumpThreadingPass(llvm::JumpThreadingPass&&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Transforms/Scalar/JumpThreading.h:90:57
    #1 0x2bc88e4 in void llvm::PassManager<llvm::Function>::addPass<llvm::JumpThreadingPass>(llvm::JumpThreadingPass) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/PassManager.h:282:40
    #2 0x2bb2682 in llvm::PassBuilder::parseFunctionPassName(llvm::PassManager<llvm::Function>&, llvm::StringRef) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Passes/PassRegistry.def:133:1
    #3 0x2bb4914 in llvm::PassBuilder::parseFunctionPassPipeline(llvm::PassManager<llvm::Function>&, llvm::StringRef&, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Passes/PassBuilder.cpp:489:12
    #4 0x2bb6f81 in llvm::PassBuilder::parsePassPipeline(llvm::PassManager<llvm::Module>&, llvm::StringRef, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Passes/PassBuilder.cpp:674:10
    #5 0x986690 in llvm::runPassPipeline(llvm::StringRef, llvm::LLVMContext&, llvm::Module&, llvm::TargetMachine*, llvm::tool_output_file*, llvm::StringRef, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/opt/NewPMDriver.cpp:85:8
    #6 0x9af25e in main /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/opt/opt.cpp:468:12
    #7 0x7fd7e27dbf44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #8 0x960157 in _start (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt+0x960157)

FileCheck error: '-' is empty.
FileCheck command line:  /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Transforms/JumpThreading/thread-loads.ll

--

********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 128.90s
********************
Failing Tests (1):
    LLVM :: Transforms/JumpThreading/thread-loads.ll

  Expected Passes    : 16725
  Expected Failures  : 129
  Unsupported Tests  : 194
  Unexpected Failures: 1

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

9 years ago[PM] Port MemCpyOpt to the new PM.
Sean Silva [Tue, 14 Jun 2016 02:44:55 +0000 (02:44 +0000)]
[PM] Port MemCpyOpt to the new PM.

The need for all these Lookup* functions is just because of calls to
getAnalysis inside methods (i.e. not at the top level) of the
runOnFunction method. They should be straightforward to clean up when
the old PM is gone.

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

9 years agoAdd missing include from r272607 to fix modules build, and remove out-dated workaroun...
Richard Smith [Tue, 14 Jun 2016 01:31:23 +0000 (01:31 +0000)]
Add missing include from r272607 to fix modules build, and remove out-dated workaround from module map.

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

9 years ago[PM/MergedLoadStoreMotion] Preserve analyses more aggressively.
Davide Italiano [Tue, 14 Jun 2016 01:23:31 +0000 (01:23 +0000)]
[PM/MergedLoadStoreMotion] Preserve analyses more aggressively.

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

9 years agoPlacate bots fixing a typo in AA-pipeline description. Sorry.
Davide Italiano [Tue, 14 Jun 2016 01:11:12 +0000 (01:11 +0000)]
Placate bots fixing a typo in AA-pipeline description. Sorry.

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

9 years agoBring back "[PM] Port JumpThreading to the new PM" with a fix
Sean Silva [Tue, 14 Jun 2016 00:51:09 +0000 (00:51 +0000)]
Bring back "[PM] Port JumpThreading to the new PM" with a fix

This reverts commit r272603 and adds a fix.

Big thanks to Davide for pointing me at r216244 which gives some insight
into how to fix this VS2013 issue. VS2013 can't synthesize a move
constructor. So the fix here is to add one explicitly to the
JumpThreadingPass class.

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

9 years ago[PM] Port MergedLoadStoreMotion to the new pass manager.
Davide Italiano [Tue, 14 Jun 2016 00:49:23 +0000 (00:49 +0000)]
[PM] Port MergedLoadStoreMotion to the new pass manager.

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

9 years agoRevert "[PM] Port JumpThreading to the new PM"
Sean Silva [Tue, 14 Jun 2016 00:26:31 +0000 (00:26 +0000)]
Revert "[PM] Port JumpThreading to the new PM"

This reverts commit r272597.

Will investigate issue with VS2013 compilation and then recommit.

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

9 years agoRevert "Try to appease MSVC on clang-x86-win2008-selfhost"
Sean Silva [Tue, 14 Jun 2016 00:19:37 +0000 (00:19 +0000)]
Revert "Try to appease MSVC on clang-x86-win2008-selfhost"

This reverts commit r272601. The attempt didn't work.

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

9 years agoTry to appease MSVC on clang-x86-win2008-selfhost
Sean Silva [Tue, 14 Jun 2016 00:11:37 +0000 (00:11 +0000)]
Try to appease MSVC on clang-x86-win2008-selfhost

I've tested this locally with VS2015 and there are no issues there,
so this might be a VS2013 specific issue.

Thanks to Davide for the suggested fix.

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

9 years ago[LibFuzzer] Move tests in ``fuzzer-traces.test`` that require hooks to their own...
Dan Liew [Tue, 14 Jun 2016 00:11:34 +0000 (00:11 +0000)]
[LibFuzzer] Move tests in ``fuzzer-traces.test`` that require hooks to their own test.

The tests in ``fuzzer-traces-hooks.test`` only work on Linux because calls to hooks
(e.g. ``__sanitizer_weak_hook_memcmp()``) from inside the sanitizer
runtime are only implemented on Linux. Therefore these tests are set to
only run on Linux.

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

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

9 years agoAdd support for collating profiles for use with code coverage
Vedant Kumar [Mon, 13 Jun 2016 23:33:48 +0000 (23:33 +0000)]
Add support for collating profiles for use with code coverage

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

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

9 years ago[PM/MergedLoadStoreMotion] Remove unneeded pass dependency.
Davide Italiano [Mon, 13 Jun 2016 23:28:35 +0000 (23:28 +0000)]
[PM/MergedLoadStoreMotion] Remove unneeded pass dependency.

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

9 years ago[PM] Port JumpThreading to the new PM
Sean Silva [Mon, 13 Jun 2016 22:52:52 +0000 (22:52 +0000)]
[PM] Port JumpThreading to the new PM

This follows the approach in r263208 (for GVN) pretty closely:
- move the bulk of the body of the function to the new PM class.
- expose a runImpl method on the new-PM class that takes the IRUnitT and
  pointers/references to any analyses and use that to implement the
  old-PM class.
- use a private namespace in the header for stuff that used to be file
  scope

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

9 years ago[PM/MergeLoadStoreMotion] Convert the logic to static functions.
Davide Italiano [Mon, 13 Jun 2016 22:27:30 +0000 (22:27 +0000)]
[PM/MergeLoadStoreMotion] Convert the logic to static functions.

Pass AliasAnalyis and MemoryDepResult around. This is in preparation
for porting this pass to the new PM.

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

9 years ago[MBP] Interface cleanups /NFC
Xinliang David Li [Mon, 13 Jun 2016 22:23:44 +0000 (22:23 +0000)]
[MBP] Interface cleanups /NFC

Save machine function pointer so that
the reference does not need to be passed around.

This also gives other methods access to machine
function for information such as entry count etc.

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

9 years ago[PM] Port LVI to the new PM.
Sean Silva [Mon, 13 Jun 2016 22:01:25 +0000 (22:01 +0000)]
[PM] Port LVI to the new PM.

This is a bit gnarly since LVI is maintaining its own cache.
I think this port could be somewhat cleaner, but I'd rather not spend
too much time on it while we still have the old pass hanging around and
limiting how much we can clean things up.
Once the old pass is gone it will be easier (less time spent) to clean
it up anyway.

This is the last dependency needed for porting JumpThreading which I'll
do in a follow-up commit (there's no printer pass for LVI or anything to
test it, so porting a pass that depends on it seems best).

I've been mostly following:
r269370 / D18834 which ported Dependence Analysis
r268601 / D19839 which ported BPI

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

9 years agoUpdate the AArch64ExternalSymbolizer to print literal strings as escaped strings
Kevin Enderby [Mon, 13 Jun 2016 21:08:57 +0000 (21:08 +0000)]
Update the AArch64ExternalSymbolizer to print literal strings as escaped strings
so it is the same as the MCExternalSymbolizer.

rdar://17349181

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

9 years ago[MBP] Code cleanup #3 /NFC
Xinliang David Li [Mon, 13 Jun 2016 20:24:19 +0000 (20:24 +0000)]
[MBP] Code cleanup #3 /NFC

This is third patch to clean up the code.

Included in this patch:
1. Further unclutter trace/chain formation main routine;
2. Isolate the logic to compute global cost/conflict detection
   into its own method;
3. Heavily document the selection algorithm;
4. Added helper hook to allow PGO specific logic to be
   added in the future.

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

9 years agoMove previously added test case to the right location
Sanjoy Das [Mon, 13 Jun 2016 20:12:07 +0000 (20:12 +0000)]
Move previously added test case to the right location

In rL272580 I accidentally added a test case to test/CodeGen when
test/Transforms/DeadStoreElimination/ is a better place for it.

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

9 years agoFix AAResults::callCapturesBefore for operand bundles
Sanjoy Das [Mon, 13 Jun 2016 19:55:04 +0000 (19:55 +0000)]
Fix AAResults::callCapturesBefore for operand bundles

Summary:
AAResults::callCapturesBefore would previously ignore operand
bundles. It was possible for a later instruction to miss its memory
dependency on a call site that would only access the pointer through a
bundle.

Patch by Oscar Blumberg!

Reviewers: sanjoy

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

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

9 years agoAttempt to make windows buildbots happy.
George Burgess IV [Mon, 13 Jun 2016 19:38:49 +0000 (19:38 +0000)]
Attempt to make windows buildbots happy.

Broken by r272578. I didn't realize that the default move ctor
complaints would happen for non-template classes. :)

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

9 years ago[CFLAA] Refactor to remove redundant maps. NFC.
George Burgess IV [Mon, 13 Jun 2016 19:21:18 +0000 (19:21 +0000)]
[CFLAA] Refactor to remove redundant maps. NFC.

Patch by Jia Chen.

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

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

9 years ago[X86][SSE] Added extract to scalar nontemporal store tests
Simon Pilgrim [Mon, 13 Jun 2016 19:08:28 +0000 (19:08 +0000)]
[X86][SSE] Added extract to scalar nontemporal store tests

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

9 years ago[X86] Remove llvm.x86.bit.scan.{forward,reverse}.32
David Majnemer [Mon, 13 Jun 2016 17:33:13 +0000 (17:33 +0000)]
[X86] Remove llvm.x86.bit.scan.{forward,reverse}.32

The need for these intrinsics has been obviated by r272564 which
reimplements their functionality using generic IR.

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

9 years agoAdd triple to input file.
Rafael Espindola [Mon, 13 Jun 2016 17:08:15 +0000 (17:08 +0000)]
Add triple to input file.

Patch by H.J. Lu.

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

9 years agoAMDGPU/SI: Set INDEX_STRIDE for scratch coalescing
Marek Olsak [Mon, 13 Jun 2016 16:05:57 +0000 (16:05 +0000)]
AMDGPU/SI: Set INDEX_STRIDE for scratch coalescing

Summary:
Mesa and other users must set this to enable coalescing:
- STRIDE = 0
- SWIZZLE_ENABLE = 1

This makes one particular compute shader 8x faster.

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm, kzhuravl

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

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

9 years agoIn openFileForRead, attempt to fetch the actual name of the file on disk -- including...
Taewook Oh [Mon, 13 Jun 2016 15:54:56 +0000 (15:54 +0000)]
In openFileForRead, attempt to fetch the actual name of the file on disk -- including case -- so that clang can later warn about non-portable #include and #import directives.

Differential Revision: http://reviews.llvm.org/D19842
Corresponding clang patch: http://reviews.llvm.org/D19843

Re-commit after addressing issues with of generating too many warnings for Windows and asan test failures

Patch by Eric Niebler

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

9 years agoAMDGPU: Fix post-RA verifier errors with trackLivenessAfterRegAlloc
Matt Arsenault [Mon, 13 Jun 2016 15:53:52 +0000 (15:53 +0000)]
AMDGPU: Fix post-RA verifier errors with trackLivenessAfterRegAlloc

The condition reg of the cndmask_b64 expansion can't be killed by
the first one, and the implicit super register implicit def is needed.

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

9 years ago[SystemZ] Enable index register memory constraints for inline ASM
Ulrich Weigand [Mon, 13 Jun 2016 14:24:05 +0000 (14:24 +0000)]
[SystemZ] Enable index register memory constraints for inline ASM

This enables use of the 'R' and 'T' memory constraints for inline ASM
operands on SystemZ, which allow an index register as well as an
immediate displacement. This patch includes corresponding documentation
and test case updates.

As with the last patch of this kind, I moved the 'm' constraint to the
most general case, which is now 'T' (base + 20-bit signed displacement +
index register).

Author: colpell
Differential Revision: http://reviews.llvm.org/D21239

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

9 years ago[ARM] Reverting r272544 because clang patch needs
Ranjeet Singh [Mon, 13 Jun 2016 10:58:24 +0000 (10:58 +0000)]
[ARM] Reverting r272544 because clang patch needs
to go in as soon as llvm patch has gone in because
tests will start breaking in Clang.

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

9 years agoFix a typo in loop versioning.
Vikram TV [Mon, 13 Jun 2016 10:49:28 +0000 (10:49 +0000)]
Fix a typo in loop versioning.

Reviewers: ashutosh.nema

Subscribers: llvm-commits

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

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

9 years ago[ARM] Add mrrc/mrrc2 co-processor intrinsics
Ranjeet Singh [Mon, 13 Jun 2016 10:43:50 +0000 (10:43 +0000)]
[ARM] Add mrrc/mrrc2 co-processor intrinsics

MRRC/MRRC2 instruction writes to two registers. The
intrinsic definition returns a single uint64_t to
represent the write, this is a compact way of
representing a write to two 32 bit registers,
the alternative might have been two return a
struct of 2 uint32_t's but this isn't as nice.

Differential Revision:

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

9 years agoThis patch fixes handling long double type when it is
Strahinja Petrovic [Mon, 13 Jun 2016 10:29:29 +0000 (10:29 +0000)]
This patch fixes handling long double type when it is
constant in soft float mode on PowerPC 32 architecture.

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

9 years ago[X86][SSE4A] Renamed tests to correspond with the the instruction with being tested
Simon Pilgrim [Mon, 13 Jun 2016 10:14:42 +0000 (10:14 +0000)]
[X86][SSE4A] Renamed tests to correspond with the the instruction with being tested

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

9 years agoFix an enumeral mismatch warning.
Haojian Wu [Mon, 13 Jun 2016 09:03:45 +0000 (09:03 +0000)]
Fix an enumeral mismatch warning.

Summary:
The "-Werror=enum-compare" shows that the statement is using two different enums:

enumeral mismatch in conditional expression: 'llvm::X86ISD::NodeType' vs 'llvm::ISD::NodeType'

A follow-up fix on D21235.

Reviewers: klimek

Subscribers: spatel, cfe-commits

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

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

9 years ago[AArch64] Add RAS extensions support in AArch64TargetParser.
Zijiao Ma [Mon, 13 Jun 2016 05:27:58 +0000 (05:27 +0000)]
[AArch64] Add RAS extensions support in AArch64TargetParser.

RAS extensions are part of ARMv8.2,now supported in Clang.
Add RAS extensions support in AArch64TargetParser.

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

9 years ago[AVX512] Remove maksed pshufd, pshuflw, and phufhw intrinsics and autoupgrade them...
Craig Topper [Mon, 13 Jun 2016 02:36:48 +0000 (02:36 +0000)]
[AVX512] Remove maksed pshufd, pshuflw, and phufhw intrinsics and autoupgrade them to selects and shufflevector.

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

9 years ago[X86] Refactor some of the X86 autoupgrade code to split mask vector and select gener...
Craig Topper [Mon, 13 Jun 2016 02:36:42 +0000 (02:36 +0000)]
[X86] Refactor some of the X86 autoupgrade code to split mask vector and select generation into routines that can be reused for future intrinsic upgrades. NFC

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

9 years agoImproved Visual Studio 2015 visualization of SmallVectorImpl
Mike Spertus [Mon, 13 Jun 2016 01:43:14 +0000 (01:43 +0000)]
Improved Visual Studio 2015 visualization of SmallVectorImpl

When visualizing small vectors in VS2015, show the first few elements in the DisplayString instead of the size. For example, a SmallVector of DeclAccessPair will visualize like

  {public typename ...Ts, public typename U}

The visualization in VS2013 remains the same because we continue to include the old visualizer with a lower-than-default priority of MediumLow, and the same SmallVector would continue to be visualized as

  {size = 2}

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

9 years agoUntabify.
NAKAMURA Takumi [Mon, 13 Jun 2016 00:18:19 +0000 (00:18 +0000)]
Untabify.

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

9 years agoUse 'auto' to avoid implicit copies.
Benjamin Kramer [Sun, 12 Jun 2016 19:02:34 +0000 (19:02 +0000)]
Use 'auto' to avoid implicit copies.

td_type is std::pair<std::string, std::string>, but the map returns
elements of std::pair<const std::string, std::string>. In well-designed
languages like C++ that yields an implicit copy perfectly hidden by
constref's lifetime extension. Just use auto, the typedef obscured the
real type anyways.

Found with a little help from clang-tidy's
performance-implicit-cast-in-loop.

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

9 years ago[Verifier] Simplify code. No functionality change intended.
Benjamin Kramer [Sun, 12 Jun 2016 17:46:23 +0000 (17:46 +0000)]
[Verifier] Simplify code. No functionality change intended.

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

9 years agoRun clang-tidy's performance-unnecessary-copy-initialization over LLVM.
Benjamin Kramer [Sun, 12 Jun 2016 17:30:47 +0000 (17:30 +0000)]
Run clang-tidy's performance-unnecessary-copy-initialization over LLVM.

No functionality change intended.

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

9 years ago[MBP] Code cleanup /NFC
Xinliang David Li [Sun, 12 Jun 2016 16:54:03 +0000 (16:54 +0000)]
[MBP] Code cleanup /NFC

This is second patch to clean up the code.

In this patch, the logic to determine block outlinining
is refactored and more comments are added.

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

9 years agoMove instances of std::function.
Benjamin Kramer [Sun, 12 Jun 2016 16:13:55 +0000 (16:13 +0000)]
Move instances of std::function.

Or replace with llvm::function_ref if it's never stored. NFC intended.

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

9 years agoPass DebugLoc and SDLoc by const ref.
Benjamin Kramer [Sun, 12 Jun 2016 15:39:02 +0000 (15:39 +0000)]
Pass DebugLoc and SDLoc by const ref.

This used to be free, copying and moving DebugLocs became expensive
after the metadata rewrite. Passing by reference eliminates a ton of
track/untrack operations. No functionality change intended.

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

9 years ago[x86, SSE] change patterns for CMPP to float types to allow matching with SSE1 (PR28044)
Sanjay Patel [Sun, 12 Jun 2016 15:03:25 +0000 (15:03 +0000)]
[x86, SSE] change patterns for CMPP to float types to allow matching with SSE1 (PR28044)

This patch is intended to solve:
https://llvm.org/bugs/show_bug.cgi?id=28044

By changing the definition of X86ISD::CMPP to use float types, we allow it to be created
and pass legalization for an SSE1-only target where v4i32 is not legal.

The motivational trail for this change includes:
https://llvm.org/bugs/show_bug.cgi?id=28001

and eventually makes this trigger:
http://reviews.llvm.org/D21190

Ie, after this step, we should be free to have Clang generate FP compare IR instead of x86
intrinsics for SSE C packed compare intrinsics. (We can auto-upgrade and remove the LLVM
sse.cmp intrinsics as a follow-up step.) Once we're generating vector IR instead of x86
intrinsics, a big pile of generic optimizations can trigger.

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

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

9 years ago[X86] Remove sse2 pshufd/pshuflw/pshufhw intrinsics and upgrade them to shufflevector.
Craig Topper [Sun, 12 Jun 2016 14:11:32 +0000 (14:11 +0000)]
[X86] Remove sse2 pshufd/pshuflw/pshufhw intrinsics and upgrade them to shufflevector.

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

9 years ago[RegUsageInfoCollector] Drop unneccesary const_cast. NFC.
Benjamin Kramer [Sun, 12 Jun 2016 13:32:23 +0000 (13:32 +0000)]
[RegUsageInfoCollector] Drop unneccesary const_cast. NFC.

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

9 years ago[X86][BMI] Added fast-isel tests for BMI1 intrinsics
Simon Pilgrim [Sun, 12 Jun 2016 09:56:05 +0000 (09:56 +0000)]
[X86][BMI] Added fast-isel tests for BMI1 intrinsics

A lot of the codegen is pretty awful for these as they are mostly implemented as generic bit twiddling ops

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

9 years ago[PM] Port DeadArgumentElimination to the new PM
Sean Silva [Sun, 12 Jun 2016 09:16:39 +0000 (09:16 +0000)]
[PM] Port DeadArgumentElimination to the new PM

The approach taken here follows r267631.

deadarghaX0r should be easy to port when the time comes to add new-PM
support to bugpoint.

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

9 years agoChange () to (void) in the C API.
Amaury Sechet [Sun, 12 Jun 2016 07:56:21 +0000 (07:56 +0000)]
Change () to (void) in the C API.

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

9 years ago[PM] Port ReversePostOrderFunctionAttrs to the new PM
Sean Silva [Sun, 12 Jun 2016 07:48:51 +0000 (07:48 +0000)]
[PM] Port ReversePostOrderFunctionAttrs to the new PM

Below are my super rough notes when porting. They can probably serve as
a basic guide for porting other passes to the new PM. As I port more
passes I'll expand and generalize this and make a proper
docs/HowToPortToNewPassManager.rst document. There is also missing
documentation for general concepts and API's in the new PM which will
require some documentation.
Once there is proper documentation in place we can put up a list of
passes that have to be ported and game-ify/crowdsource the rest of the
porting (at least of the middle end; the backend is still unclear).

I will however be taking personal responsibility for ensuring that the
LLD/ELF LTO pipeline is ported in a timely fashion. The remaining passes
to be ported are (do something like
`git grep "<the string in the bullet point below>"` to find the pass):

General Scalar:
[ ] Simplify the CFG
[ ] Jump Threading
[ ] MemCpy Optimization
[ ] Promote Memory to Register
[ ] MergedLoadStoreMotion
[ ] Lazy Value Information Analysis

General IPO:
[ ] Dead Argument Elimination
[ ] Deduce function attributes in RPO

Loop stuff / vectorization stuff:
[ ] Alignment from assumptions
[ ] Canonicalize natural loops
[ ] Delete dead loops
[ ] Loop Access Analysis
[ ] Loop Invariant Code Motion
[ ] Loop Vectorization
[ ] SLP Vectorizer
[ ] Unroll loops

Devirtualization / CFI:
[ ] Cross-DSO CFI
[ ] Whole program devirtualization
[ ] Lower bitset metadata

CGSCC passes:
[ ] Function Integration/Inlining
[ ] Remove unused exception handling info
[ ] Promote 'by reference' arguments to scalars

Please let me know if you are interested in working on any of the passes
in the above list (e.g. reply to the post-commit thread for this patch).
I'll probably be tackling "General Scalar" and "General IPO" first FWIW.

Steps as I port "Deduce function attributes in RPO"
---------------------------------------------------

(note: if you are doing any work based on these notes, please leave a
note in the post-commit review thread for this commit with any
improvements / suggestions / incompleteness you ran into!)

Note: "Deduce function attributes in RPO" is a module pass.

1. Do preparatory refactoring.

Do preparatory factoring. In this case all I had to do was to pull out a static helper (r272503).
(TODO: give more advice here e.g. if pass holds state or something)

2. Rename the old pass class.

llvm/lib/Transforms/IPO/FunctionAttrs.cpp
Rename class ReversePostOrderFunctionAttrs -> ReversePostOrderFunctionAttrsLegacyPass
in preparation for adding a class ReversePostOrderFunctionAttrs as the pass in the new PM.
(edit: actually wait what? The new class name will be
ReversePostOrderFunctionAttrsPass, so it doesn't conflict. So this step is
sort of useless churn).

llvm/include/llvm/InitializePasses.h
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/Transforms/IPO/IPO.cpp
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
Rename initializeReversePostOrderFunctionAttrsPass -> initializeReversePostOrderFunctionAttrsLegacyPassPass
(note that the "PassPass" thing falls out of `s/ReversePostOrderFunctionAttrs/ReversePostOrderFunctionAttrsLegacyPass/`)
Note that the INITIALIZE_PASS macro is what creates this identifier name, so renaming the class requires this renaming too.

Note that createReversePostOrderFunctionAttrsPass does not need to be
renamed since its name is not generated from the class name.

3. Add the new PM pass class.

In the new PM all passes need to have their
declaration in a header somewhere, so you will often need to add a header.
In this case
llvm/include/llvm/Transforms/IPO/FunctionAttrs.h is already there because
PostOrderFunctionAttrsPass was already ported.
The file-level comment from the .cpp file can be used as the file-level
comment for the new header. You may want to tweak the wording slightly
from "this file implements" to "this file provides" or similar.

Add declaration for the new PM pass in this header:

    class ReversePostOrderFunctionAttrsPass
        : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {
    public:
      PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
    };

Its name should end with `Pass` for consistency (note that this doesn't
collide with the names of most old PM passes). E.g. call it
`<name of the old PM pass>Pass`.

Also, move the doxygen comment from the old PM pass to the declaration of
this class in the header.
Also, include the declaration for the new PM class
`llvm/Transforms/IPO/FunctionAttrs.h` at the top of the file (in this case,
it was already done when the other pass in this file was ported).

Now define the `run` method for the new class.
The main things here are:
a) Use AM.getResult<...>(M) to get results instead of `getAnalysis<...>()`

b) If the old PM pass would have returned "false" (i.e. `Changed ==
false`), then you should return PreservedAnalyses::all();

c) In the old PM getAnalysisUsage method, observe the calls
   `AU.addPreserved<...>();`.

   In the case `Changed == true`, for each preserved analysis you should do
   call `PA.preserve<...>()` on a PreservedAnalyses object and return it.
   E.g.:

       PreservedAnalyses PA;
       PA.preserve<CallGraphAnalysis>();
       return PA;

Note that calls to skipModule/skipFunction are not supported in the new PM
currently, so optnone and optimization bisect support do not work. You can
just drop those calls for now.

4. Add the pass to the new PM pass registry to make it available in opt.

In llvm/lib/Passes/PassBuilder.cpp add a #include for your header.
`#include "llvm/Transforms/IPO/FunctionAttrs.h"`
In this case there is already an include (from when
PostOrderFunctionAttrsPass was ported).

Add your pass to llvm/lib/Passes/PassRegistry.def
In this case, I added
`MODULE_PASS("rpo-functionattrs", ReversePostOrderFunctionAttrsPass())`
The string is from the `INITIALIZE_PASS*` macros used in the old pass
manager.

Then choose a test that uses the pass and use the new PM `-passes=...` to
run it.
E.g. in this case there is a test that does:
; RUN: opt < %s -basicaa -functionattrs -rpo-functionattrs -S | FileCheck %s
I have added the line:
; RUN: opt < %s -aa-pipeline=basic-aa -passes='require<targetlibinfo>,cgscc(function-attrs),rpo-functionattrs' -S | FileCheck %s
The `-aa-pipeline=basic-aa` and
`require<targetlibinfo>,cgscc(function-attrs)` are what is needed to run
functionattrs in the new PM (note that in the new PM "functionattrs"
becomes "function-attrs" for some reason). This is just pulled from
`readattrs.ll` which contains the change from when functionattrs was ported
to the new PM.
Adding rpo-functionattrs causes the pass that was just ported to run.

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

9 years agoMake sure we have a Add/Remove/Has function for various thing that can have attribute.
Amaury Sechet [Sun, 12 Jun 2016 06:17:24 +0000 (06:17 +0000)]
Make sure we have a Add/Remove/Has function for various thing that can have attribute.

Summary: This also deprecated the get attribute function familly.

Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael, jyknight

Subscribers: axw, joker.eph, llvm-commits

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

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

9 years agoFactor out a helper. NFC
Sean Silva [Sun, 12 Jun 2016 05:44:51 +0000 (05:44 +0000)]
Factor out a helper. NFC

Prep for porting to new PM.

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

9 years ago[X86] Pre-allocate some of the shuffle mask SmallVectors in the auto upgrade code...
Craig Topper [Sun, 12 Jun 2016 04:48:00 +0000 (04:48 +0000)]
[X86] Pre-allocate some of the shuffle mask SmallVectors in the auto upgrade code instead of calling push_back in a loop. This removes the need to check if the vector needs to grow on each iteration.

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

9 years ago[AVX512] Remove the masked palignr intrinsics that I forgot to remove when I added...
Craig Topper [Sun, 12 Jun 2016 04:14:13 +0000 (04:14 +0000)]
[AVX512] Remove the masked palignr intrinsics that I forgot to remove when I added auto-upgrade code to turn them into shufflevectors and selects.

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

9 years ago[X86] Greatly simplify the llvm.x86.avx.vpermil.* auto-upgrade code. We can fully...
Craig Topper [Sun, 12 Jun 2016 03:10:47 +0000 (03:10 +0000)]
[X86] Greatly simplify the llvm.x86.avx.vpermil.* auto-upgrade code. We can fully derive everything using types of the intrinsic arguments rather than writing separate loops for each intrinsic. NFC

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

9 years ago[MergedLoadStoreMotion] Use correct helper for load hoist safety.
Eli Friedman [Sun, 12 Jun 2016 02:11:20 +0000 (02:11 +0000)]
[MergedLoadStoreMotion] Use correct helper for load hoist safety.

It isn't legal to hoist a load past a call which might not return;
even if it doesn't throw, it could, for example, call exit().

Fixes http://llvm.org/PR27953.

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

9 years ago[X86] Move tests for llvm.x86.avx.vpermil.* intrinsics to a -upgrade test since they...
Craig Topper [Sun, 12 Jun 2016 01:41:06 +0000 (01:41 +0000)]
[X86] Move tests for llvm.x86.avx.vpermil.* intrinsics to a -upgrade test since they are autoupgraded to shufflevector.

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