Commit Graph

10109 Commits

Author SHA1 Message Date
Rafael Espindola
72d13ff755 When splitting a VAARG, remember its alignment.
This produces terrible but correct code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 18:22:20 +00:00
Bob Wilson
de4fe23139 Revert my if-conversion cleanup since it caused a bunch of nightly test
regressions.

--- Reverse-merging r106939 into '.':
U    test/CodeGen/Thumb2/thumb2-ifcvt3.ll
U    lib/CodeGen/IfConversion.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106951 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 17:47:06 +00:00
Benjamin Kramer
ce9a20b808 VNInfos don't need to be destructed anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106943 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 11:30:59 +00:00
Bob Wilson
ccd9bcca14 Clean up some problems with extra CFG edges being introduced during
if-conversion.  The RemoveExtraEdges function doesn't work for blocks that
end with unanalyzable branches, so in those cases, the "extra" edges must
be explicitly removed.  The CopyAndPredicateBlock and MergeBlocks methods
can also avoid copying successor edges due to branches that have already
been removed.  The latter case is especially helpful when MergeBlocks is
called for handling "diamond" if-conversions, where otherwise you can end
up with some weird intermediate states in the CFG.  Unfortunately I've
been unable to find cases where this cleanup actually makes a significant
difference in the code.  There is one test where we manage to remove an
empty block at the end of a function.  Radar 6911268.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 04:27:33 +00:00
Jim Grosbach
9f054f017c make sure to handle dbg_value instructions in the middle of the block, not
just at the head, when doing diamond if-conversion. rdar://7797940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 23:05:46 +00:00
Jakob Stoklund Olesen
15a571436d Don't track kills in VNInfo. Use interval ends instead.
The VNInfo.kills vector was almost unused except for all the code keeping it
updated. The few places using it were easily rewritten to check for interval
ends instead.

The two new methods LiveInterval::killedAt and killedInRange are replacements.

This brings us down to 3 independent data structures tracking kills.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 22:53:05 +00:00
Evan Cheng
13151432ed Change if-conversion block size limit checks to add some flexibility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106901 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 22:42:03 +00:00
Devang Patel
78e127d81b Collect debug info for optimized variables of inlined functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 22:07:34 +00:00
Jim Grosbach
135ec50ce2 80 column and typo fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 22:02:28 +00:00
Dale Johannesen
1784d160e4 The hasMemory argument is irrelevant to how the argument
for an "i" constraint should get lowered; PR 6309.  While
this argument was passed around a lot, this is the only
place it was used, so it goes away from a lot of other
places.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 21:55:36 +00:00
Bill Wendling
730c07e50d - Reapply r106066 now that the bzip2 build regression has been fixed.
- 2010-06-25-CoalescerSubRegDefDead.ll is the testcase for r106878.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 20:48:10 +00:00
Bill Wendling
39d258aa49 We should remove the live range from the destination register only if *all* defs
are dead, not just the def of this register. I.e., a register could be dead, but
it's subreg isn't.

Testcase to follow with a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 20:42:55 +00:00
Dale Johannesen
493315922b Cosmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 17:41:07 +00:00
Duncan Sands
b447c4e65b Remove variables which are assigned to but for which the value
is not used.  Spotted by gcc-4.6.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106854 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 14:48:39 +00:00
Gabor Greif
2bf4b3be5c use ArgOperand accessors
and CallInst for getting hold
of the intrinsic's arguments

simplify along the way (at least for me this is much more legible now)
Bill, Baldrick or Anton, please review\!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106838 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 11:25:30 +00:00
Gabor Greif
c13055db26 use ArgOperand API (the simple part)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 09:44:37 +00:00
Gabor Greif
0635f35114 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 09:38:13 +00:00
Gabor Greif
45c097fe43 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106835 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 09:36:23 +00:00
Gabor Greif
9e38531d95 use ArgOperand API and CallSite to access arguments of CallInst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 09:03:52 +00:00
Gabor Greif
89c4cead3c use ArgOperand API and CallSite to access arguments of CallInst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106829 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 08:48:19 +00:00
Gabor Greif
1518444f0c use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 08:24:59 +00:00
Gabor Greif
d3f526c04a prune an include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 08:16:50 +00:00
Dale Johannesen
969b9fe379 Fix a case where an earlyclobber operand of an asm
is reused as an input.  PR 4118.  Testcase is too big,
as usual with bugs in this area, but there's one in
the PR.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 00:49:43 +00:00
Jakob Stoklund Olesen
fa1e73c447 Make sure all eliminated kills are removed from VNInfo lists.
This fixes PR7479 and PR7485. The test cases from those PRs are big, so not
included. However, PR7485 comes from self hosting on FreeBSD, so we will surely
hear about any regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106811 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 23:57:35 +00:00
Dan Gohman
0879e22790 Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106809 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 23:41:59 +00:00
Dan Gohman
fe5e4dabbf Teach EmitLiveInCopies to omit copies for unused virtual registers,
and to clean up unused incoming physregs from the live-in list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 22:23:02 +00:00
Bill Wendling
10707f3b44 It's possible that a flag is added to the SDNode that points back to the
original SDNode. This is badness. Also, this function allows one SDNode to point
multiple flags to another SDNode. Badness as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106793 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 22:00:37 +00:00
Devang Patel
486ca76421 DBG_VALUE machine instruction pointing to undefined register for a variable justify a separate scope if the variable is inlined function's argument.
Radar 8122864.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106792 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 21:51:19 +00:00
Jakob Stoklund Olesen
67674e2685 Don't return a std::vector in the Spiller interface, but take a reference to a
vector instead. This avoids needless copying and allocation.

