Commit Graph

10007 Commits

Author SHA1 Message Date
Mon P Wang
9c4a84b4f3 Fixed vector widening of binary instructions that can trap. Patch by Visa Putkinen!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 20:29:05 +00:00
Bob Wilson
6fb124bee9 IfConversion's AnalyzeBlocks method always returns false; clean it up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 18:57:15 +00:00
Jim Grosbach
288694f430 fix naming
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 18:53:34 +00:00
Jakob Stoklund Olesen
1b2f94c621 Fix an exotic bug that only showed up in an internal test case.
SimpleRegisterCoalescing::JoinIntervals() uses CoalescerPair to determine if a
copy is coalescable, and in very rare cases it can return true where LHS is not
live - the coalescable copy can come from an alias of the physreg in LHS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106021 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 18:49:14 +00:00
Bob Wilson
669db04130 Fix a comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106015 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 18:19:27 +00:00
Bob Wilson
4ffd22d810 Add some missing checks for the case where the extract_subregs are
combined to an insert_subreg, i.e., where the destination register is larger
than the source.  We need to check that the subregs can be composed for that
case in a symmetrical way to the case when the destination is smaller.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 17:27:54 +00:00
Jakob Stoklund Olesen
75ac4d9c2d Avoid processing early clobbers twice in RegAllocFast.
Early clobbers defining a virtual register were first alocated to a physreg and
then processed as a physreg EC, spilling the virtreg.

This fixes PR7382.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105998 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 16:20:57 +00:00
Jakob Stoklund Olesen
40d07bbebb Add CoalescerPair helper class.
Given a copy instruction, CoalescerPair can determine which registers to
coalesce in order to eliminate the copy. It deals with all the subreg fun to
determine a tuple (DstReg, SrcReg, SubIdx) such that:

- SrcReg is a virtual register that will disappear after coalescing.
- DstReg is a virtual or physical register whose live range will be extended.
- SubIdx is 0 when DstReg is a physical register.
- SrcReg can be joined with DstReg:SubIdx.

CoalescerPair::isCoalescable() determines if another copy instruction is
compatible with the same tuple. This fixes some NEON miscompilations where
shuffles are getting coalesced as if they were copies.

The CoalescerPair class will replace a lot of the spaghetti logic in JoinCopy
later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 16:04:21 +00:00
Bob Wilson
852a7e362e Generalize the pre-coalescing of extract_subregs feeding reg_sequences,
replacing the overly conservative checks that I had introduced recently to
deal with correctness issues.  This makes a pretty noticable difference
in our testcases where reg_sequences are used.  I've updated one test to
check that we no longer emit the unnecessary subreg moves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105991 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 05:56:31 +00:00
Ted Kremenek
76863b16c6 Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 04:08:14 +00:00
Jim Grosbach
c834f413ae More dbg_value cleanup so the presence of debug info doesn't affect code-gen.
Make sure to skip the dbg_value instructions when moving dups out of the
diamond. rdar://7797940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 21:30:32 +00:00
Evan Cheng
774bc882fd - Do away with SimpleHazardRecognizer.h. It's not used and offers little value.
- Rename ExactHazardRecognizer to PostRAHazardRecognizer and move its header to include to allow targets to extend it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 21:06:53 +00:00
Evan Cheng
538ccb0d99 Avoid uncessary array copying.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 20:18:40 +00:00
Chris Lattner
98cdfc779d fix a -Wbool-conversions warning from clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105942 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 18:28:34 +00:00
Bill Wendling
94366111d3 When performing the Horrible Hack(tm-Duncan) on the EH code to convert a
clean-up to a catch-all after inlining, take into account that there could be
filter IDs as well. The presence of filters don't mean that the selector catches
anything. It's just metadata information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-12 02:34:29 +00:00
Evan Cheng
729aab3dd3 Allow target to provide its own hazard recognizer to post-ra scheduler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-12 00:12:18 +00:00
Evan Cheng
44acc24117 Code formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105861 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-12 00:11:53 +00:00
Stuart Hastings
215aa15a0d Support for nested functions/classes in debug output. (Again.) Radar 7424645.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-11 20:08:44 +00:00
Evan Cheng
302ef834e0 Code refactoring, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-10 02:09:31 +00:00
Jakob Stoklund Olesen
3013a20684 Mark physregs defined by inline asm as implicit.
This is a bit of a hack to make inline asm look more like call instructions.
It would be better to produce correct dead flags during isel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 20:05:00 +00:00
Evan Cheng
68fc2daf8f Allow target to place 2-address pass inserted copies in better spots. Thumb2 will use this to try to avoid breaking up IT blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 19:26:01 +00:00
Bill Wendling
d64ba3ee62 It's an error to translate this:
%reg1025 = <sext> %reg1024
    ...
   %reg1026 = SUBREG_TO_REG 0, %reg1024, 4

