oota-llvm.git
14 years agoRemove the JustSP single-register regclass.
Jakob Stoklund Olesen [Wed, 13 Jan 2010 00:43:06 +0000 (00:43 +0000)]
Remove the JustSP single-register regclass.

It was only being used by instructions with the t_addrmode_sp addressing mode,
and that is pattern matched in a way that guarantees SP is used. There is
never any register allocation done from this class.

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

14 years agoTry to fix the ARM and PPC buildbots. The -mattr=vector-unaligned-mem
Jeffrey Yasskin [Wed, 13 Jan 2010 00:31:43 +0000 (00:31 +0000)]
Try to fix the ARM and PPC buildbots. The -mattr=vector-unaligned-mem
flag doesn't exist there, and this is an x86 test.

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

14 years agoAdd a quick pass to optimize sign / zero extension instructions. For targets where...
Evan Cheng [Wed, 13 Jan 2010 00:30:23 +0000 (00:30 +0000)]
Add a quick pass to optimize sign / zero extension instructions. For targets where the pre-extension values are available in the subreg of the result of the extension, replace the uses of the pre-extension value with the result + extract_subreg.

For now, this pass is fairly conservative. It only perform the replacement when both the pre- and post- extension values are used in the block. It will miss cases where the post-extension values are live, but not used.

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

14 years agoFurther progration of metadata operands. The
Dale Johannesen [Wed, 13 Jan 2010 00:00:24 +0000 (00:00 +0000)]
Further progration of metadata operands.  The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.

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

14 years agoMake WriteConstants() more robust against stray values in ValueEnumerator's ValueList
Victor Hernandez [Tue, 12 Jan 2010 23:37:59 +0000 (23:37 +0000)]
Make WriteConstants() more robust against stray values in ValueEnumerator's ValueList

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

14 years agoFix a comment typo.
Bob Wilson [Tue, 12 Jan 2010 22:18:56 +0000 (22:18 +0000)]
Fix a comment typo.

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

14 years agouse consistent tag kinds for ilist_traits
Chris Lattner [Tue, 12 Jan 2010 22:00:04 +0000 (22:00 +0000)]
use consistent tag kinds for ilist_traits

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

14 years ago1) Use the new SimplifyInstructionsInBlock routine instead of the copy
Chris Lattner [Tue, 12 Jan 2010 20:41:47 +0000 (20:41 +0000)]
1) Use the new SimplifyInstructionsInBlock routine instead of the copy
in JT.

2) When cloning blocks for PHI or xor conditions, use
instsimplify to simplify the code as we go.  This allows us to
squish common cases early in JT which opens up opportunities for
subsequent iterations, and allows it to completely simplify the
testcase.

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

14 years agoadd a helper function.
Chris Lattner [Tue, 12 Jan 2010 19:40:54 +0000 (19:40 +0000)]
add a helper function.

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

14 years agoUse Twine, instead of StringRef, for consistency.
Devang Patel [Tue, 12 Jan 2010 18:57:56 +0000 (18:57 +0000)]
Use Twine, instead of StringRef, for consistency.

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

14 years agoUse ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.
Devang Patel [Tue, 12 Jan 2010 18:34:06 +0000 (18:34 +0000)]
Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.

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

14 years agoEliminate or_not_add and just use AddedComplexity so isel tries or_is_add patterns...
Evan Cheng [Tue, 12 Jan 2010 18:31:19 +0000 (18:31 +0000)]
Eliminate or_not_add and just use AddedComplexity so isel tries or_is_add patterns first.

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

14 years agoAdd nounwind.
Evan Cheng [Tue, 12 Jan 2010 18:29:23 +0000 (18:29 +0000)]
Add nounwind.

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

14 years agoRevert commit 93204, since it causes the assembler to barf
Duncan Sands [Tue, 12 Jan 2010 17:46:16 +0000 (17:46 +0000)]
Revert commit 93204, since it causes the assembler to barf
on x86-64 linux with messages like this:
Error: Incorrect register `%r14' used with `l' suffix

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

14 years agoFix typo.
Duncan Sands [Tue, 12 Jan 2010 08:30:46 +0000 (08:30 +0000)]
Fix typo.

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

14 years agoTweak commit 91745, which changed target data for both Mingw and Cygwin,
Duncan Sands [Tue, 12 Jan 2010 08:21:07 +0000 (08:21 +0000)]
Tweak commit 91745, which changed target data for both Mingw and Cygwin,
to not touch Cygwin: the change caused llvm-gcc build failures due to
long double getting the wrong size.  Patch by Aaron Gray.

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

