Commit Graph

80121 Commits

Author SHA1 Message Date
Rafael Espindola
21a7b73e04 Fix build without asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:04:38 +00:00
Rafael Espindola
5b68a837c7 Pass MCSymbols to the helper functions in MCELF.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:47:23 +00:00
Rafael Espindola
e97d937576 Pass a MCSymbol to needsRelocateWithSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:26:09 +00:00
Matthias Braun
3bd732d1ee MachineCopyPropagation: Remove the copies instead of using KILL instructions.
For some history here see the commit messages of r199797 and r169060.

The original intent was to fix cases like:

%EAX<def> = COPY %ECX<kill>, %RAX<imp-def>
%RCX<def> = COPY %RAX<kill>

where simply removing the copies would have RCX undefined as in terms of
machine operands only the ECX part of it is defined. The machine
verifier would complain about this so 169060 changed such COPY
instructions into KILL instructions so some super-register imp-defs
would be preserved. In r199797 it was finally decided to always do this
regardless of super-register defs.

But this is wrong, consider:
R1 = COPY R0
...
R0 = COPY R1
getting changed to:
R1 = KILL R0
...
R0 = KILL R1

It now looks like R0 dies at the first KILL and won't be alive until the
second KILL, while in reality R0 is alive and must not change in this
part of the program.

As this only happens after register allocation there is not much code
still performing liveness queries so the issue was not noticed.  In fact
I didn't manage to create a testcase for this, without unrelated changes
I am working on at the moment.

The fix is simple: As of r223896 the MachineVerifier allows reads from
partially defined registers, so the whole transforming COPY->KILL thing
is not necessary anymore. This patch also changes a similar (but more
benign case as the def and src are the same register) case in the
VirtRegRewriter.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:19:25 +00:00
Frederic Riss
9282af9d6c [YAMLIO] Make line-wrapping configurable and test it.
Summary:
We would wrap flow mappings and sequences when they go over a hardcoded 70
characters limit. Make the wrapping column configurable (and default to 70
co the change should be NFC for current users). Passing 0 allows to completely
suppress the wrapping which makes it easier to handle in tools like FileCheck.

Reviewers: bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:56:28 +00:00
Rafael Espindola
82fdcc0e7f Move common symbol related information from MCSectionData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:48:04 +00:00
Rafael Espindola
052a7becbe Store MCSymbols in PendingLabels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:41:59 +00:00
Rafael Espindola
28afbf2421 Move SymbolSize from MCSymbolData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:24:52 +00:00
Pete Cooper
b2faffd63a Fix crash in MCExpr::print.
Symbols are no longer required to be named, but this leads to a crash here if an
unnamed symbol checks that its first character is '$'.

Change the code to first check for a name, then check its first character.

No test case i'm afraid as this is debugging code, but any test case with temp labels
and 'llc --debug --filetype=obj' would have crashed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238579 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:19:11 +00:00
Nemanja Ivanovic
8493722975 Add support for VSX FMA single-precision instructions to the PPC back end
This patch corresponds to review:
http://reviews.llvm.org/D9941

It adds the various FMA instructions introduced in the version 2.07 of
the ISA along with the testing for them. These are operations on single
precision scalar values in VSX registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238578 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:13:25 +00:00
Alex Lorenz
83d291ae8b MIR Serialization: use correct line and column numbers for LLVM IR errors.
This commit translates the line and column numbers for LLVM IR
errors from the numbers in the YAML block scalar to the numbers 
in the MIR file so that the MIRParser users can report LLVM IR 
errors with the correct line and column numbers.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238576 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:05:41 +00:00
Reid Kleckner
16e4a624c4 [WinEH] Emit EH tables for __CxxFrameHandler3 on 32-bit x86
Small (really small!) C++ exception handling examples work on 32-bit x86
now.

This change disables the use of .seh_* directives in WinException when
CFI is not in use. It also uses absolute symbol references in the tables
instead of imagerel32 relocations.

