oota-llvm.git
8 years agoRemove DataLayout from TargetLoweringObjectFile, redirect to Module
Mehdi Amini [Thu, 16 Jul 2015 06:04:17 +0000 (06:04 +0000)]
Remove DataLayout from TargetLoweringObjectFile, redirect to Module

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: yaron.keren, rafael, llvm-commits, jholewinski

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoRedirect pointerSize query to the TargetMachine in ASMPrinter
Mehdi Amini [Thu, 16 Jul 2015 05:59:25 +0000 (05:59 +0000)]
Redirect pointerSize query to the TargetMachine in ASMPrinter

Summary:
Because llvm-dsymutil is using ASMPrinter without any MachineFunction
of Module available.

This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: yaron.keren, rafael, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years ago[LAA] Split out a helper to check the pointer partitions, NFC
Adam Nemet [Thu, 16 Jul 2015 02:48:05 +0000 (02:48 +0000)]
[LAA] Split out a helper to check the pointer partitions, NFC

This is made a static public member function to allow the transition of
this logic from LAA to LoopDistribution.  (Technically, it could be an
implementation-local static function but then it would not be accessible
from LoopDistribution.)

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

8 years agoRevert "[X86] Allow more call sequences to use push instructions for argument passing"
Reid Kleckner [Thu, 16 Jul 2015 01:30:00 +0000 (01:30 +0000)]
Revert "[X86] Allow more call sequences to use push instructions for argument passing"

It miscompiles some code and a reduced test case has been sent to the
author.

This reverts commit r240257.

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

8 years agoRevert "Update LLVM bindings after r239940. ..."
Reid Kleckner [Thu, 16 Jul 2015 01:16:39 +0000 (01:16 +0000)]
Revert "Update LLVM bindings after r239940. ..."

Revert the changes to the C API LLVMBuildLandingPad that were part of
the personality function move. We now set the personality on the parent
function when the C API attempts to construct a landingpad with a
personality.

This reverts commit r240010.

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

8 years agoFix broken testcase from r242358.
Alex Lorenz [Thu, 16 Jul 2015 00:58:33 +0000 (00:58 +0000)]
Fix broken testcase from r242358.

The testcase failed on non X86 targets, because I forgot to pass the
'-march=x86-64' option into llc for one of the X86 specific tests.

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

8 years ago[ARM] Define a subtarget feature that is used to avoid using movt/movw
Akira Hatanaka [Thu, 16 Jul 2015 00:58:23 +0000 (00:58 +0000)]
[ARM] Define a subtarget feature that is used to avoid using movt/movw
pairs for 32-bit immediates.

This change is needed to avoid emitting movt/movw pairs when doing LTO
and do so on a per-function basis.

Out-of-tree projects currently using cl::opt option -arm-use-movt=0 or
false to avoid emitting movt/movw pairs should make changes to add
subtarget feature "+no-movt" (see the changes made to clang in r242368).

rdar://problem/21529937

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

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

8 years agoTrying to fix the windows bots.
Rafael Espindola [Thu, 16 Jul 2015 00:38:34 +0000 (00:38 +0000)]
Trying to fix the windows bots.

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

8 years agoFix handling of relative paths in thin archives.
Rafael Espindola [Thu, 16 Jul 2015 00:14:49 +0000 (00:14 +0000)]
Fix handling of relative paths in thin archives.

The member has to end up with a path relative to the archive.

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

8 years agoClear kill flags in ARMLoadStoreOptimizer.
Pete Cooper [Thu, 16 Jul 2015 00:09:18 +0000 (00:09 +0000)]
Clear kill flags in ARMLoadStoreOptimizer.

The pass here was clearing kill flags on instructions which had
their sources killed in the instruction being combined.  But
given that the new instruction is inserted after the existing ones,
any existing instructions with kill flags will lead to the verifier
complaining that we are reading an undefined physreg.

For example, what we had prior to this optimization is
t2STRi12 %R1, %SP, 12
t2STRi12 %R1<kill>, %SP, 16
t2STRi12 %R0<kill>, %SP, 8

and prior to this fix that would generate
t2STRi12 %R1<kill>, %SP, 16
t2STRDi8 %R0<kill>, %R1, %SP, 8

This is clearly incorrect as it didn't clear the kill flag on R1
used with offset 16 because there was no kill flag on the instruction
with offset 12.

After this change we clear the kill flag on the offset 16 instruction
because we know it will be used afterwards in the new instruction.

I haven't provided a test case.  I have a small test, but even it is
very sensitive to register allocation order which isn't ideal.

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

8 years agoMIR Serialization: Serialize the jump table index operands.
Alex Lorenz [Wed, 15 Jul 2015 23:38:35 +0000 (23:38 +0000)]
MIR Serialization: Serialize the jump table index operands.

Reviewers: Duncan P. N. Exon Smith

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

8 years agoMIR Serialization: Serialize the jump table info.
Alex Lorenz [Wed, 15 Jul 2015 23:31:07 +0000 (23:31 +0000)]
MIR Serialization: Serialize the jump table info.

The jump table info is serialized using a YAML mapping that contains its kind
and a YAML sequence of jump table entries. A jump table entry is a YAML mapping
that has an ID and an inline YAML sequence of machine basic block references.

The testcase 'CodeGen/MIR/X86/jump-table-info.mir' doesn't have any instructions
because one of them contains a jump table index operand. The jump table index
operands will be serialized in a follow up patch, and the appropriate
instructions will be added to this testcase.

Reviewers: Duncan P. N. Exon Smith

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

8 years agoAdd a test for r242281 from an old patch of mine.
Sean Silva [Wed, 15 Jul 2015 23:23:02 +0000 (23:23 +0000)]
Add a test for r242281 from an old patch of mine.

This isn't thorough, but should serve as a sanity check.

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

8 years agoRemove a private member of BranchProbabilityInfo which is not used at all.
Cong Hou [Wed, 15 Jul 2015 23:20:34 +0000 (23:20 +0000)]
Remove a private member of BranchProbabilityInfo which is not used at all.

