oota-llvm.git
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

14 years agoNamedMDNode is never used so there is no need to enumerate it here.
Devang Patel [Sat, 9 Jan 2010 01:24:03 +0000 (01:24 +0000)]
NamedMDNode is never used so there is no need to enumerate it here.

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

14 years agoFix nondeterministic behavior.
Julien Lerouge [Sat, 9 Jan 2010 01:06:49 +0000 (01:06 +0000)]
Fix nondeterministic behavior.

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

14 years agoNamedMDNode element is either null or MDNode. Otherwise this is a malformed NamedMDNo...
Devang Patel [Sat, 9 Jan 2010 01:02:22 +0000 (01:02 +0000)]
NamedMDNode element is either null or MDNode. Otherwise this is a malformed NamedMDNode record.

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

14 years agoDerive NamedMDNode from Value.
Devang Patel [Sat, 9 Jan 2010 00:30:14 +0000 (00:30 +0000)]
Derive NamedMDNode from Value.

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

14 years agoDan pointed out checking whether a node is dead by comparing its opcode to ISD::DELET...
Evan Cheng [Sat, 9 Jan 2010 00:21:08 +0000 (00:21 +0000)]
Dan pointed out checking whether a node is dead by comparing its opcode to ISD::DELETED_NODE is not safe. Use a DAGUpdateListener to remove dead nodes from work list instead.

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

14 years agoAdd DEBUG_VALUE. Not used yet.
Dale Johannesen [Fri, 8 Jan 2010 23:51:25 +0000 (23:51 +0000)]
Add DEBUG_VALUE.  Not used yet.

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

14 years agoFix a critical bug in 64-bit atomic operation lowering for 32-bit. The results of...
Evan Cheng [Fri, 8 Jan 2010 23:41:50 +0000 (23:41 +0000)]
Fix a critical bug in 64-bit atomic operation lowering for 32-bit. The results of the cmpxchg8b instructions are being thrown away when it branches back to the top of the checking loop. This means the loop always compares against the old value and this can result in a dead lock.

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

14 years agoGrammar thinko.
Eric Christopher [Fri, 8 Jan 2010 21:42:39 +0000 (21:42 +0000)]
Grammar thinko.

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

14 years agoRemove unnecessary dyn_cast and add a comment. Part of a WIP.
Eric Christopher [Fri, 8 Jan 2010 21:37:11 +0000 (21:37 +0000)]
Remove unnecessary dyn_cast and add a comment.  Part of a WIP.

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

14 years agomplement a theoretical fixme.
Chris Lattner [Fri, 8 Jan 2010 19:28:47 +0000 (19:28 +0000)]
mplement a theoretical fixme.

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

14 years agorename CanEvaluateInDifferentType -> CanEvaluateTruncated and
Chris Lattner [Fri, 8 Jan 2010 19:19:23 +0000 (19:19 +0000)]
rename CanEvaluateInDifferentType -> CanEvaluateTruncated and
simplify it now that it is only used for truncates.

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

14 years agoFix comment.
Evan Cheng [Fri, 8 Jan 2010 19:14:57 +0000 (19:14 +0000)]
Fix comment.

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

14 years agoteach instcombine to delete sign extending shift pairs (sra(shl X, C), C) when
Chris Lattner [Fri, 8 Jan 2010 19:04:21 +0000 (19:04 +0000)]
teach instcombine to delete sign extending shift pairs (sra(shl X, C), C) when
the input is already sign extended.

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

14 years agofix PR5978 by peeling the loop so that we avoid shifting the
Chris Lattner [Fri, 8 Jan 2010 19:02:23 +0000 (19:02 +0000)]
fix PR5978 by peeling the loop so that we avoid shifting the
result int by 8 for the first byte.  While normally harmless,
if the result is smaller than a byte, this shift is invalid.

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

14 years agoSuppress an unused variable warning when assertions are off;
Duncan Sands [Fri, 8 Jan 2010 17:51:48 +0000 (17:51 +0000)]
Suppress an unused variable warning when assertions are off;
remove some trailing whitespace while there.

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

14 years agotidy up some stuff duncan pointed out.
Chris Lattner [Fri, 8 Jan 2010 17:48:19 +0000 (17:48 +0000)]
tidy up some stuff duncan pointed out.

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

14 years agoMinor change, change the order of two "let Inst{...}" stmts within multiclass
Johnny Chen [Fri, 8 Jan 2010 17:41:33 +0000 (17:41 +0000)]
Minor change, change the order of two "let Inst{...}" stmts within multiclass
T2I_bin_ii12rs definition.

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

14 years agoAfter further thought revert the patch to make fast-isel avoid
Eric Christopher [Fri, 8 Jan 2010 08:24:49 +0000 (08:24 +0000)]
After further thought revert the patch to make fast-isel avoid
putting relocations into the constant pool - this isn't needed
for correctness and in the rare occasion it happens would pull
us out of fast isel for the block.

If fast-isel application startup time ever becomes an issue we
can add better support for these addresses instead of bailing.

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

14 years agoReplaceAllUsesOfValueWith may delete other nodes that the one being replaced. Do...
Evan Cheng [Fri, 8 Jan 2010 02:36:12 +0000 (02:36 +0000)]
ReplaceAllUsesOfValueWith may delete other nodes that the one being replaced. Do not delete dead nodes again.

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