Also fixes a cache invalidation bug in MMI personality classification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:00:57 +00:00
Jingyue Wu
ef056a9111 [NVPTXFavorNonGenericAddrSpaces] recursively trace into GEP and BitCast
Summary:
This patch allows NVPTXFavorNonGenericAddrSpaces to remove addrspacecast
from longer chains consisting of GEPs and BitCasts. For example, it can
now optimize

  %0 = addrspacecast [10 x float] addrspace(3)* @a to [10 x float]*
  %1 = gep [10 x float]* %0, i64 0, i64 %i
  %2 = bitcast float* %1 to i32*
  %3 = load i32* %2 ; emits ld.u32

to

  %0 = gep [10 x float] addrspace(3)* @a, i64 0, i64 %i
  %1 = bitcast float addrspace(3)* %0 to i32 addrspace(3)*
  %3 = load i32 addrspace(3)* %1 ; emits ld.shared.f32

Test Plan: @ld_int_from_global_float in access-non-generic.ll

Reviewers: broune, eliben, jholewinski, meheff

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238574 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:00:27 +00:00
Jingyue Wu
ed0d841f59 [DependenceAnalysis] Extend unifySubscriptType for handling coupled subscript groups.
Summary:
In continuation to an earlier commit to DependenceAnalysis.cpp by jingyue (r222100), the type for all subscripts in a coupled group need to be the same since constraints from one subscript may be propagated to another during testing. During testing, new SCEVs may be created and the operands for these need to be the same.
This patch extends unifySubscriptType() to work on lists of subscript pairs, ensuring a common extended type for all of them.

Test Plan:
Added a test case to NonCanonicalizedSubscript.ll which causes dependence analysis to crash without this fix.

All regression tests pass.

Reviewers: spop, sebpop, jingyue

Reviewed By: jingyue

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238573 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 16:58:08 +00:00
Rafael Espindola
616c7afb70 Simplify now that symbols contain the correct section.
The complexity in here was because before r233995 variable symbols would report
the incorrect section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 15:07:27 +00:00
Colin LeMahieu
0ace3c01f7 [Hexagon] Disassembling, printing, and emitting instructions a whole-bundle at a time which is the semantic unit for Hexagon. Fixing tests to use the new format. Disabling tests in the direct object emission path for a followup patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 14:44:13 +00:00
Rafael Espindola
3b08750746 Fix ELFObjectWriter::isLocal for signature symbols.
And with that simplify the logic for inserting them in ExternalSymbolData or
LocalSymbolData.

No functionality change overall since the old code avoided the isLocal bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 14:20:40 +00:00
Toma Tabacu
3379f2492e [mips] Remove 2 unused variables in MipsTargetStreamer.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238554 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 13:52:56 +00:00
Craig Topper
60bc0ab340 [TableGen] Remove convertValue functions for UnOpInit, BinOpInit, and TernOpInit as they weren't able to be called.
I don't think converting the inputs to the Ops was the right behavior anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238543 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 05:51:32 +00:00
Matthias Braun
2ec7970df4 This should have been a reference
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238540 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 02:59:59 +00:00
Matthias Braun
e67bd6c248 CodeGen: Use mop_iterator instead of MIOperands/ConstMIOperands
MIOperands/ConstMIOperands are classes iterating over the MachineOperand
of a MachineInstr, however MachineInstr::mop_iterator does the same
thing.

I assume these two iterators exist to have a uniform interface to
iterate over the operands of a machine instruction bundle and a single
machine instruction. However in practice I find it more confusing to have 2
different iterator classes, so this patch transforms (nearly all) the
code to use mop_iterators.

The only exception being MIOperands::anlayzePhysReg() and
MIOperands::analyzeVirtReg() still needing an equivalent, I leave that
as an exercise for the next patch.

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