Add documentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 20:54:29 +00:00
Jakob Stoklund Olesen
3c7b3fecac Remove the now unused LiveIntervals::getVNInfoSourceReg().
This method was always a bit too simplistic for the real world. It didn't really
deal with subregisters and such.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 20:18:15 +00:00
Jakob Stoklund Olesen
c0490ac915 Teach AdjustCopiesBackFrom to also use CoalescerPair to identify compatible copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106780 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 20:16:00 +00:00
Jakob Stoklund Olesen
54edf4f7da Remove the -fast-spill option.
This code path has never really been used, and we are going to be handling
spilling through the Spiller interface in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106777 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 19:56:08 +00:00
Bill Wendling
efbf306107 Loosen up the requirements in the Horrible Hack(tm) to include all selectors
which don't have a catch-all associated with them not just clean-ups. This fixes
the SingleSource/Benchmarks/Shootout-C++/except.cpp testcase that broke because
of my change r105902.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106772 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 18:49:10 +00:00
Jakob Stoklund Olesen
a24986d8bf Replace a big gob of old coalescer logic with the new CoalescerPair class.
CoalescerPair can determine if a copy can be coalesced, and which register gets
merged away. The old logic in SimpleRegisterCoalescing had evolved into
something a bit too convoluted.

This second attempt fixes some crashes that only occurred Linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106769 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 18:15:01 +00:00
Jakob Stoklund Olesen
eec418d26f Print the LSBs of a SlotIndex symbolically using letters referring to the
[L]oad, [u]se, [d]ef, or [S]tore slots.

This makes it easier to see if two indices refer to the same instruction,
avoiding mental mod 4 calculations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 17:31:07 +00:00
Dan Gohman
deca052d9d Simplify this code; switch lowering shouldn't produce cases
which trivially fold away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106765 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 17:08:31 +00:00
Jakob Stoklund Olesen
8df08017d8 Be more strict about subreg-to-subreg copies in CoalescerPair.
Also keep track of the original DstREg before subregister adjustments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:19:28 +00:00
Jakob Stoklund Olesen
af5c60b40d Verify that VNI kills are pointing to existing instructions.
In this case it is essential that the kill is real because the spiller will
decide to omit a spill if it thinks there is a later kill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 15:56:59 +00:00
Dan Gohman
ee1c870778 Eliminate the other half of the BRCOND optimization, and update
as many tests as possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 15:24:03 +00:00
Dan Gohman
102f3851bb Eliminate the first have of the optimization which eliminates BRCOND
when the condition is constant. This optimization shouldn't be
necessary, because codegen shouldn't be able to find dead control
paths that the IR-level optimizer can't find. And it's undesirable,
because it encourages bugpoint to leave "br i1 false" branches
in its output. And it wasn't updating the CFG.

I updated all the tests I could, but some tests are too reduced
and I wasn't able to meaningfully preserve them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 15:04:11 +00:00
Dan Gohman
4e39e9da0f Reapply r106634, now that the bug it exposed is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 14:30:44 +00:00
Dan Gohman
8e0163ac1e Optimize the "bit test" code path for switch lowering in the
case where the bit mask has exactly one bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 02:06:24 +00:00
Jakob Stoklund Olesen
b8ac3b035b Revert "Replace a big gob of old coalescer logic with the new CoalescerPair class."
Whiny buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:52:22 +00:00
Jakob Stoklund Olesen
e9c59711d3 Replace a big gob of old coalescer logic with the new CoalescerPair class.
CoalescerPair can determine if a copy can be coalesced, and which register gets
merged away. The old logic in SimpleRegisterCoalescing had evolved into
something a bit too convoluted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106701 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:12:39 +00:00
Bill Wendling
151d26d15d MorphNodeTo doesn't preserve the memory operands. Because we're morphing a node
into the same node, but with different non-memory operands, we need to replace
the memory operands after it's finished morphing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 18:16:24 +00:00
Daniel Dunbar
cbe762b5d1 Revert r106263, "Fold the ShrinkDemandedOps pass into the regular DAGCombiner pass,"... it was causing both 'file' (with clang) and 176.gcc (with llvm-gcc) to be miscompiled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 17:09:26 +00:00
Jim Grosbach
9a526495e0 Some targets don't require the fencing MEMBARRIER instructions surrounding
atomic intrinsics, either because the use locking instructions for the
atomics, or because they perform the locking directly. Add support in the
DAG combiner to fold away the fences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 16:07:42 +00:00
Jakob Stoklund Olesen
014b8631c0 Add a few VNInfo data structure checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106627 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 15:34:36 +00:00
Daniel Dunbar
d24c9d5f91 Revert r106066, "Create a more targeted fix for not sinking instructions into a range where it"... it causes bzip2 to be miscompiled by Clang.
Conflicts:

	lib/CodeGen/MachineSink.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 00:48:25 +00:00
Jakob Stoklund Olesen
f175c5c828 Also convert SUBREG_TO_REG to a KILL when relevant, like the other subreg
instructions.

This does not affect codegen much because SUBREG_TO_REG is only used by X86 and
X86 does not use the register scavenger, but it prevents verifier errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 22:11:07 +00:00