The member to be removed is LoopInfo *LI.

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

8 years agollvm-ar: Don't write the directory in the string table.
Rafael Espindola [Wed, 15 Jul 2015 23:15:33 +0000 (23:15 +0000)]
llvm-ar: Don't write the directory in the string table.

We were already doing the right thing for short file names, but not long
ones.

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

8 years agoCreate a wrapper pass for BranchProbabilityInfo.
Cong Hou [Wed, 15 Jul 2015 22:48:29 +0000 (22:48 +0000)]
Create a wrapper pass for BranchProbabilityInfo.

This new wrapper pass is useful when we want to do branch probability analysis conditionally (e.g. only in PGO mode) but don't want to add one more pass dependence.

http://reviews.llvm.org/D11241

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

8 years agoSilence GCC -Wparenthesis warning
David Majnemer [Wed, 15 Jul 2015 22:48:26 +0000 (22:48 +0000)]
Silence GCC -Wparenthesis warning

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

8 years agoFor new archive member we only need to store the full path.
Rafael Espindola [Wed, 15 Jul 2015 22:46:53 +0000 (22:46 +0000)]
For new archive member we only need to store the full path.

We were storing both the path and the file name, which was redundant
and easy to get confused up with.

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

8 years ago[LoopUnswitch] Add an else clause to IsTrivialUnswitchCondition() when checking Heade...
Chen Li [Wed, 15 Jul 2015 22:41:13 +0000 (22:41 +0000)]
[LoopUnswitch] Add an else clause to IsTrivialUnswitchCondition() when checking HeaderTerm instruction type

Summary:
This is a trivial code change with no functionality effect.

When LoopUnswitch determines trivial unswitch condition, it checks whether the loop header's terminator instruction is a branch instruction or switch instruction since trivial unswitch condition can only apply to these two instruction types. The current code does not fail the check directly on other instruction types, but check the nullness of LoopExitBB variable instead. The added else clause makes the check fail immediately on other instruction types and makes the code more obvious.

Reviewers: reames

Subscribers: llvm-commits

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

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

8 years agotest-release.sh: Run both .o files through sed before comparing them
Hans Wennborg [Wed, 15 Jul 2015 22:18:25 +0000 (22:18 +0000)]
test-release.sh: Run both .o files through sed before comparing them

On some systems (e.g. Mac OS X), sed will add a newline to the end of
the output if there wasn't one already. This would cause false
cmp errors since the .o file from Phase 2 was passed through sed and
the one from Phase 3 wasn't. Work around this by passing both through
sed.

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

8 years agoTargetRegisterInfo: Provide a way to check assigned registers in getRegAllocationHints()
Matthias Braun [Wed, 15 Jul 2015 22:16:00 +0000 (22:16 +0000)]
TargetRegisterInfo: Provide a way to check assigned registers in getRegAllocationHints()

Pass a const reference to LiveRegMatrix to getRegAllocationHints()
because some targets can prodive better hints if they can test whether a
physreg has been used for register allocation yet.

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

8 years agoMIR Serialization: Serialize references from the stack objects to named allocas.
Alex Lorenz [Wed, 15 Jul 2015 22:14:49 +0000 (22:14 +0000)]
MIR Serialization: Serialize references from the stack objects to named allocas.

This commit serializes the references to the named LLVM alloca instructions from
the stack objects in the machine frame info. This commit adds a field 'Name' to
the struct 'yaml::MachineStackObject'. This new field is used to store the name
of the alloca instruction when the alloca is present and when it has a name.

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

8 years agoAdd a "debugger tuning" concept that allows us to fine-tune how we
Paul Robinson [Wed, 15 Jul 2015 22:04:54 +0000 (22:04 +0000)]
Add a "debugger tuning" concept that allows us to fine-tune how we
emit debug info, according to the preferences of the different
debuggers used on various targets.
Darwin and FreeBSD default to tuning for LLDB; PS4 defaults to tuning for
the SCE (Sony Computer Entertainment) debugger.  All others default to GDB.

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

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

8 years agoFix mergefunc infinite loop
JF Bastien [Wed, 15 Jul 2015 21:51:33 +0000 (21:51 +0000)]
Fix mergefunc infinite loop

Self-referential constants containing references to a merged function
no longer cause the MergeFunctions pass to infinite loop. Also adds a
reproduction IR which would otherwise fail, which was isolated from a similar
issue in Chromium.

Author: jrkoenig
Reviewers: nlewycky, jfb
Subscribers: llvm-commits, nlewycky, jfb

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

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

8 years agoSimplify a few uses of remove_filename by using parent_path instead.
Rafael Espindola [Wed, 15 Jul 2015 21:24:07 +0000 (21:24 +0000)]
Simplify a few uses of remove_filename by using parent_path instead.

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

8 years agoSwitch the release script to build with CMake by default (PR21561)
Hans Wennborg [Wed, 15 Jul 2015 21:06:16 +0000 (21:06 +0000)]
Switch the release script to build with CMake by default (PR21561)

It retains the possibility to use the autoconf build with a
command-line option ('-use-autoconf'), and uses that by default on Darwin since
compiler-rt requires it on that platform.

This commit also removes the "Release-64" flavour and related logic. The script
would previously do two builds unless the '-no-64bit' flag was passed, but on
my machine and from those I asked this always ended up producing two 64-bit builds,
causing much confusion.

It also removes the -build-triple option, which caused the --build= flag to
get passed to ./configure. This was presumably intended for cross-compiling,
but none of the release testers use it. If someone does want to pass it,
they can use '-configure-flags --build=foo' instead.

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

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

8 years agoHandle the error of trying to convert a regular archive to a thin one.
Rafael Espindola [Wed, 15 Jul 2015 20:45:56 +0000 (20:45 +0000)]
Handle the error of trying to convert a regular archive to a thin one.

While at it, test that we can add to a thin archive.

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

8 years agoRename doFunction() in BFI to calculate() and change its parameters from pointers...
Cong Hou [Wed, 15 Jul 2015 19:58:26 +0000 (19:58 +0000)]
Rename doFunction() in BFI to calculate() and change its parameters from pointers to references.