This version is slightly modified from the proposed revision in that it
introduces MachineInstr::getOperandNo to avoid the extra counting
variable in the few loops that previously used MIOperands::getOperandNo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 02:56:46 +00:00
Ahmed Bougacha
c0d1ce55ac [IR] fptrunc-of-fptrunc isn't an EliminableCastPair.
Double and single rounding can produce different results.
This is the IR counterpart to r228911.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238531 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 00:04:30 +00:00
Matthias Braun
97c5de758a MachineFrameInfo: Simplify pristine register calculation.
About pristine regsiters:
Pristine registers "hold a value that is useless to the current
function, but that must be preserved - they are callee saved registers
that have not been saved." This concept saves compile time as it frees
the prologue/epilogue inserter from adding every such register to every
basic blocks live-in list.

However the current code in getPristineRegs is formulated in a
complicated way: Inside the function prologue and epilogue all callee
saves are considered pristine, while in the rest of the code only the
non-saved ones are considered pristine.  This requires logic to
differentiate between prologue/epilogue and the rest and in the presence
of shrink-wrapping this even becomes complicated/expensive.  It's also
unnecessary because the prologue epilogue inserters already mark
callee-save registers that are saved/restores properly in the respective
blocks in the prologue/epilogue (see updateLiveness() in
PrologueEpilogueInserter.cpp). So only declaring non-saved/restored
callee saved registers as pristine just works.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 23:20:35 +00:00
Eric Christopher
7984aa9d58 Fix typos in variable/grammar names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238523 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 23:07:39 +00:00
Reid Kleckner
178db50629 Rename Win64Exception.(cpp|h) to WinException.(cpp|h)
This is in preparation for reusing this for 32-bit x86 EH table
emission.  Also updates the type name for consistency. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238521 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:47:01 +00:00
Alex Lorenz
3682046086 MIR Serialization: print and parse machine function names.
This commit introduces a serializable structure called
'llvm::yaml::MachineFunction' that stores the machine
function's name. This structure will mirror the machine 
function's state in the future.

This commit prints machine functions as YAML documents
containing a YAML mapping that stores the state of a machine
function. This commit also parses the YAML documents
that contain the machine functions.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238519 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:41:12 +00:00
Quentin Colombet
354851651c [MachineCopyPropagation] Fix a bug with undef handling when the value is actualy alive.
Test case will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238518 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:38:40 +00:00
Reid Kleckner
5f50442d79 [WinEH] Start inserting state number stores for C++ EH
This moves all the state numbering code for C++ EH to WinEHPrepare so
that we can call it from the X86 state numbering IR pass that runs
before isel.

Now we just call the same state numbering machinery and insert a bunch
of stores. It also populates MachineModuleInfo with information about
the current function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 22:00:24 +00:00
Rafael Espindola
fb48de619e Don't special case undefined symbol when deciding the symbol order.
ELF has no restrictions on where undefined symbols go relative to other defined
symbols. In fact, gas just sorts them together. Do the same.

This was there since r111174 probably just because the MachO writer has it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:59:34 +00:00
Wei Mi
61897e8564 Enable exitValue rewrite only when the cost of expansion is low.
The patch evaluates the expansion cost of exitValue in indVarSimplify pass, and only does the rewriting when the expansion cost is low or loop can be deleted with the rewriting. It provides an option "-replexitval=" to control the default aggressiveness of the exitvalue rewriting. It also fixes some missing cases in SCEVExpander::isHighCostExpansionHelper to enhance the evaluation of SCEV expansion cost.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238507 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:49:07 +00:00
Rafael Espindola
9886da621d Remove a trivial forwarding function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238506 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:36:02 +00:00
David Majnemer
81f64c04d7 [SelectionDAG] Scalar shift amounts may require legalization
The shift amount may be too small to cope with promoted left hand side,
make sure to promote it as well.

This fixes PR23664.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238503 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:29:59 +00:00
Reid Kleckner
cb95e9ef45 Remove debug prints from r238487
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:23:53 +00:00
Rafael Espindola
db8eb52635 Inline trivial method. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:53:09 +00:00
Reid Kleckner
7738ecd62b Disable x86 tail call optimizations that jump through GOT
For x86 targets, do not do sibling call optimization when materializing
the callee's address would require a GOT relocation. We can still do
tail calls to internal functions, hidden functions, and protected
functions, because they do not require this kind of relocation. It is
still possible to get GOT relocations when the user explicitly asks for
it with musttail or -tailcallopt, both of which are supposed to
guarantee TCO.