14 years agoMake several tests less fragile.
Dan Gohman [Tue, 12 Jan 2010 04:52:47 +0000 (04:52 +0000)]
Make several tests less fragile.

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

14 years agoReapply the MOV64r0 patch, with a fix: MOV64r0 clobbers EFLAGS.
Dan Gohman [Tue, 12 Jan 2010 04:42:54 +0000 (04:42 +0000)]
Reapply the MOV64r0 patch, with a fix: MOV64r0 clobbers EFLAGS.

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

14 years agoUpdate a partially obsolete comment.
Dan Gohman [Tue, 12 Jan 2010 04:32:35 +0000 (04:32 +0000)]
Update a partially obsolete comment.

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

14 years agoFix a typo in a comment.
Dan Gohman [Tue, 12 Jan 2010 04:30:26 +0000 (04:30 +0000)]
Fix a typo in a comment.

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

14 years agotidy up
Chris Lattner [Tue, 12 Jan 2010 02:07:50 +0000 (02:07 +0000)]
tidy up

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

14 years agoTeach jump threading to duplicate small blocks when the branch
Chris Lattner [Tue, 12 Jan 2010 02:07:17 +0000 (02:07 +0000)]
Teach jump threading to duplicate small blocks when the branch
condition is a xor with a phi node.  This eliminates nonsense
like this from 176.gcc in several places:

 LBB166_84:
        testl   %eax, %eax
-       setne   %al
-       xorb    %cl, %al
-       notb    %al
-       testb   $1, %al
-       je      LBB166_85
+       je      LBB166_69
+       jmp     LBB166_85

This is rdar://7391699

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

14 years agoAdd MO_Metadata as an operand kind. Not used yet.
Dale Johannesen [Tue, 12 Jan 2010 02:01:53 +0000 (02:01 +0000)]
Add MO_Metadata as an operand kind.  Not used yet.

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

14 years agoAdd TargetInstrInfo::isCoalescableInstr. It returns true if the specified
Evan Cheng [Tue, 12 Jan 2010 00:09:37 +0000 (00:09 +0000)]
Add TargetInstrInfo::isCoalescableInstr. It returns true if the specified
instruction is copy like where the source and destination registers can
overlap. This is to be used by the coalescable to coalesce the source and
destination registers of instructions like X86::MOVSX64rr32. Apparently
some crazy people believe the coalescer is too simple.

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

14 years agosome cleanup, and make it obvious that ProcessJumpOnPHI only works
Chris Lattner [Mon, 11 Jan 2010 23:41:09 +0000 (23:41 +0000)]
some cleanup, and make it obvious that ProcessJumpOnPHI only works
on branches by renaming it and checking for a branch at the call site.

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

14 years agodisable this testcase, PR5997
Chris Lattner [Mon, 11 Jan 2010 23:18:33 +0000 (23:18 +0000)]
disable this testcase, PR5997

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

14 years agoAdd manual ISD::OR fastisel selection routines. TableGen is no longer autogen them...
Evan Cheng [Mon, 11 Jan 2010 22:59:27 +0000 (22:59 +0000)]
Add manual ISD::OR fastisel selection routines. TableGen is no longer autogen them after 93152 and 93191.

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

14 years agoAdd documentation for llvm.dbg.value intrinsic
Victor Hernandez [Mon, 11 Jan 2010 22:53:48 +0000 (22:53 +0000)]
Add documentation for llvm.dbg.value intrinsic

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

14 years agoreenable the piece that turns trunc(zext(x)) -> x even if zext has multiple uses,
Chris Lattner [Mon, 11 Jan 2010 22:49:40 +0000 (22:49 +0000)]
reenable the piece that turns trunc(zext(x)) -> x even if zext has multiple uses,
codegen has no apparent problem with the trunc version of this, because it turns
into a simple subreg idiom

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

14 years agoDisable folding sext(trunc(x)) -> x (and other similar cast/cast cases) when the
Chris Lattner [Mon, 11 Jan 2010 22:45:25 +0000 (22:45 +0000)]
Disable folding sext(trunc(x)) -> x (and other similar cast/cast cases) when the
trunc has multiple uses.  Codegen is not able to coalesce the subreg case
correctly and so this leads to higher register pressure and spilling (see PR5997).