http://reviews.llvm.org/D11196

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

8 years agoAnalyze recursive PHI nodes in BasicAA
Tobias Edler von Koch [Wed, 15 Jul 2015 19:32:22 +0000 (19:32 +0000)]
Analyze recursive PHI nodes in BasicAA

Summary:
This patch allows phi nodes like
  %x = phi [ %incptr, ... ] [ %var, ... ]
  %incptr = getelementptr %x, 1
to be analyzed by BasicAliasAnalysis.

In aliasPHI, we can detect incoming values that are recursive GEPs with a
constant offset. Instead of trying to analyze a recursive GEP (and failing),
we now ignore it and instead set the size of the memory referenced by
the PHINode to UnknownSize. This represents all the possible memory
locations the pointer represented by the PHINode could be advanced to
by the GEP.

For now, this new behavior is turned off by default to allow debugging of
performance degradations seen with SPEC/x86 and Hexagon benchmarks.
The flag -basicaa-recphi turns it on.

Reviewers: hfinkel, sanjoy

Subscribers: tobiasvk_caf, sanjoy, llvm-commits

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

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

8 years agoRevert "Refactor optimizeUncoalescable logic"
Bruno Cardoso Lopes [Wed, 15 Jul 2015 18:10:46 +0000 (18:10 +0000)]
Revert "Refactor optimizeUncoalescable logic"

Likely broke compilation on ARM:

http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/13054

This reverts commit 0b7824464fbe3d3f386e2d4aef6a431422709e53.

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

8 years agoRevert "Look through PHIs to find additional register sources"
Bruno Cardoso Lopes [Wed, 15 Jul 2015 18:10:35 +0000 (18:10 +0000)]
Revert "Look through PHIs to find additional register sources"

Likely broke compilation on ARM:

http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/13054

This reverts commit 131ce4a838c081516cbfed039fc986b33e3979d6.

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

8 years agoTest commit.
Cong Hou [Wed, 15 Jul 2015 17:58:15 +0000 (17:58 +0000)]
Test commit.

This is a test commit (one blank line deleted).

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

8 years agoDelete declared but not implemented functions.
Rafael Espindola [Wed, 15 Jul 2015 17:19:39 +0000 (17:19 +0000)]
Delete declared but not implemented functions.

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

8 years agoDebug Info: Add basic support for external types references.
Adrian Prantl [Wed, 15 Jul 2015 17:01:41 +0000 (17:01 +0000)]
Debug Info: Add basic support for external types references.
This is a necessary prerequisite for bootstrapping the emission
of debug info inside modules.

- Adds a FlagExternalTypeRef to DICompositeType.
  External types must have a unique identifier.
- External type references are emitted using a forward declaration
  with a DW_AT_signature([DW_FORM_ref_sig8]) based on the UID.

http://reviews.llvm.org/D9612

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

8 years agoAdd missing load/store flags to thumb2 instructions.
Pete Cooper [Wed, 15 Jul 2015 16:36:38 +0000 (16:36 +0000)]
Add missing load/store flags to thumb2 instructions.

These were the cause of a verifier error when building 7zip with
-verify-machineinstrs.  Running 'make check' with the verifier
triggered the same error on the test here so i've updated the test
to run the verifier on one of its runs instead of adding a new one.

While looking at this code, there was a stale comment that these
instructions were only used for disassembly.  This probably used to
be the case, but they are now used in the 'ARM load / store optimization pass' too.

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

8 years ago[PPC64LE] Fix vec_sld semantics for little endian
Bill Schmidt [Wed, 15 Jul 2015 15:45:30 +0000 (15:45 +0000)]
[PPC64LE] Fix vec_sld semantics for little endian

The vec_sld interface provides access to the vsldoi instruction.
Unlike most of the vec_* interfaces, we do not attempt to change the
generated code for vec_sld based on the endian mode.  It is too
difficult to correctly infer the desired semantics because of
different element types, and the corrected instruction sequence is
expensive, involving loading a permute control vector and performing a
generalized permute.

For GCC, this was implemented as "Don't touch the vec_sld"
implementation.  When it came time for the LLVM implementation, I did
the same thing.  However, this was hasty and incorrect.  In LLVM's
version of altivec.h, vec_sld was previously defined in terms of the
vec_perm interface.  Because vec_perm semantics are adjusted for
little endian, this means that leaving vec_sld untouched causes it to
generate something different for LE than for BE.  Not good.

This back-end patch accompanies the changes to altivec.h that change
vec_sld's behavior for little endian.  Those changes mean that we see
slightly different code in the back end when trying to recognize a
VSLDOI instruction in isVSLDOIShuffleMask.  In particular, a
ShuffleKind of 1 (where the two inputs are identical) must now be
treated the same way as a ShuffleKind of 2 (little endian with
different inputs) when little endian mode is in force.  This is
because ShuffleKind of 1 is defined using big-endian numbering.

This has a ripple effect on LowerBUILD_VECTOR, where we create our own
internal VSLDOI instructions.  Because these are a ShuffleKind of 1,
they will now have their shift amounts subtracted from 16 when
recognizing the shuffle mask.  To avoid problems we have to subtract
them from 16 again before creating the VSLDOI instructions.

There are a couple of other uses of BuildVSLDOI, but these do not need
to be modified because the shift amount is 8, which is unchanged when
subtracted from 16.

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

8 years agoLook through PHIs to find additional register sources
Bruno Cardoso Lopes [Wed, 15 Jul 2015 15:35:23 +0000 (15:35 +0000)]
Look through PHIs to find additional register sources

- Teaches the ValueTracker in the PeepholeOptimizer to look through PHI
instructions.
- Add findNextSourceAndRewritePHI method to lookup into multiple sources
returnted by the ValueTracker and rewrite PHIs with new sources.