Based on a patch by Chih-hung Hsieh.

Reviewers: srhines, timmurray, danalbert, enh, void, nadav, rnk

Subscribers: joerg, davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:44:28 +00:00
Daniel Sanders
1348f57925 Revert r238427 - [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
It caused a smaller number of failures than the previous attempt at committing but still caused a couple on the llvm-linux-mips builder. Reverting while I investigate the remainder.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:30:32 +00:00
Rafael Espindola
c66c8e7730 Remove structure field that can be computed just before use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:25:29 +00:00
Rafael Espindola
f3344cdffb Avoid warnings when building without asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:19:31 +00:00
Rafael Espindola
7978ab3ad9 Move these vectors to the only function where they are used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238477 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:11:34 +00:00
Peter Collingbourne
27565d6185 Thumb2: Modify codegen for memcpy intrinsic to prefer LDM/STM.
We were previously codegen'ing these as regular load/store operations and
hoping that the register allocator would allocate registers in ascending order
so that we could apply an LDM/STM combine after register allocation. According
to the commit that first introduced this code (r37179), we planned to teach
the register allocator to allocate the registers in ascending order. This
never got implemented, and up to now we've been stuck with very poor codegen.

A much simpler approach for achiveing better codegen is to create LDM/STM
instructions with identical sets of virtual registers, let the register
allocator pick arbitrary registers and order register lists when printing an
MCInst. This approach also avoids the need to repeatedly calculate offsets
which ultimately ought to be eliminated pre-RA in order to decrease register
pressure.

This is implemented by lowering the memcpy intrinsic to a series of SD-only
MCOPY pseudo-instructions which performs a memory copy using a given number
of registers. During SD->MI lowering, we lower MCOPY to LDM/STM. This is a
little unusual, but it avoids the need to encode register lists in the SD,
and we can take advantage of SD use lists to decide whether to use the _UPD
variant of the instructions.

Fixes PR9199.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:02:45 +00:00
Reid Kleckner
9417bdcc55 [WinEH] Remove debugging dump() call
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:02:05 +00:00
Rafael Espindola
86c0a109d8 Merge redundant loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:00:13 +00:00
Duncan P. N. Exon Smith
2c7cce70cd AsmPrinter: Stop exposing underlying DIE children list, NFC
Update `DIE` API to hide the implementation of `DIE::Children` so we can
swap it out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238468 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:56:34 +00:00
Rafael Espindola
48f886b9de Simplify LastLocalSymbolIndex computation. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:46:36 +00:00
Rafael Espindola
b665c2b05e Use range loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:43:20 +00:00
Pete Cooper
40d9379cd5 Add BranchProbabilityInfo::releaseMemory to clear the Weights field.
BranchProbabilityInfo was leaking 3MB of memory when running 'opt -O2 verify-uselistorder.lto.bc'.  This was due to the Weights member not being cleared once the pass is no longer needed.

This adds the releaseMemory override to clear that field.  The other fields are cleared at the end of runOnFunction so can stay there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238462 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:43:06 +00:00
Rafael Espindola
24441414a3 Remove temporary FileSymbolData. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:29:15 +00:00
Duncan P. N. Exon Smith
bfecc6bdee AsmPrinter: Rename begin_values() => values_begin(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238456 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:55:38 +00:00
Colin LeMahieu
58dd70dced [llvm] Parameterizing the output stream for dumpbytes and outputting directly to stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:39:50 +00:00
David Majnemer
967f6ad3e1 [InstCombine] Fold IntToPtr and PtrToInt into preceding loads.
Currently we only fold a BitCast into a Load when the BitCast is its
only user.

Do the same for any no-op cast.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238452 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:39:17 +00:00