This speeds up 256.bzip2 from 8.60 -> 8.04s on my machine, ~7%.

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

14 years agoConsolidate ConvertGlobalValIDToValue, ConvertGlobalOrMetadataValIDToValue, and Conve...
Victor Hernandez [Mon, 11 Jan 2010 22:31:58 +0000 (22:31 +0000)]
Consolidate ConvertGlobalValIDToValue, ConvertGlobalOrMetadataValIDToValue, and ConvertValIDToValue into a more powerful ConvertValIDToValue() that does all three's work

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

14 years agoRemove trailing white spaces in post dominators header file
Tobias Grosser [Mon, 11 Jan 2010 22:22:46 +0000 (22:22 +0000)]
Remove trailing white spaces in post dominators header file

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

14 years agoAdd getNode() to post dominators.
Tobias Grosser [Mon, 11 Jan 2010 22:22:32 +0000 (22:22 +0000)]
Add getNode() to post dominators.

Implement the same interface as already available for dominators.

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

14 years agoExtend r93152 to work on OR r, r. If the source set bits are known not to overlap...
Evan Cheng [Mon, 11 Jan 2010 22:03:29 +0000 (22:03 +0000)]
Extend r93152 to work on OR r, r. If the source set bits are known not to overlap, then select as an ADD instead.

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

14 years agoreduce this to a sensible testcase.
Chris Lattner [Mon, 11 Jan 2010 21:58:19 +0000 (21:58 +0000)]
reduce this to a sensible testcase.

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

14 years agoShorten up this testcase.
David Greene [Mon, 11 Jan 2010 21:50:35 +0000 (21:50 +0000)]
Shorten up this testcase.

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

14 years agoRevert 93158. It's breaking quite a few x86_64 tests.
Evan Cheng [Mon, 11 Jan 2010 21:13:41 +0000 (21:13 +0000)]
Revert 93158. It's breaking quite a few x86_64 tests.

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

14 years agoAvoid adding PHI arguments for a predecessor that has gone away when a BRCOND was...
Jakob Stoklund Olesen [Mon, 11 Jan 2010 21:02:33 +0000 (21:02 +0000)]
Avoid adding PHI arguments for a predecessor that has gone away when a BRCOND was constant folded.

This fixes PR5980.

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

14 years agoRemove unused string functions.
Benjamin Kramer [Mon, 11 Jan 2010 20:33:12 +0000 (20:33 +0000)]
Remove unused string functions.

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

14 years agoDo not turn 8-bit OR to ADD since ADD8ri is not 3-addressfiable.
Evan Cheng [Mon, 11 Jan 2010 20:18:04 +0000 (20:18 +0000)]
Do not turn 8-bit OR to ADD since ADD8ri is not 3-addressfiable.

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

14 years agoDisable transformation of select of two loads to a select of address and then a load...
Mon P Wang [Mon, 11 Jan 2010 20:12:49 +0000 (20:12 +0000)]
Disable transformation of select of two loads to a select of address and then a load if the
loads are not in the default address space because the transformation discards src value info.

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

14 years agoAdd StrInStrNoCase, a StringRef version of CStrInCStrNoCase.
Benjamin Kramer [Mon, 11 Jan 2010 19:45:18 +0000 (19:45 +0000)]
Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.

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

14 years agoAdd top level section for named metadata.
Devang Patel [Mon, 11 Jan 2010 19:35:55 +0000 (19:35 +0000)]
Add top level section for named metadata.

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

14 years agoImprove unclear bits and inaccuracies in structure and insertvalue
Jeffrey Yasskin [Mon, 11 Jan 2010 19:19:26 +0000 (19:19 +0000)]
Improve unclear bits and inaccuracies in structure and insertvalue
documentation.

Patch by Dustin Laurence!

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

14 years agoUpdate the -tailcallopt description to match djg's improvements to the calling
Jeffrey Yasskin [Mon, 11 Jan 2010 18:53:47 +0000 (18:53 +0000)]
Update the -tailcallopt description to match djg's improvements to the calling
convention.

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

14 years agos/NextValueNo/NextMDValueNo while processing metadata.
Devang Patel [Mon, 11 Jan 2010 18:52:33 +0000 (18:52 +0000)]
s/NextValueNo/NextMDValueNo while processing metadata.

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