With these changes we can find more register sources and rewrite more
copies to allow coaslescing of bitcast instructions. Hence, we eliminate
unnecessary VR64 <-> GR64 copies in x86, but it could be extended to
other archs by marking "isBitcast" on target specific instructions. The
x86 example follows:

A:
  psllq %mm1, %mm0
  movd  %mm0, %r9
  jmp C

B:
  por %mm1, %mm0
  movd  %mm0, %r9
  jmp C

C:
  movd  %r9, %mm0
  pshufw  $238, %mm0, %mm0

Becomes:

A:
  psllq %mm1, %mm0
  jmp C

B:
  por %mm1, %mm0
  jmp C

C:
  pshufw  $238, %mm0, %mm0

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

rdar://problem/20404526

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

8 years agoRefactor optimizeUncoalescable logic
Bruno Cardoso Lopes [Wed, 15 Jul 2015 15:35:09 +0000 (15:35 +0000)]
Refactor optimizeUncoalescable logic

- Create a new CopyRewriter for Uncoalescable copy-like instructions
- Change the ValueTracker to return a ValueTrackerResult

This makes optimizeUncoalescable looks more like optimizeCoalescable and
use the CopyRewritter infrastructure.

This is also the preparation for looking up into PHI nodes in the
ValueTracker.

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

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

8 years agoExpose setPersonalityFn to Go
Andrew Wilkins [Wed, 15 Jul 2015 13:03:08 +0000 (13:03 +0000)]
Expose setPersonalityFn to Go

Summary:
Add Value.SetPersonality to the Go bindings. The Go
bindings' Builder.CreateLandingPad has been updated,
removing the obsolete personality argument.

Background

The personality attribute was removed from LandingPadInst
in r239940, and llvm::Function::setPersonalityFn introduced.

There was no corresponding change to either the C API or
Go bindings. The Go bindings were broken until r239940, but
that change was just to ignore the personality argument.
This broke llgo.

Reviewers: majnemer, pcc

Subscribers: deadalnix, llvm-commits, axw

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

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

8 years ago[PPC] Disassemble little endian ppc instructions in the right byte order
Benjamin Kramer [Wed, 15 Jul 2015 12:56:19 +0000 (12:56 +0000)]
[PPC] Disassemble little endian ppc instructions in the right byte order

PR24122. The test is simply a byte swapped version of ppc64-encoding.txt.

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

8 years ago-Added API for retrieving the default FPU of a CPU from TargetParser.
Alexandros Lamprineas [Wed, 15 Jul 2015 10:46:21 +0000 (10:46 +0000)]
-Added API for retrieving the default FPU of a CPU from TargetParser.
-Implemented as a table lookup.

Change-Id: Iaad0eaf4b29b06827e6700269496dc1ba20e9018
Phabricator: http://reviews.llvm.org/D11100

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

8 years ago[PM/AA] Fix *numerous* serious bugs in GlobalsModRef found by
Chandler Carruth [Wed, 15 Jul 2015 08:53:29 +0000 (08:53 +0000)]
[PM/AA] Fix *numerous* serious bugs in GlobalsModRef found by
inspection.

While we want to handle calls specially in this code because they should
have been modeled by the call graph analysis that precedes it, we should
*not* be re-implementing the predicates for whether an instruction reads
or writes memory. Those are well defined already. Notably, at least the
following issues seem to be clearly missed before:
- Ordered atomic loads can "write" to memory by causing writes from other
  threads to become visible. Similarly for ordered atomic stores.
- AtomicRMW instructions quite obviously both read and write to memory.
- AtomicCmpXchg instructions also read and write to memory.
- Fences read and write to memory.
- Invokes of intrinsics or memory allocation functions.

I don't have any test cases, and I suspect this has never really come up
in the real world. But there is no reason why it wouldn't, and it makes
the code simpler to do this the right way.

While here, I've tried to make the loops significantly simpler as well
and added helpful comments as to what is going on.

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

8 years ago[SDAG] Optimize unordered comparison in soft-float mode (patch by Anton Nadolskiy)
Alexey Bataev [Wed, 15 Jul 2015 08:39:35 +0000 (08:39 +0000)]
[SDAG] Optimize unordered comparison in soft-float mode (patch by Anton Nadolskiy)

Current implementation handles unordered comparison poorly in soft-float mode.
Consider (a ULE b) which is a <= b. It is lowered to (ledf2(a, b) <= 0 || unorddf2(a, b) != 0) (in general). We can do better job by lowering it to (__gtdf2(a, b) <= 0).
Such replacement is true for other CMP's (ult, ugt, uge). In general, we just call same function as for ordered case but negate comparison against zero.
Differential Revision: http://reviews.llvm.org/D10804

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

8 years ago[PowerPC] Use the MachineCombiner to reassociate fadd/fmul
Hal Finkel [Wed, 15 Jul 2015 08:23:05 +0000 (08:23 +0000)]
[PowerPC] Use the MachineCombiner to reassociate fadd/fmul

This is a direct port of the code from the X86 backend (r239486/r240361), which
uses the MachineCombiner to reassociate (floating-point) adds/muls to increase
ILP, to the PowerPC backend. The rationale is the same.

There is a lot of copy-and-paste here between the X86 code and the PowerPC
code, and we should extract at least some of this into CodeGen somewhere.
However, I don't want to do that until this code is enhanced to handle FMAs as
well. After that, we'll be in a better position to extract the common parts.

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

8 years ago[PowerPC] Extend physical register live range in PPCVSXFMAMutate
Hal Finkel [Wed, 15 Jul 2015 08:23:03 +0000 (08:23 +0000)]
[PowerPC] Extend physical register live range in PPCVSXFMAMutate

If the source of the copy that defines the addend is a physical register, then
its existing live range may not extend to the FMA being mutated. Make sure we
extend the live range of the register to meet the FMA because it will become
its operand in this case.

I don't have an independent test case, but it will be exposed by change to be
committed shortly enabling the use of the machine combiner to do fadd/fmul
reassociation, and will be covered by one of the associated regression tests.

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