14 years agoFix what looks to me obvious instruction definition bugs.
Evan Cheng [Fri, 8 Jan 2010 01:29:19 +0000 (01:29 +0000)]
Fix what looks to me obvious instruction definition bugs.
1. CMPXCHG8B and CMPXCHG16B did not specify implicit physical register defs and uses.
2. LCMPXCHG8B is loading 64 bit memory, not 32 bit.

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

14 years agoRemove extraneous include.
Eric Christopher [Fri, 8 Jan 2010 00:05:33 +0000 (00:05 +0000)]
Remove extraneous include.

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

14 years agoAdd assert to check dominance dfs numbers.
Tobias Grosser [Thu, 7 Jan 2010 23:50:41 +0000 (23:50 +0000)]
Add assert to check dominance dfs numbers.

Compare the dominance information calculated using a dominance tree walk to the
information calculated based on DFS numbers, if XDEBUG is enabled.

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

14 years agoRemove workaround in PostDominators
Tobias Grosser [Thu, 7 Jan 2010 23:50:25 +0000 (23:50 +0000)]
Remove workaround in PostDominators

Remove a FIXME and unify code that was necessary to work around broken
updateDFSNumbers().  Before updateDFSNumbers() did not work correctly for post
dominators.

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

14 years agoFix DFS number calculation for postdominators
Tobias Grosser [Thu, 7 Jan 2010 23:50:06 +0000 (23:50 +0000)]
Fix DFS number calculation for postdominators

The DFS number calculation for postdominators was broken. In the case of
multiple exits that form the post dominator root nodes, do not iterate over
all exits, but start from the virtual root node. Otherwise bbs, that are not
post dominated by any exit but by the virtual root node, will never be assigned
a DFS number.

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

14 years agoteach ComputeNumSignBits to look through PHI nodes.
Chris Lattner [Thu, 7 Jan 2010 23:44:37 +0000 (23:44 +0000)]
teach ComputeNumSignBits to look through PHI nodes.

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

14 years agofilecheckize
Chris Lattner [Thu, 7 Jan 2010 23:42:23 +0000 (23:42 +0000)]
filecheckize

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

14 years agoEnhance instcombine to reason more strongly about promoting computation
Chris Lattner [Thu, 7 Jan 2010 23:41:00 +0000 (23:41 +0000)]
Enhance instcombine to reason more strongly about promoting computation
that feeds into a zext, similar to the patch I did yesterday for sext.
There is a lot of room for extension beyond this patch.

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

14 years agoFix rdar://7517201, a regression introduced by r92849.
Chris Lattner [Thu, 7 Jan 2010 21:59:23 +0000 (21:59 +0000)]
Fix rdar://7517201, a regression introduced by r92849.
When folding a and(any_ext(load)) both the any_ext and the
load have to have only a single use.

This removes the anyext-uses.ll testcase which started failing
because it is unreduced and unclear what it is testing.

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

14 years agofactor this code better and reduce nesting at the same
Chris Lattner [Thu, 7 Jan 2010 21:53:27 +0000 (21:53 +0000)]
factor this code better and reduce nesting at the same
time, no functionality change.

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

14 years agoRevert r92939. These intrinsics get matched to LLVM instructions,
David Greene [Thu, 7 Jan 2010 21:43:58 +0000 (21:43 +0000)]
Revert r92939.  These intrinsics get matched to LLVM instructions,
so removing at Chris' request.

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

14 years agoAPInt'fy TargetLowering::SimplifySetCC to fix PR5963.
Evan Cheng [Thu, 7 Jan 2010 20:58:44 +0000 (20:58 +0000)]
APInt'fy TargetLowering::SimplifySetCC to fix PR5963.

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

14 years agoAdd some "missing" instrinsics to make the SSE intrinsic set a bit more
David Greene [Thu, 7 Jan 2010 19:47:43 +0000 (19:47 +0000)]
Add some "missing" instrinsics to make the SSE intrinsic set a bit more
orthogonal.

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

14 years agoSimplify code. No intended functionality/performance change.
Benjamin Kramer [Thu, 7 Jan 2010 19:46:15 +0000 (19:46 +0000)]
Simplify code. No intended functionality/performance change.

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

14 years agoIf the data requires a relocation then don't attempt to
Eric Christopher [Thu, 7 Jan 2010 19:45:14 +0000 (19:45 +0000)]
If the data requires a relocation then don't attempt to
add it to the constant pool for fast-isel. We already
don't add it for the normal case.

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

14 years agoWe need to put any kind of data with a relocation into a
Eric Christopher [Thu, 7 Jan 2010 19:44:05 +0000 (19:44 +0000)]
We need to put any kind of data with a relocation into a
not-readonly segment on darwin.

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

14 years agoUse separate namespace for named metadata.
Devang Patel [Thu, 7 Jan 2010 19:39:36 +0000 (19:39 +0000)]
Use separate namespace for named metadata.

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

14 years agoFix occurrence typo
Kovarththanan Rajaratnam [Thu, 7 Jan 2010 18:46:52 +0000 (18:46 +0000)]
Fix occurrence typo

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

14 years agoconstant materialization could be improved.
Chris Lattner [Thu, 7 Jan 2010 17:53:10 +0000 (17:53 +0000)]
constant materialization could be improved.

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

14 years agoKill dead store.
Benjamin Kramer [Thu, 7 Jan 2010 17:50:57 +0000 (17:50 +0000)]
Kill dead store.

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

14 years agoRemove dead variable.
Benjamin Kramer [Thu, 7 Jan 2010 17:29:08 +0000 (17:29 +0000)]
Remove dead variable.

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