14 years agoTurns out llvm-gcc still uses SplitString with a vector. Add it back until I
Benjamin Kramer [Mon, 11 Jan 2010 18:44:35 +0000 (18:44 +0000)]
Turns out llvm-gcc still uses SplitString with a vector. Add it back until I
have a fix.

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

14 years agoReimplement getToken and SplitString as "StringRef helper functions"
Benjamin Kramer [Mon, 11 Jan 2010 18:03:24 +0000 (18:03 +0000)]
Reimplement getToken and SplitString as "StringRef helper functions"

- getToken is modeled after StringRef::split but it can split on multiple
  separator chars and skips leading seperators.
- SplitString is a StringRef::split variant for more than 2 elements with the
  same behaviour as getToken.

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

14 years agoUse a 32-bit and with implicit zero-extension instead of a 64-bit and if it
Dan Gohman [Mon, 11 Jan 2010 17:58:34 +0000 (17:58 +0000)]
Use a 32-bit and with implicit zero-extension instead of a 64-bit and if it
has an immediate with at least 32 bits of leading zeros, to avoid needing to
materialize that immediate in a register first.

FileCheckize, tidy, and extend a testcase to cover this case.

This fixes rdar://7527390.

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

14 years agoRe-instate MOV64r0 and MOV16r0, with adjustments to work with the
Dan Gohman [Mon, 11 Jan 2010 17:37:57 +0000 (17:37 +0000)]
Re-instate MOV64r0 and MOV16r0, with adjustments to work with the
new AsmPrinter. This is perhaps less elegant than describing them
in terms of MOV32r0 and subreg operations, but it allows the
current register to rematerialize them.

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

14 years agoGeneralize this check to avoid depending on a specific register assignment.
Dan Gohman [Mon, 11 Jan 2010 17:24:27 +0000 (17:24 +0000)]
Generalize this check to avoid depending on a specific register assignment.

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

14 years agoMake this test less trivial, to avoid spurious failures.
Dan Gohman [Mon, 11 Jan 2010 17:23:56 +0000 (17:23 +0000)]
Make this test less trivial, to avoid spurious failures.

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

14 years agoPattern top-level operators don't need to be restricted to a
Dan Gohman [Mon, 11 Jan 2010 17:21:05 +0000 (17:21 +0000)]
Pattern top-level operators don't need to be restricted to a
single user. The _su forms are intended for non-top-level nodes.

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

14 years agoReword this comment to reference a more fundamental issue.
Dan Gohman [Mon, 11 Jan 2010 17:14:46 +0000 (17:14 +0000)]
Reword this comment to reference a more fundamental issue.

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

14 years agoSelect an OR with immediate as an ADD if the input bits are known zero. This allow...
Evan Cheng [Mon, 11 Jan 2010 17:03:47 +0000 (17:03 +0000)]
Select an OR with immediate as an ADD if the input bits are known zero. This allow the instruction to be 3address-fied if needed.

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

14 years agoImplement a feature (-vector-unaligned-mem) to allow targets to
David Greene [Mon, 11 Jan 2010 16:29:42 +0000 (16:29 +0000)]
Implement a feature (-vector-unaligned-mem) to allow targets to
ignore alignment requirements for SIMD memory operands.  This
is useful on architectures like the AMD 10h that do not trap on
unaligned references if a status bit is twiddled at startup time.

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

14 years agoRespond to Chris' review:
Victor Hernandez [Mon, 11 Jan 2010 07:45:19 +0000 (07:45 +0000)]
Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().

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

14 years agoadd one more bitfield optimization, allowing clang to generate
Chris Lattner [Mon, 11 Jan 2010 06:55:24 +0000 (06:55 +0000)]
add one more bitfield optimization, allowing clang to generate
good code on PR4216:

_test_bitfield:                                             ## @test_bitfield
orl $32962, %edi
movl $4294941946, %eax
andq %rdi, %rax
ret

instead of:

_test_bitfield:
        movl    $4294941696, %ecx
        movl    %edi, %eax
        orl     $194, %edi
        orl     $32768, %eax
        andq    $250, %rdi
        andq    %rax, %rcx
        movq    %rdi, %rax
        orq     %rcx, %rax
        ret

Evan is looking into the remaining andq+imm -> andl optimization.

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