8 years ago[MachineCombiner] Work with itineraries
Hal Finkel [Wed, 15 Jul 2015 08:22:23 +0000 (08:22 +0000)]
[MachineCombiner] Work with itineraries

MachineCombiner predicated its use of scheduling-based metrics on
hasInstrSchedModel(), but useful conclusions can be drawn from pipeline
itineraries as well. Almost all of the logic (except for resource tracking in
preservesResourceLen) can be used if we have an itinerary, so enable it in that
case as well.

This will be used by the PowerPC backend in an upcoming commit.

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

8 years ago[AArch64] Fix problems in decoding generic MSR instructions
Petr Pavlu [Wed, 15 Jul 2015 08:10:30 +0000 (08:10 +0000)]
[AArch64] Fix problems in decoding generic MSR instructions

Bitpatterns rejected by the decoder method of `MSR (immediate)` should be
decoded as the `extended MSR (register)` instruction.

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

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

8 years ago[PM/AA] Cleanup some loops to be range-based. NFC.
Chandler Carruth [Wed, 15 Jul 2015 08:09:23 +0000 (08:09 +0000)]
[PM/AA] Cleanup some loops to be range-based. NFC.

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

8 years ago[TableGen] Improve decoding options for non-orthogonal instructions
Petr Pavlu [Wed, 15 Jul 2015 08:04:27 +0000 (08:04 +0000)]
[TableGen] Improve decoding options for non-orthogonal instructions

When FixedLenDecoder matches an input bitpattern of form [01]+ with an
instruction bitpattern of form [01?]+ (where 0/1 are static bits and ? are
mixed/variable bits) it passes the input bitpattern to a specific instruction
decoder method which then makes a final decision whether the bitpattern is a
valid instruction or not. This means the decoder must handle all possible
values of the variable bits which sometimes leads to opcode rewrites in the
decoder method when the instructions are not fully orthogonal.

The patch provides a way for the decoder method to say that when it returns
Fail it does not necessarily mean the bitpattern is invalid, but rather that
the bitpattern is definitely not an instruction that is recognized by the
decoder method. The decoder can then try to match the input bitpattern with
other possible instruction bitpatterns.

For example, this allows to solve a situation on AArch64 where the `MSR
(immediate)` instruction has form:
1101 0101 0000 0??? 0100 ???? ???1 1111
but not all values of the ? bits are allowed. The rejected values should be
handled by the `extended MSR (register)` instruction:
1101 0101 000? ???? ???? ???? ???? ????

The decoder will first try to decode an input bitpattern that matches both
bitpatterns as `MSR (immediate)` but currently this puts the decoder method of
`MSR (immediate)` into a situation when it must be able to decode all possible
values of the ? bits, i.e. it would need to rewrite the instruction to `MSR
(register)` when it is not `MSR (immediate)`.

The patch allows to specify that the decoder method cannot determine if the
instruction is valid for all variable values. The decoder method can simply
return Fail when it knows it is definitely not `MSR (immediate)`. The decoder
will then backtrack the decoding and find that it can match the input
bitpattern with the more generic `MSR (register)` bitpattern too.

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

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

8 years ago[X86][SSE] Added i686/SSE2 vector shift tests.
Simon Pilgrim [Wed, 15 Jul 2015 08:04:07 +0000 (08:04 +0000)]
[X86][SSE] Added i686/SSE2 vector shift tests.

We were only testing on x86-64, but we should be ensuring decent code gen of i64 shifts on 32-bit targets.

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

8 years agoAVX : Fix ISA disabling in case AVX512VL , some instructions should be disabled only...
Igor Breger [Wed, 15 Jul 2015 07:08:10 +0000 (07:08 +0000)]
AVX : Fix ISA disabling in case AVX512VL , some instructions should be disabled only if AVX512BW present.
Tests added.

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

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

8 years agoInitial support for writing thin archives.
Rafael Espindola [Wed, 15 Jul 2015 05:47:46 +0000 (05:47 +0000)]
Initial support for writing thin archives.

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

8 years agoTidy-up test case from r242257.
Michael Zolotukhin [Wed, 15 Jul 2015 01:51:51 +0000 (01:51 +0000)]
Tidy-up test case from r242257.

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

8 years ago[vim] Update the syntax to mark REQUIRES lines and not talk about
Chandler Carruth [Wed, 15 Jul 2015 01:48:40 +0000 (01:48 +0000)]
[vim] Update the syntax to mark REQUIRES lines and not talk about
dejagnu.

I wonder if it would be useful to handle FileCheck prefixes specially?
Especially if we could get some error checking. Suggestions welcome.
Patches more welcome as I have no idea what I'm doing with vim
script....

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

8 years ago[vim] Add the IR's comment prefix to the comments list. This allows vim
Chandler Carruth [Wed, 15 Jul 2015 01:36:50 +0000 (01:36 +0000)]
[vim] Add the IR's comment prefix to the comments list. This allows vim
to intelligently wrap prose written in IR comment blocks. This has
bothered me for roughly ever, and my fellow IRC denziens convinced me to
fix it.

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

8 years agoUse enum instead of unsigned. NFC.
Pete Cooper [Wed, 15 Jul 2015 01:31:26 +0000 (01:31 +0000)]
Use enum instead of unsigned.  NFC.

The unsigned opcode argument here was the result of BinaryOperator->getOpcode().
That returns a BinaryOps enum which is more accurate than passing around an
unsigned.

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

8 years agoUse cast<> instead of dyn_cast to remove llvm_unreachable. NFC.
Pete Cooper [Wed, 15 Jul 2015 01:31:23 +0000 (01:31 +0000)]
Use cast<> instead of dyn_cast to remove llvm_unreachable.  NFC.

This code was checking if we are an ICmpInst or FCmpInst then throwing
unreachable if we are neither.  We must be one or the other, so use a
cast on the FCmpInst case to ensure that we are that case.  Then we can
avoid having an unreachable but still catch an error if we ever had another
subclass of CmpInst.

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

8 years agoUse another foreach loop. NFC
Pete Cooper [Wed, 15 Jul 2015 01:31:20 +0000 (01:31 +0000)]
Use another foreach loop.  NFC

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