into this:

   %reg1025 = <sext> %reg1024
    ...
   %reg1027 = EXTRACT_SUBREG %reg1025, 4
   %reg1026 = SUBREG_TO_REG 0, %reg1027, 4

The problem here is that SUBREG_TO_REG is there to assert that an implicit zext
occurs. It doesn't insert a zext instruction. If we allow the EXTRACT_SUBREG
here, it will give us the value after the <sext>, not the original value of
%reg1024 before <sext>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 19:00:55 +00:00
Jakob Stoklund Olesen
c3c2517fed Add argument name comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 00:40:31 +00:00
Bob Wilson
66dc4e2acd Fix a mistake in my previous change r105437: don't access operand 2 and assume
that it is an immediate before checking that the instruction is an
EXTRACT_SUBREG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105585 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 23:48:46 +00:00
Dan Gohman
ba1fe14245 Add some basic debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 22:32:10 +00:00
Jim Grosbach
66f360e990 Cleanup. Process the dbg_values separately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105554 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 21:28:55 +00:00
Jim Grosbach
41a628237c Move exit check where it really belongs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 19:12:21 +00:00
Stuart Hastings
6d56b9fabc Revert 105492 & 105493 due to a testcase regression. Radar 7424645.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105511 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-05 00:39:29 +00:00
Dale Johannesen
88004c25c7 Fix some liveout handling related to tail calls, see comments.
I don't think this ever resulted in problems on x86, but it
would on ARM.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-05 00:30:45 +00:00
Evan Cheng
2b4e727c6f Re-apply 105308 with fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105502 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 23:28:13 +00:00
Jim Grosbach
870c80540d Make if-conversion ignore dbg_value instructions in its analysis. rdar://7797940
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105498 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 23:01:26 +00:00
Stuart Hastings
0f1b813567 Support for nested functions/classes in debug output. Radar 7424645.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 22:36:03 +00:00
Jim Grosbach
1c8ab781d5 Skip dbg_value instructions when scanning instructions in register scavenging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105481 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 20:18:30 +00:00
Jakob Stoklund Olesen
6de07178e1 Keep track of the call instructions whose clobber lists were skipped during fast
register allocation.

Process all of the clobber lists at the end of the function, marking the
registers as used in MachineRegisterInfo.

This is necessary in case the calls clobber callee-saved registers (sic).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 18:08:29 +00:00
Mon P Wang
f62546ab04 Fixed a bug during widening where we would avoid legalizing a node. When we
replace an OpA with a widened OpB, it is possible to get new uses of OpA due to CSE
when recursively updating nodes.  Since OpA has been processed, the new uses are
not examined again.  The patch checks if this occurred and it it did, updates the
new uses of OpA to use OpB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105453 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 01:20:10 +00:00
Bob Wilson
26bf8f9a1b Add some missing checks in TwoAddressInstructionPass::CoalesceExtSubRegs.
Check that all the instructions are in the same basic block, that the
EXTRACT_SUBREGs write to the same subregs that are being extracted, and that
the source and destination registers are in the same regclass.  Some of
these constraints can be relaxed with a bit more work.  Jakob suggested
that the loop that checks for subregs when NewSubIdx != 0 should use the
"nodbg" iterator, so I made that change here, too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 23:53:58 +00:00
Jim Grosbach
6ee358b4eb Cleanup 80-column and trim trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 23:49:57 +00:00
Dan Gohman
400f75cb5e Fix SimplifyDemandedBits' AssertZext logic to demand all the bits. It
needs to demand the high bits because it's asserting that they're zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 20:21:33 +00:00
Bob Wilson
3844173f6e Revert 105308.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105399 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 18:28:31 +00:00
Bill Wendling
869d60d39d Machine sink could potentially sink instructions into a block where the physical
registers it defines then interfere with an existing preg live range.