14 years agoExtend CanEvaluateZExtd to handle and/or/xor more aggressively in the
Chris Lattner [Mon, 11 Jan 2010 04:05:13 +0000 (04:05 +0000)]
Extend CanEvaluateZExtd to handle and/or/xor more aggressively in the
BitsToClear case.  This allows it to promote expressions which have an
and/or/xor after the lshr, promoting cases like test2 (from PR4216)
and test3 (random extample extracted from a spec benchmark).

clang now compiles the code in PR4216 into:

_test_bitfield:                                             ## @test_bitfield
movl %edi, %eax
orl $194, %eax
movl $4294902010, %ecx
andq %rax, %rcx
orl $32768, %edi
andq $39936, %rdi
movq %rdi, %rax
orq %rcx, %rax
ret

instead of:

_test_bitfield:                                             ## @test_bitfield
movl %edi, %eax
orl $194, %eax
movl $4294902010, %ecx
andq %rax, %rcx
shrl $8, %edi
orl $128, %edi
shlq $8, %rdi
andq $39936, %rdi
movq %rdi, %rax
orq %rcx, %rax
ret

which is still not great, but is progress.

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

14 years agoRemove the dead TD argument to CanEvaluateZExtd, and add a
Chris Lattner [Mon, 11 Jan 2010 03:32:00 +0000 (03:32 +0000)]
Remove the dead TD argument to CanEvaluateZExtd, and add a
new BitsToClear result which allows us to start promoting
expressions that end with a lshr-by-constant.  This is
conservatively correct and better than what we had before
(see testcases) but still needs to be extended further.

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

14 years agoimprove comments, remove dead TD argument to CanEvaluateSExtd.
Chris Lattner [Mon, 11 Jan 2010 02:43:35 +0000 (02:43 +0000)]
improve comments, remove dead TD argument to CanEvaluateSExtd.

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

14 years agoteach sext optimization to handle truncs from types that are not
Chris Lattner [Sun, 10 Jan 2010 20:30:41 +0000 (20:30 +0000)]
teach sext optimization to handle truncs from types that are not
the dest of the sext.

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

14 years agoteach zext optimization how to deal with truncs that don't come from
Chris Lattner [Sun, 10 Jan 2010 20:25:54 +0000 (20:25 +0000)]
teach zext optimization how to deal with truncs that don't come from
the zext dest type.  This allows us to handle test52/53 in cast.ll,
and allows llvm-gcc to generate much better code for PR4216 in -m64
mode:

_test_bitfield:                                             ## @test_bitfield
orl $32962, %edi
movl %edi, %eax
andl $-25350, %eax
ret

This also fixes a bug handling vector extends, ensuring that the
mask produced is a vector constant, not an integer constant.

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

14 years agofix a buggy assertion, CreateIntegerCast should allow
Chris Lattner [Sun, 10 Jan 2010 20:21:42 +0000 (20:21 +0000)]
fix a buggy assertion, CreateIntegerCast should allow
integer vectors as well as just integers.

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

14 years agoSuppress a warning on gcc 4.4.
Mikhail Glushenkov [Sun, 10 Jan 2010 18:48:49 +0000 (18:48 +0000)]
Suppress a warning on gcc 4.4.

warning: suggest parentheses around ‘&&’ within ‘||’.

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

14 years agosimplify CanEvaluateSExtd to return a bool now that we have a
Chris Lattner [Sun, 10 Jan 2010 07:57:20 +0000 (07:57 +0000)]
simplify CanEvaluateSExtd to return a bool now that we have a
simpler profitability predicate.

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

14 years agothe NumCastsRemoved argument to CanEvaluateSExtd is dead, remove it.
Chris Lattner [Sun, 10 Jan 2010 07:42:21 +0000 (07:42 +0000)]
the NumCastsRemoved argument to CanEvaluateSExtd is dead, remove it.

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

14 years agonow that the cost model has changed, we can always consider
Chris Lattner [Sun, 10 Jan 2010 07:40:50 +0000 (07:40 +0000)]
now that the cost model has changed, we can always consider
elimination of a sign extend to be a win, which simplifies
the client of CanEvaluateSExtd, and allows us to eliminate
more casts (examples taken from real code).

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

14 years agoCompute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnr...
Victor Hernandez [Sun, 10 Jan 2010 07:14:18 +0000 (07:14 +0000)]
Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().

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

14 years agochange the preferred canonical form for a sign extension to be
Chris Lattner [Sun, 10 Jan 2010 07:08:30 +0000 (07:08 +0000)]
change the preferred canonical form for a sign extension to be
lshr+ashr instead of trunc+sext.  We want to avoid type
conversions whenever possible, it is easier to codegen expressions
without truncates and extensions.

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