8 years agoUse getAnyExtOrTrunc helper instead of manually doing ext/trunc check. NFC.
Pete Cooper [Wed, 15 Jul 2015 00:43:57 +0000 (00:43 +0000)]
Use getAnyExtOrTrunc helper instead of manually doing ext/trunc check.  NFC.

The code here was doing exactly what is already in getAnyExtOrTrunc().
Just use that method instead.

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

8 years agoUse getZExtOrTrunc helper instead of manually doing zext/trunc check. NFC.
Pete Cooper [Wed, 15 Jul 2015 00:43:54 +0000 (00:43 +0000)]
Use getZExtOrTrunc helper instead of manually doing zext/trunc check.  NFC.

The code here was doing exactly what is already in getZExtOrTrunc().
Just use that method instead.

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

8 years ago[LoopUnrolling] Handle cast instructions.
Michael Zolotukhin [Wed, 15 Jul 2015 00:19:51 +0000 (00:19 +0000)]
[LoopUnrolling] Handle cast instructions.

During estimation of unrolling effect we should be able to propagate
constants through casts.

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

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

8 years agoChange conditional to assert. NFC.
Pete Cooper [Wed, 15 Jul 2015 00:07:57 +0000 (00:07 +0000)]
Change conditional to assert.  NFC.

This code was breaking from the case statement if the getStoreSizeInBits()
value was not a multiple of 0.  Given that the implementation returns
getStoreSize() * 8, it can only be a multiple of 8.

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

8 years agoUse getStoreSize() instead of getStoreSizeInBits()/8. NFC.
Pete Cooper [Wed, 15 Jul 2015 00:07:55 +0000 (00:07 +0000)]
Use getStoreSize() instead of getStoreSizeInBits()/8.  NFC.

The calls here were both to getStoreSizeInBits() which multiplies by 8.
We then immediately divided by 8.  Calling getStoreSize() returns the
values we need without the extra arithmetic.

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

8 years agoUse a range loop.
Rafael Espindola [Tue, 14 Jul 2015 23:51:01 +0000 (23:51 +0000)]
Use a range loop.

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

8 years agoUse more foreach loops in SelectionDAG. NFC
Pete Cooper [Tue, 14 Jul 2015 23:43:29 +0000 (23:43 +0000)]
Use more foreach loops in SelectionDAG.  NFC

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

8 years agoCreate a wrapper pass for BlockFrequencyInfo.
Wei Mi [Tue, 14 Jul 2015 23:40:50 +0000 (23:40 +0000)]
Create a wrapper pass for BlockFrequencyInfo.

This is useful when we want to do block frequency analysis
conditionally (e.g. only in PGO mode) but don't want to add
one more pass dependence.

Patch by congh.
Approved by dexonsmith.
Differential Revision: http://reviews.llvm.org/D11196

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

8 years agoFix Sphinx error about duplicate label in CommandLine.rst:1560 and CoverageMappingFor...
Hans Wennborg [Tue, 14 Jul 2015 23:29:53 +0000 (23:29 +0000)]
Fix Sphinx error about duplicate label in CommandLine.rst:1560 and CoverageMappingFormat.rst

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

8 years agoWebAssembly: fix build breakage.
JF Bastien [Tue, 14 Jul 2015 23:06:07 +0000 (23:06 +0000)]
WebAssembly: fix build breakage.

Summary:
processFunctionBeforeCalleeSavedScan was renamed to determineCalleeSaves and now takes a BitVector parameter as of rL242165, reviewed in http://reviews.llvm.org/D10909

WebAssembly is still marked as experimental and therefore doesn't build by default. It does, however, grep by default! I notice that processFunctionBeforeCalleeSavedScan is still mentioned in a few comments and error messages, which I also fixed.

Reviewers: qcolombet, sunfish

Subscribers: jfb, dsanders, hfinkel, MatzeB, llvm-commits

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

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

8 years ago[PowerPC] Support symbolic targets in patchpoints
Hal Finkel [Tue, 14 Jul 2015 22:53:11 +0000 (22:53 +0000)]
[PowerPC] Support symbolic targets in patchpoints