For instance, if we had something like these machine instructions:

BB#0
  ... = imul ... EFLAGS<imp-def,dead>
  test ..., EFLAGS<imp-def>
  jcc BB#2 EFLAGS<imp-use>

BB#1
  ... ; fallthrough to BB#2

BB#2
  ... ; No code that defines EFLAGS
  jcc ... EFLAGS<imp-use>

Machine sink will come along, see that imul implicitly defines EFLAGS, but
because it's "dead", it assumes that it can move imul into BB#2. But when it
does, imul's "dead" imp-def of EFLAGS is raised from the dead (a zombie) and
messes up the condition code for the jump (and pretty much anything else which
relies upon it being correct).

The solution is to know which pregs are live going into a basic block. However,
that information isn't calculated at this point. Nor does the LiveVariables pass
take into account non-allocatable physical registers. In lieu of this, we do a
*very* conservative pass through the basic block to determine if a preg is live
coming out of it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 07:54:20 +00:00
Eric Christopher
7310064f4d One underscore, not two.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 04:02:59 +00:00
Eli Friedman
268637ed0f Implement expansion in type legalization for add/sub with overflow. The
expansion is the same as that used by LegalizeDAG.

The resulting code sucks in terms of performance/codesize on x86-32 for a
64-bit operation; I haven't looked into whether different expansions might be
better in general.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 03:49:50 +00:00
Jakob Stoklund Olesen
8b89c64b5c Use the fast register allocator by default for -O0 builds.
This affects both llvm-gcc and clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 00:39:06 +00:00
Jakob Stoklund Olesen
ead06be02f Use readsWritesVirtualRegister instead of counting uses and defs when inserting
spills and reloads.

This means that a partial define of a register causes a reload so the other
parts of the register are preserved.

The reload can be prevented by adding an <imp-def> operand for the full
register. This is already done by the coalescer and live interval analysis where
relevant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105369 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 00:07:47 +00:00
Jakob Stoklund Olesen
02571a3a1f Add full register <imp-def> operands when the coalescer is creating partial
register updates.

These operands tell the spiller that the other parts of the partially defined
register are don't-care, and a reload is not necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105361 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-02 23:22:11 +00:00
Bill Wendling
05c68374c1 Compulsive reformating. No functionalitical changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-02 23:04:26 +00:00
Jakob Stoklund Olesen
9edf7deb37 Slightly change the meaning of the reMaterialize target hook when the original
instruction defines subregisters.

Any existing subreg indices on the original instruction are preserved or
composed with the new subreg index.

Also substitute multiple operands mentioning the original register by using the
new MachineInstr::substituteRegister() function. This is necessary because there
will soon be <imp-def> operands added to non read-modify-write partial
definitions. This instruction:

  %reg1234:foo = FLAP %reg1234<imp-def>

will reMaterialize(%reg3333, bar) like this:

  %reg3333:bar-foo = FLAP %reg333:bar<imp-def>

Finally, replace the TargetRegisterInfo pointer argument with a reference to
indicate that it cannot be NULL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105358 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-02 22:47:25 +00:00
Rafael Espindola
42d075c4fb Remove the TargetRegisterClass member from CalleeSavedInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-02 20:02:30 +00:00
Devang Patel
354eb7ea96 Skip identical instruction while calculating DBG_VALUE range.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105340 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-02 19:05:13 +00:00
Bob Wilson
91a74da036 Rename canCombinedSubRegIndex method to something more grammatically correct
and tidy up the comment describing it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105339 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-02 18:54:47 +00:00