14 years agofix indentation of switch statements, no functionality change.
Chris Lattner [Sun, 10 Jan 2010 06:59:55 +0000 (06:59 +0000)]
fix indentation of switch statements, no functionality change.

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

14 years agofix pasto that broke bootstrap.
Chris Lattner [Sun, 10 Jan 2010 06:50:04 +0000 (06:50 +0000)]
fix pasto that broke bootstrap.

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

14 years agosimplify CanEvaluateZExtd now that we don't care about the number of
Chris Lattner [Sun, 10 Jan 2010 02:50:04 +0000 (02:50 +0000)]
simplify CanEvaluateZExtd now that we don't care about the number of
bits known clear in the result and don't care about the # casts
eliminated.  TD is also dead but keeping it for now.

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

14 years agotwo changes:
Chris Lattner [Sun, 10 Jan 2010 02:39:31 +0000 (02:39 +0000)]
two changes:
1) don't try to optimize a sext or zext that is only used by a trunc, let
   the trunc get optimized first.  This avoids some pointless effort in
   some common cases since instcombine scans down a block in the first pass.
2) Change the cost model for zext elimination to consider an 'and' cheaper
   than a zext.  This allows us to do it more aggressively, and for the next
   patch to simplify the code quite a bit.

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

14 years agoenhance CanEvaluateZExtd to handle shift left and sext, allowing
Chris Lattner [Sun, 10 Jan 2010 02:22:12 +0000 (02:22 +0000)]
enhance CanEvaluateZExtd to handle shift left and sext, allowing
more expressions to be promoted and casts eliminated.

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

14 years agoremove an xform subsumed by EvaluateInDifferentType.
Chris Lattner [Sun, 10 Jan 2010 01:35:55 +0000 (01:35 +0000)]
remove an xform subsumed by EvaluateInDifferentType.

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

14 years agoFix nondeterministic behavior.
Julien Lerouge [Sun, 10 Jan 2010 01:07:22 +0000 (01:07 +0000)]
Fix nondeterministic behavior.

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

14 years agoclean up this xform by using m_Trunc.
Chris Lattner [Sun, 10 Jan 2010 01:04:31 +0000 (01:04 +0000)]
clean up this xform by using m_Trunc.

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

14 years agoinline and remove the rest of commonIntCastTransforms.
Chris Lattner [Sun, 10 Jan 2010 01:00:46 +0000 (01:00 +0000)]
inline and remove the rest of commonIntCastTransforms.

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

14 years agoInline the expression type promotion/demotion stuff out of
Chris Lattner [Sun, 10 Jan 2010 00:58:42 +0000 (00:58 +0000)]
Inline the expression type promotion/demotion stuff out of
commonIntCastTransforms into the callers, eliminating a switch,
and allowing the static predicate  methods to be moved down to
live next to the corresponding function.  No functionality
change.

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

14 years agohopefully unbreak the ocaml bindings.
Chris Lattner [Sat, 9 Jan 2010 23:25:21 +0000 (23:25 +0000)]
hopefully unbreak the ocaml bindings.

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

14 years agoadd 3 passes which have been added but aren't used afaik.
Chris Lattner [Sat, 9 Jan 2010 22:30:40 +0000 (22:30 +0000)]
add 3 passes which have been added but aren't used afaik.

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

14 years ago"In order to ease automatic bindings generation, it would be helpful if boolean value...
Chris Lattner [Sat, 9 Jan 2010 22:27:07 +0000 (22:27 +0000)]
"In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."

Patch by James Y Knight!

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

14 years agoClarify the requirements for a "tail call" to actually be optimized into a
Jeffrey Yasskin [Sat, 9 Jan 2010 19:44:16 +0000 (19:44 +0000)]
Clarify the requirements for a "tail call" to actually be optimized into a
jump.  People clearly weren't finding the extra requirements in
CodeGenerator.html.

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

14 years agofix bogus test
Chris Lattner [Sat, 9 Jan 2010 19:24:49 +0000 (19:24 +0000)]
fix bogus test

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

14 years agofix bogus test
Chris Lattner [Sat, 9 Jan 2010 19:24:18 +0000 (19:24 +0000)]
fix bogus test

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