Follow-up r235483, with the corresponding support in PPC. We use a regular call
for symbolic targets (because they're much cheaper than indirect calls).

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

8 years agoReleaseNotes.rst: Bump version to 3.8
Hans Wennborg [Tue, 14 Jul 2015 22:49:27 +0000 (22:49 +0000)]
ReleaseNotes.rst: Bump version to 3.8

The notes for 3.7 are on the 3.7 branch.

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

8 years agoAccept lower case to handle windows error messages.
Rafael Espindola [Tue, 14 Jul 2015 22:42:21 +0000 (22:42 +0000)]
Accept lower case to handle windows error messages.

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

8 years ago[InstCombine] Generalize sub of selects optimization to all BinaryOperators
David Majnemer [Tue, 14 Jul 2015 22:39:23 +0000 (22:39 +0000)]
[InstCombine] Generalize sub of selects optimization to all BinaryOperators

This exposes further optimization opportunities if the selects are
correlated.

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

8 years agoUpdate the trunk version to 3.8.0svn.
Hans Wennborg [Tue, 14 Jul 2015 22:35:57 +0000 (22:35 +0000)]
Update the trunk version to 3.8.0svn.

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

8 years ago[LAA] Turn RuntimePointerChecking into a class, start hiding things, NFC
Adam Nemet [Tue, 14 Jul 2015 22:32:52 +0000 (22:32 +0000)]
[LAA] Turn RuntimePointerChecking into a class, start hiding things, NFC

The goal is to start hiding internal APIs.

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

8 years ago[LAA] Introduce RuntimePointerChecking::PointerInfo, NFC
Adam Nemet [Tue, 14 Jul 2015 22:32:50 +0000 (22:32 +0000)]
[LAA] Introduce RuntimePointerChecking::PointerInfo, NFC

Turn this structure-of-arrays (i.e. the various pointer attributes) into
array-of-structures.

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

8 years ago[LAA] Lift RuntimePointerCheck out of LoopAccessInfo, NFC
Adam Nemet [Tue, 14 Jul 2015 22:32:44 +0000 (22:32 +0000)]
[LAA] Lift RuntimePointerCheck out of LoopAccessInfo, NFC

I am planning to add more nested classes inside RuntimePointerCheck so
all these triple-nesting would be hard to follow.

Also rename it to RuntimePointerChecking (i.e. append 'ing').

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

8 years ago[PowerPC] Use the ABI indirect-call protocol for patchpoints
Hal Finkel [Tue, 14 Jul 2015 22:26:06 +0000 (22:26 +0000)]
[PowerPC] Use the ABI indirect-call protocol for patchpoints

We used to take the address specified as the direct target of the patchpoint
and did no TOC-pointer handling.  This, however, as not all that useful,
because MCJIT tends to create a lot of modules, and they have their own TOC
sections. Thus, to call from the generated code to other generated code, you
really need to switch TOC pointers. Make this work as expected, and under
ELFv1, tread the address as the function descriptor address so that the correct
TOC pointer can be loaded.

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

8 years agoAdd support for reading members out of thin archives.
Rafael Espindola [Tue, 14 Jul 2015 22:18:43 +0000 (22:18 +0000)]
Add support for reading members out of thin archives.

For now the Archive owns the buffers of the thin archive members.
This makes for a simple API, but all the buffers are destructed
only when the archive is destructed. This should be fine since we
close the files after mmap so we should not hit an open file
limit.

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

8 years ago[ExecutionEngine] Re-apply r241962 with fixes for ARM.
Lang Hames [Tue, 14 Jul 2015 22:11:10 +0000 (22:11 +0000)]
[ExecutionEngine] Re-apply r241962 with fixes for ARM.

Patch by Pierre-Andre Saulais. Thanks Pierre-Andre!

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

8 years agoAdd allnodes() iterator range to SelectionDAG. NFC.
Pete Cooper [Tue, 14 Jul 2015 22:10:54 +0000 (22:10 +0000)]
Add allnodes() iterator range to SelectionDAG.  NFC.

SelectionDAG already had begin/end methods for iterating over all
the nodes, but didn't define an iterator_range for us in foreach
loops.

This adds such a method and uses it in some of the eligible places
throughout the backends.

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

8 years agoMove SDNode::IROrder in to padding to save space. NFC.
Pete Cooper [Tue, 14 Jul 2015 21:54:55 +0000 (21:54 +0000)]
Move SDNode::IROrder in to padding to save space.  NFC.

There was a 32-bit padding gap between 'unsigned short NumOperands, NumValues;' and 'DebugLoc debugLoc.  Move 'unsigned IROrder' in to that gap.

This trims the size of SDNode's from 76 bytes (really 80 due to alignment) to 72 bytes.

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

8 years agoConstify parameters in SelectionDAG methods. NFC
Pete Cooper [Tue, 14 Jul 2015 21:54:52 +0000 (21:54 +0000)]
Constify parameters in SelectionDAG methods.  NFC

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

8 years agoRemove unnecessary .getNode() in SelectionDAG. NFC.
Pete Cooper [Tue, 14 Jul 2015 21:54:48 +0000 (21:54 +0000)]
Remove unnecessary .getNode() in SelectionDAG.  NFC.

The simplify_type specialisation allows us to cast directly from
SDValue to an SDNode* subclass so we don't need to pass a SDNode*
to cast<>.

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

8 years agoUse more foreach loops in SelectionDAG. NFC
Pete Cooper [Tue, 14 Jul 2015 21:54:45 +0000 (21:54 +0000)]
Use more foreach loops in SelectionDAG.  NFC

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

8 years agoMIR Serialization: Serialize the machine basic block live in registers.
Alex Lorenz [Tue, 14 Jul 2015 21:24:41 +0000 (21:24 +0000)]
MIR Serialization: Serialize the machine basic block live in registers.

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

8 years agoMIR Printer: move the function 'printReg'. NFC.
Alex Lorenz [Tue, 14 Jul 2015 21:18:25 +0000 (21:18 +0000)]
MIR Printer: move the function 'printReg'. NFC.

This commit moves the function 'printReg' towards the start of the file so that
it can be used by the conversion methods in MIRPrinter and not just the printing
methods in MIPrinter.

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

8 years agoGVN: use a static array instead of regenerating it each time. NFC.
Tim Northover [Tue, 14 Jul 2015 21:14:58 +0000 (21:14 +0000)]
GVN: use a static array instead of regenerating it each time. NFC.

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

8 years agoWebAssembly: add basic int/fp instruction codegen.
JF Bastien [Tue, 14 Jul 2015 21:13:29 +0000 (21:13 +0000)]
WebAssembly: add basic int/fp instruction codegen.

Summary: This patch has the most basic instruction codegen for 32 and 64 bit int/fp.

Reviewers: sunfish

Subscribers: llvm-commits, jfb

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

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

8 years agoFix NDEBUG build warning
Krzysztof Parzyszek [Tue, 14 Jul 2015 21:03:24 +0000 (21:03 +0000)]
Fix NDEBUG build warning

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

8 years agoGVN: tolerate an instruction being replaced without existing in the leaderboard
Tim Northover [Tue, 14 Jul 2015 21:03:18 +0000 (21:03 +0000)]
GVN: tolerate an instruction being replaced without existing in the leaderboard

Sometimes an incidentally created instruction can duplicate a Value used
elsewhere. It then often doesn't end up in the leader table. If it's later
removed, we attempt to remove it from the leader table and segfault.

Instead we should just ignore the removal request, which won't cause any
problems. The reverse situation, where the original instruction is replaced by
the new one (which you might think could leave the leader table empty) cannot
occur, because the incidental instruction will never be found in the first
place.

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

8 years agotest-release.sh: Remove the InstallDir parameter from configure_llvmCore
Hans Wennborg [Tue, 14 Jul 2015 20:15:15 +0000 (20:15 +0000)]
test-release.sh: Remove the InstallDir parameter from configure_llvmCore

After r242187, it's never set.

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

8 years agoFix Windows build: replace __func__ with LLVM_FUNCTION_NAME
Krzysztof Parzyszek [Tue, 14 Jul 2015 20:11:28 +0000 (20:11 +0000)]
Fix Windows build: replace __func__ with LLVM_FUNCTION_NAME

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

8 years ago[MMX] Use the appropriate instructions for GR64 <-> VR64 copies.
Bruno Cardoso Lopes [Tue, 14 Jul 2015 20:09:34 +0000 (20:09 +0000)]
[MMX] Use the appropriate instructions for GR64 <-> VR64 copies.

MOVSDto64rr and MOV64toSDrr are defined to convert between FR64 (%xmm)
<-> GR64 registers, not VR64 (%mm) <-> GR64. This is wrong.

I found this by inspection and could not find a suitable testcase for it
since (1) we don't handle MMX bitcasts in Peephole optimizer as to
generate COPYs that (2) could be expanded back to the appropriate x86
instruction in ExpandPostRA.

Switch to use the appropriate instructions: MMX_MOVD64from64rr and
MMX_MOVD64to64rr here.

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

8 years ago[PowerPC] Fix the PPCInstrInfo::getInstrLatency implementation
Hal Finkel [Tue, 14 Jul 2015 20:02:02 +0000 (20:02 +0000)]
[PowerPC] Fix the PPCInstrInfo::getInstrLatency implementation

PowerPC uses itineraries to describe processor pipelines (and dispatch-group
restrictions for P7/P8 cores). Unfortunately, the target-independent
implementation of TII.getInstrLatency calls ItinData->getStageLatency, and that
looks for the largest cycle count in the pipeline for any given instruction.
This, however, yields the wrong answer for the PPC itineraries, because we
don't encode the full pipeline. Because the functional units are fully
pipelined, we only model the initial stages (there are no relevant hazards in
the later stages to model), and so the technique employed by getStageLatency
does not really work. Instead, we should take the maximum output operand
latency, and that's what PPCInstrInfo::getInstrLatency now does.

This caused some test-case churn, including two unfortunate side effects.
First, the new arrangement of copies we get from function parameters now
sometimes blocks VSX FMA mutation (a FIXME has been added to the code and the
test cases), and we have one significant test-suite regression:

SingleSource/Benchmarks/BenchmarkGame/spectral-norm
56.4185% +/- 18.9398%

In this benchmark we have a loop with a vectorized FP divide, and it with the
new scheduling both divides end up in the same dispatch group (which in this
case seems to cause a problem, although why is not exactly clear). The grouping
structure is hard to predict from the bottom of the loop, and there may not be
much we can do to fix this.

Very few other test-suite performance effects were really significant, but
almost all weakly favor this change. However, in light of the issues
highlighted above, I've left the old behavior available via a
command-line flag.

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

8 years agoFix several issues with the test-release.sh script
Dan Liew [Tue, 14 Jul 2015 19:46:19 +0000 (19:46 +0000)]
Fix several issues with the test-release.sh script

* Use the default install prefix (/usr/local) and use DESTDIR instead to
  set a temporary install location for tarballing. This is the correct
  way to package binary releases (otherwise the temporary install path
  ends up in files in the binary release).
* Remove ``-disable-clang`` option. It did not work correctly
  (tarballing assumed phase 3 was run) and when doing a release
  we should always be doing a three-phased build and test.

Note: Technically we should only be using DESTDIR for the third phase
and use --prefix for the first and second phase because we run the built
clang from phase 1 and 2 (and in general an application's behaviour
may depend on the install prefix). However in the case of clang it
seems to not care what the install prefix was so to simplify the script
we use DESTDIR for all three stages.

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

8 years ago[Hexagon] Generate instructions for operations on predicate registers
Krzysztof Parzyszek [Tue, 14 Jul 2015 19:30:21 +0000 (19:30 +0000)]
[Hexagon] Generate instructions for operations on predicate registers

Convert logical operations on general-purpose registers to the correspon-
ding operations on predicate registers.

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

8 years ago[CodeGen] Force emission of personality directive if explicitly specified
Keno Fischer [Tue, 14 Jul 2015 19:22:51 +0000 (19:22 +0000)]
[CodeGen] Force emission of personality directive if explicitly specified

Summary:
Before this change, personality directives were not emitted
if there was no invoke left in the function (of course until
recently this also meant that we couldn't know what
the personality actually was). This patch forces personality directives
to still be emitted, unless it is known to be a noop in the absence of
invokes, or the user explicitly specified `nounwind` (and not
`uwtable`) on the function.

Reviewers: majnemer, rnk

Subscribers: rnk, llvm-commits

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

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

8 years agoAdd support for on-disk hash table lookup with a known hash, for situations where...
Richard Smith [Tue, 14 Jul 2015 18:40:59 +0000 (18:40 +0000)]
Add support for on-disk hash table lookup with a known hash, for situations where the same key will be looked up in multiple tables.

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

8 years agoTeach config.guess that MSYS exists.
Yaron Keren [Tue, 14 Jul 2015 18:33:55 +0000 (18:33 +0000)]
Teach config.guess that MSYS exists.

We might not want to upgrade config.guess to the current
version due to the license change from GPL2 to GPL3.

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

8 years agoAMDGPU: Avoid using 64-bit shift for i64 (shl x, 32)
Matt Arsenault [Tue, 14 Jul 2015 18:20:33 +0000 (18:20 +0000)]
AMDGPU: Avoid using 64-bit shift for i64 (shl x, 32)

This can be done only with moves which theoretically
will optimize better later.

Although this transform increases the instruction count,
it should be code size / cycle count neutral in the worst
VALU case. It also seems to slightly improve a couple
of testcases due to other DAG combines this exposes.

This is probably slightly worse for the SALU case, so
it might be better to handle this during moveToVALU,
although then you lose some simplifications like
the load width reducing in the simple testcase.

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