14 years agofix PR5983, reject function bodies with no blocks per the grammar.
Chris Lattner [Sat, 9 Jan 2010 19:20:07 +0000 (19:20 +0000)]
fix PR5983, reject function bodies with no blocks per the grammar.

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

14 years agoimprove documentation for linkonce to be less confusing.
Chris Lattner [Sat, 9 Jan 2010 19:15:14 +0000 (19:15 +0000)]
improve documentation for linkonce to be less confusing.

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

14 years agoFix http://llvm.org/PR5729: x86-64 tail calls were putting their targets into
Jeffrey Yasskin [Sat, 9 Jan 2010 18:56:43 +0000 (18:56 +0000)]
Fix llvm.org/PR5729: x86-64 tail calls were putting their targets into
R11, and then asserting that the target was in R9.  Since R9 isn't reserved for
the target anymore, and is used as an argument, this patch changes the
assertion.

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

14 years ago2010 is upon us.
Chris Lattner [Sat, 9 Jan 2010 18:40:31 +0000 (18:40 +0000)]
2010 is upon us.

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

14 years agoUse WriteAsOperand instead of getName() to print loop header names,
Dan Gohman [Sat, 9 Jan 2010 18:17:45 +0000 (18:17 +0000)]
Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.

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

14 years agoTighten up the vim LLVM IR syntax highlighting regex for labels, and add a
Dan Gohman [Sat, 9 Jan 2010 17:22:48 +0000 (17:22 +0000)]
Tighten up the vim LLVM IR syntax highlighting regex for labels, and add a
highlighting rule for identifiers.

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

14 years agoSet the vim auto-indent setting for open braces after case statements to
Dan Gohman [Sat, 9 Jan 2010 17:15:21 +0000 (17:15 +0000)]
Set the vim auto-indent setting for open braces after case statements to
follow LLVM source convention.

Before:
  case X: {
            stuff;
          }

After:
  case X: {
    stuff;
  }

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

14 years agoFixed linking of modules containing aliases to constant bitcasts. Existing behaviour...
David Chisnall [Sat, 9 Jan 2010 16:27:31 +0000 (16:27 +0000)]
Fixed linking of modules containing aliases to constant bitcasts.  Existing behaviour first tried to replace the aliases with the global that they aliased (rather than the bitcast), causing a crash on an assert because the types didn't match.  When this was fixed, it then did the same thing creating the new alias (creating an alias with a different type to its aliasee).

Linking modules containing aliases to GEPs is still not quite right.  GEPs that are equivalent to bitcasts will be replaced by bitcasts, GEPs that are not will just break.  Aliases to GEPs that are not equivalent to bitcasts are horribly broken anyway (it might be worth adding an assert when creating the alias to prevent these being created; they just cause problems later).

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

14 years agoSuppress use of uninitialized variable warning.
Duncan Sands [Sat, 9 Jan 2010 08:30:33 +0000 (08:30 +0000)]
Suppress use of uninitialized variable warning.

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

14 years agoonly factor from expressions whose uses are empty and whose
Chris Lattner [Sat, 9 Jan 2010 06:01:36 +0000 (06:01 +0000)]
only factor from expressions whose uses are empty and whose
base is the right expression type.  This fixes PR5981.

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

14 years agoRevert an earlier change to SIGN_EXTEND_INREG for vectors. The VTSDNode
Dan Gohman [Sat, 9 Jan 2010 02:13:55 +0000 (02:13 +0000)]
Revert an earlier change to SIGN_EXTEND_INREG for vectors. The VTSDNode
really does need to be a vector type, because
TargetLowering::getOperationAction for SIGN_EXTEND_INREG uses that type,
and it needs to be able to distinguish between vectors and scalars.

Also, fix some more issues with legalization of vector casts.

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

14 years agoclean up this code, add a fixme.
Chris Lattner [Sat, 9 Jan 2010 02:02:37 +0000 (02:02 +0000)]
clean up this code, add a fixme.

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

14 years agoDelete NamedMDSymTable while destrucing Module.
Devang Patel [Sat, 9 Jan 2010 01:44:59 +0000 (01:44 +0000)]
Delete NamedMDSymTable while destrucing Module.
Disable  copy ctor and operator= for NamedMDSymTable. Hide typedef that should be public.

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

14 years agoAdd DEBUG_DECLARE. Not used yet.
Dale Johannesen [Sat, 9 Jan 2010 01:24:25 +0000 (01:24 +0000)]
Add DEBUG_DECLARE.  Not used yet.

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