oota-llvm.git
16 years agoFix arg promotion to propagate the correct attrs on the calls to
Chris Lattner [Thu, 17 Jan 2008 01:17:03 +0000 (01:17 +0000)]
Fix arg promotion to propagate the correct attrs on the calls to
promoted functions.  This is important for varargs calls in
particular.  Thanks to duncan for providing a great testcase.

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

16 years agoReplace std::vector<bool> with BitVector.
Evan Cheng [Thu, 17 Jan 2008 00:35:26 +0000 (00:35 +0000)]
Replace std::vector<bool> with BitVector.

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

16 years agoFixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.
Evan Cheng [Wed, 16 Jan 2008 23:11:54 +0000 (23:11 +0000)]
Fixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.

It's not safe to use the two value CombineTo variant to combine away a dead load.
e.g.
v1, chain2 = load chain1, loc
v2, chain3 = load chain2, loc
v3         = add v2, c
Now we replace use of v1 with undef, use of chain2 with chain1.
ReplaceAllUsesWith() will iterate through uses of the first load and update operands:
v1, chain2 = load chain1, loc
v2, chain3 = load chain1, loc
v3         = add v2, c
Now the second load is the same as the first load, SelectionDAG cse will ensure
the use of second load is replaced with the first load.
v1, chain2 = load chain1, loc
v3         = add v1, c
Then v1 is replaced with undef and bad things happen.

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

16 years agoTrampoline support for x86-64. This looks like
Duncan Sands [Wed, 16 Jan 2008 22:55:25 +0000 (22:55 +0000)]
Trampoline support for x86-64.  This looks like
it should work, but I have no machine to test
it on.  Committed because it will at least
cause no harm, and maybe someone can test it
for me!

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

16 years agoHandle attribute(used) global variables that are i8.
Chris Lattner [Wed, 16 Jan 2008 21:35:43 +0000 (21:35 +0000)]
Handle attribute(used) global variables that are i8.

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

16 years agoDo not mark EH tables no-dead-strip unless the
Dale Johannesen [Wed, 16 Jan 2008 19:59:28 +0000 (19:59 +0000)]
Do not mark EH tables no-dead-strip unless the
associated function is so marked.

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

16 years agoadd testcase for regression
Chris Lattner [Wed, 16 Jan 2008 18:03:52 +0000 (18:03 +0000)]
add testcase for regression

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

16 years agoFix a ppc long double regression I introduced yesterday due to a
Chris Lattner [Wed, 16 Jan 2008 17:59:31 +0000 (17:59 +0000)]
Fix a ppc long double regression I introduced yesterday due to a
simplification.  This fixes automotive-basicmath on PPC.

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

16 years agomerge a few pieces of code that do the store/load to stack
Chris Lattner [Wed, 16 Jan 2008 07:51:34 +0000 (07:51 +0000)]
merge a few pieces of code that do the store/load to stack
pattern to use EmitStackConvert now.

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

16 years agorename ExpandBIT_CONVERT to EmitStackConvert, generalizing
Chris Lattner [Wed, 16 Jan 2008 07:45:30 +0000 (07:45 +0000)]
rename ExpandBIT_CONVERT to EmitStackConvert, generalizing
it to allow it to emit different load and store kinds.

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

16 years agosimplify a bunch of code by using SelectionDAG::CreateStackTemporary
Chris Lattner [Wed, 16 Jan 2008 07:03:22 +0000 (07:03 +0000)]
simplify a bunch of code by using SelectionDAG::CreateStackTemporary
instead of inlining its body.

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

16 years agoChange legalizeop of FP_ROUND and FP_EXTEND to not fall through
Chris Lattner [Wed, 16 Jan 2008 06:57:07 +0000 (06:57 +0000)]
Change legalizeop of FP_ROUND and FP_EXTEND  to not fall through
into the ANY_EXTEND/ZERO_EXTEND/SIGN_EXTEND code to simplify it.

Unmerge the code for FP_ROUND and FP_EXTEND from each other to
make each one simpler.

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

16 years agomake sure to use a cpu that has sse.
Chris Lattner [Wed, 16 Jan 2008 06:32:02 +0000 (06:32 +0000)]
make sure to use a cpu that has sse.

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

16 years agomake it more clear that this predicate only applies to scalar FP types.
Chris Lattner [Wed, 16 Jan 2008 06:24:21 +0000 (06:24 +0000)]
make it more clear that this predicate only applies to scalar FP types.

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

16 years agointroduce a isTypeInSSEReg predicate, which allows us to simplify
Chris Lattner [Wed, 16 Jan 2008 06:19:45 +0000 (06:19 +0000)]
introduce a isTypeInSSEReg predicate, which allows us to simplify
some code.  No functionality change.

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

16 years agoMy previous commit had an incomplete message, it should have been:
Chris Lattner [Wed, 16 Jan 2008 05:56:59 +0000 (05:56 +0000)]
My previous commit had an incomplete message, it should have been:

make the 'fp return in ST(0)' optimization smart enough to
look through token factor nodes.  THis allows us to compile
testcases like CodeGen/X86/fp-stack-retcopy.ll into:

_carg:
subl $12, %esp
call L_foo$stub
fstpl (%esp)
fldl (%esp)
addl $12, %esp
ret

instead of:

_carg:
subl $28, %esp
call L_foo$stub
fstpl 16(%esp)
movsd 16(%esp), %xmm0
movsd %xmm0, 8(%esp)
fldl 8(%esp)
addl $28, %esp
ret

Still not optimal, but much better and this is a trivial patch.  Fixing
the rest requires invasive surgery that is is not llvm 2.2 material.

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

16 years agomake the 'fp return in ST(0)' optimization smart enough to
Chris Lattner [Wed, 16 Jan 2008 05:53:06 +0000 (05:53 +0000)]
make the 'fp return in ST(0)' optimization smart enough to
look through token factor

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

16 years agovarious whitespace cleanups, no functionality change.
Chris Lattner [Wed, 16 Jan 2008 05:52:18 +0000 (05:52 +0000)]
various whitespace cleanups, no functionality change.

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

16 years agoFactor the ReachesChainWithoutSideEffects out of dag combiner into
Chris Lattner [Wed, 16 Jan 2008 05:49:24 +0000 (05:49 +0000)]
Factor the ReachesChainWithoutSideEffects out of dag combiner into
a public SDOperand::reachesChainWithoutSideEffects method.  No
functionality change.

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

16 years agoDo not strip llvm.used values.
Devang Patel [Wed, 16 Jan 2008 03:33:05 +0000 (03:33 +0000)]
Do not strip llvm.used values.

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

16 years agoChanged ImmutableMap::find to return an iterator instead of a pointer
Ted Kremenek [Tue, 15 Jan 2008 23:53:53 +0000 (23:53 +0000)]
Changed ImmutableMap::find to return an iterator instead of a pointer
to the tree node.

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

16 years ago- Introduces versioning macro LLVM_LTO_VERSION
Devang Patel [Tue, 15 Jan 2008 23:52:34 +0000 (23:52 +0000)]
- Introduces versioning macro LLVM_LTO_VERSION
- Communicate symbol visibility
- Communicate code generation model

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

16 years agoCommit a piece that I missed before, patch by Alain Frisch
Chris Lattner [Tue, 15 Jan 2008 23:27:40 +0000 (23:27 +0000)]
Commit a piece that I missed before, patch by Alain Frisch

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

16 years agoMissed file from previous checkin.
Dale Johannesen [Tue, 15 Jan 2008 23:25:27 +0000 (23:25 +0000)]
Missed file from previous checkin.

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

16 years agoFix and enable EH for x86-64 Darwin. Adds
Dale Johannesen [Tue, 15 Jan 2008 23:24:56 +0000 (23:24 +0000)]
Fix and enable EH for x86-64 Darwin.  Adds
ShortenEHDataFor64Bits as a not-very-accurate
abstraction to cover all the changes in DwarfWriter.
Some cosmetic changes to Darwin assembly code for
gcc testsuite compatibility.

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

16 years agoMove some calls to getVRegDef higher in the callgraph, so they don't get executed...
Owen Anderson [Tue, 15 Jan 2008 22:58:11 +0000 (22:58 +0000)]
Move some calls to getVRegDef higher in the callgraph, so they don't get executed as frequently in performance sensitive code.

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

16 years agoimprove compatibility with mingw, patch by Alain Frisch
Chris Lattner [Tue, 15 Jan 2008 22:50:50 +0000 (22:50 +0000)]
improve compatibility with mingw, patch by Alain Frisch

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

16 years agoadd a test to ensure that argpromote of one argument doesn't
Chris Lattner [Tue, 15 Jan 2008 22:38:12 +0000 (22:38 +0000)]
add a test to ensure that argpromote of one argument doesn't
break the byval attr on some other argument.

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

16 years agoAdd description of 'llvm.trap' intrinsic. Also, minor fixes in formatting.
Anton Korobeynikov [Tue, 15 Jan 2008 22:31:34 +0000 (22:31 +0000)]
Add description of 'llvm.trap' intrinsic. Also, minor fixes in formatting.

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

16 years agoverify x86 generates ud2 for llvm.trap
Chris Lattner [Tue, 15 Jan 2008 22:22:02 +0000 (22:22 +0000)]
verify x86 generates ud2 for llvm.trap

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

16 years agoUnbreak the build.
Evan Cheng [Tue, 15 Jan 2008 22:19:35 +0000 (22:19 +0000)]
Unbreak the build.

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

16 years agonew testcase for llvm.trap.
Chris Lattner [Tue, 15 Jan 2008 22:17:26 +0000 (22:17 +0000)]
new testcase for llvm.trap.

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

16 years agoIf someone wants to implement ppc TRAP, they can go for it :)
Chris Lattner [Tue, 15 Jan 2008 22:15:02 +0000 (22:15 +0000)]
If someone wants to implement ppc TRAP, they can go for it :)

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

16 years agoThe type of the 'abort' node should be pointer type (because
Chris Lattner [Tue, 15 Jan 2008 22:09:33 +0000 (22:09 +0000)]
The type of the 'abort' node should be pointer type (because
it's a function pointer) not MVT::Other.  This fixes builtin_trap
lowering on ppc, alpha, ia64

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

16 years agorename SDTRet -> SDTNone.
Chris Lattner [Tue, 15 Jan 2008 22:02:54 +0000 (22:02 +0000)]
rename SDTRet -> SDTNone.
Move definition of 'trap' sdnode up from x86 instrinfo to targetselectiondag.td.

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

16 years agoRemove DefInst from LiveVariables::VarInfo. Use the facilities on MachineRegisterInf...
Owen Anderson [Tue, 15 Jan 2008 22:02:46 +0000 (22:02 +0000)]
Remove DefInst from LiveVariables::VarInfo.  Use the facilities on MachineRegisterInfo instead.

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

16 years agono need to expand ISD::TRAP to X86ISD::TRAP, just match ISD::TRAP.
Chris Lattner [Tue, 15 Jan 2008 21:58:22 +0000 (21:58 +0000)]
no need to expand ISD::TRAP to X86ISD::TRAP, just match ISD::TRAP.

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

16 years agoAdd support for targets that have a legal ISD::TRAP.
Chris Lattner [Tue, 15 Jan 2008 21:58:08 +0000 (21:58 +0000)]
Add support for targets that have a legal ISD::TRAP.

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

16 years agoAdd files to windows project files. Also include <algorithm> explicitly so that...
Chuck Rose III [Tue, 15 Jan 2008 21:43:17 +0000 (21:43 +0000)]
Add files to windows project files.  Also include <algorithm> explicitly so that vstudio build works

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

16 years agoFix JIT encoding of trap/ud2 instruction
Anton Korobeynikov [Tue, 15 Jan 2008 21:40:02 +0000 (21:40 +0000)]
Fix JIT encoding of trap/ud2 instruction

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

16 years agoReformatted. It was confusing the other way. No functionality change.
Bill Wendling [Tue, 15 Jan 2008 21:16:32 +0000 (21:16 +0000)]
Reformatted. It was confusing the other way. No functionality change.

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

16 years agoFix a memory correctness error noticed by valgrind (harmless in practice).
Gordon Henriksen [Tue, 15 Jan 2008 20:02:11 +0000 (20:02 +0000)]
Fix a memory correctness error noticed by valgrind (harmless in practice).

Thanks to Duncan Sands for noticing it.

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

16 years agoTestcase for gimplify_expr crash caused by an
Duncan Sands [Tue, 15 Jan 2008 19:55:41 +0000 (19:55 +0000)]
Testcase for gimplify_expr crash caused by an
unexpected placeholder_expr.

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

16 years agoOops. Forgot to commit this.
Evan Cheng [Tue, 15 Jan 2008 07:49:54 +0000 (07:49 +0000)]
Oops. Forgot to commit this.

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

16 years agoOops. Forgot to commit this.
Evan Cheng [Tue, 15 Jan 2008 07:49:36 +0000 (07:49 +0000)]
Oops. Forgot to commit this.

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

16 years agoFor PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
Anton Korobeynikov [Tue, 15 Jan 2008 07:02:33 +0000 (07:02 +0000)]
For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen

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

16 years agoclarify that byval is valid for any pointer argument.
Chris Lattner [Tue, 15 Jan 2008 04:34:22 +0000 (04:34 +0000)]
clarify that byval is valid for any pointer argument.

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

16 years agoRename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused param...
Evan Cheng [Tue, 15 Jan 2008 03:34:58 +0000 (03:34 +0000)]
Rename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused parameters of CCStructAssign and add size and alignment requirement info.

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

16 years agoBoth x86-32 and x86-64 handle byval parameter attributes.
Evan Cheng [Tue, 15 Jan 2008 03:15:41 +0000 (03:15 +0000)]
Both x86-32 and x86-64 handle byval parameter attributes.

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

16 years agoByVal stack slot alignment should be at least as large as pointer ABI alignment.
Evan Cheng [Tue, 15 Jan 2008 03:14:05 +0000 (03:14 +0000)]
ByVal stack slot alignment should be at least as large as pointer ABI alignment.

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

16 years agoRevert my last commit. Not needed.
Evan Cheng [Tue, 15 Jan 2008 03:10:35 +0000 (03:10 +0000)]
Revert my last commit. Not needed.

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

16 years agoSimplify CallInst::hasByValArgument using a new method.
Duncan Sands [Mon, 14 Jan 2008 19:57:00 +0000 (19:57 +0000)]
Simplify CallInst::hasByValArgument using a new method.

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

16 years agoI noticed that the trampoline straightening transformation could
Duncan Sands [Mon, 14 Jan 2008 19:52:09 +0000 (19:52 +0000)]
I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.

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

16 years agodon't create the post-ra scheduler unless it is enabled.
Chris Lattner [Mon, 14 Jan 2008 19:00:06 +0000 (19:00 +0000)]
don't create the post-ra scheduler unless it is enabled.

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

16 years agoremove dead #include
Chris Lattner [Mon, 14 Jan 2008 18:45:28 +0000 (18:45 +0000)]
remove dead #include

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

16 years agoNeed a space to separate Make options.
Evan Cheng [Mon, 14 Jan 2008 17:58:03 +0000 (17:58 +0000)]
Need a space to separate Make options.

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

16 years agoThis test is now the same as byval-1.ll, so remove it.
Duncan Sands [Mon, 14 Jan 2008 14:57:30 +0000 (14:57 +0000)]
This test is now the same as byval-1.ll, so remove it.

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

16 years agoTest that byval cannot be used with pointers to
Duncan Sands [Mon, 14 Jan 2008 14:55:05 +0000 (14:55 +0000)]
Test that byval cannot be used with pointers to
types with no size.

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

16 years agoWe now allow byval on fairly general pointer types.
Duncan Sands [Mon, 14 Jan 2008 06:53:45 +0000 (06:53 +0000)]
We now allow byval on fairly general pointer types.

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

16 years agoImprove the FP stackifier to decide all on its own whether
Chris Lattner [Mon, 14 Jan 2008 06:41:29 +0000 (06:41 +0000)]
Improve the FP stackifier to decide all on its own whether
an instruction kills a register or not.  This is cheap and
easy to do now that instructions record this on their flags,
and this eliminates the second pass of LiveVariables from the
x86 backend.  This speeds up a release llc by ~2.5%.

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

16 years agoSimplify code.
Evan Cheng [Mon, 14 Jan 2008 02:38:45 +0000 (02:38 +0000)]
Simplify code.

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

16 years agoFix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
Chris Lattner [Mon, 14 Jan 2008 02:09:12 +0000 (02:09 +0000)]
Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
byval work.  This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.

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

16 years agoThe isNotSuitableForSRA property is now dead, don't compute it.
Chris Lattner [Mon, 14 Jan 2008 01:32:52 +0000 (01:32 +0000)]
The isNotSuitableForSRA property is now dead, don't compute it.

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

16 years agoChange SRAGlobal to not depend on isNotSuitableForSRA, which makes it very
Chris Lattner [Mon, 14 Jan 2008 01:31:05 +0000 (01:31 +0000)]
Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very
difficult to understand the invariants.

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

16 years agoMake the 'shrink global to bool' optimization more self contained, and thus
Chris Lattner [Mon, 14 Jan 2008 01:17:44 +0000 (01:17 +0000)]
Make the 'shrink global to bool' optimization more self contained, and thus
easier to show that its safe.  No functionality change.

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

16 years agoTurn a memcpy from a double* into a load/store of double instead of
Chris Lattner [Mon, 14 Jan 2008 00:28:35 +0000 (00:28 +0000)]
Turn a memcpy from a double* into a load/store of double instead of
a load/store of i64.  The later prevents promotion/scalarrepl of the
source and dest in many cases.

This fixes the 300% performance regression of the byval stuff on
stepanov_v1p2.

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

16 years agofactor memcpy/memmove simplification out to its own SimplifyMemTransfer
Chris Lattner [Sun, 13 Jan 2008 23:50:23 +0000 (23:50 +0000)]
factor memcpy/memmove simplification out to its own SimplifyMemTransfer
method, no functionality change.

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

16 years agosimplify some code. If we can infer alignment for source and dest that are
Chris Lattner [Sun, 13 Jan 2008 22:30:28 +0000 (22:30 +0000)]
simplify some code.  If we can infer alignment for source and dest that are
greater than memcpy alignment, and if we lower to load/store, use the best
alignment info we have.

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

16 years agosimplify some code by adding a InsertBitCastBefore method,
Chris Lattner [Sun, 13 Jan 2008 22:23:22 +0000 (22:23 +0000)]
simplify some code by adding a InsertBitCastBefore method,
make memmove->memcpy conversion a bit simpler.

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

16 years agoWhitespace tweak.
Duncan Sands [Sun, 13 Jan 2008 21:20:29 +0000 (21:20 +0000)]
Whitespace tweak.

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

16 years agoRemove the assumption that byval has been applied to
Duncan Sands [Sun, 13 Jan 2008 21:19:59 +0000 (21:19 +0000)]
Remove the assumption that byval has been applied to
a pointer to a struct.

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

16 years agoAllow the byval attribute for pointers to any type with
Duncan Sands [Sun, 13 Jan 2008 21:19:12 +0000 (21:19 +0000)]
Allow the byval attribute for pointers to any type with
a size, not just structs.

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

16 years agoFix PR1907, a nasty miscompilation because instcombine didn't
Chris Lattner [Sun, 13 Jan 2008 20:59:02 +0000 (20:59 +0000)]
Fix PR1907, a nasty miscompilation because instcombine didn't
realize that ne & sgt  was a signed comparison (it was only
looking at whether the left compare was signed).

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

16 years agoCheck that nested functions don't get pointless
Duncan Sands [Sun, 13 Jan 2008 18:44:12 +0000 (18:44 +0000)]
Check that nested functions don't get pointless
static chains.

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

16 years agoSmall simplification.
Duncan Sands [Sun, 13 Jan 2008 08:12:17 +0000 (08:12 +0000)]
Small simplification.

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

16 years agoWhen turning a call to a bitcast function into a direct call,
Duncan Sands [Sun, 13 Jan 2008 08:02:44 +0000 (08:02 +0000)]
When turning a call to a bitcast function into a direct call,
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.

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

16 years agonew testcase for rdar://5685492
Chris Lattner [Sun, 13 Jan 2008 00:19:57 +0000 (00:19 +0000)]
new testcase for rdar://5685492

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

16 years agoimprove cygwin compatibility, patch by Sam Bishop
Chris Lattner [Sat, 12 Jan 2008 22:54:07 +0000 (22:54 +0000)]
improve cygwin compatibility, patch by Sam Bishop

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

16 years agoclarify a note
Chris Lattner [Sat, 12 Jan 2008 18:58:46 +0000 (18:58 +0000)]
clarify a  note

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

16 years agoAdd hasByValArgument() to test if a call instruction has byval argument(s).
Evan Cheng [Sat, 12 Jan 2008 18:57:32 +0000 (18:57 +0000)]
Add hasByValArgument() to test if a call instruction has byval argument(s).

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

16 years agowe don't have to make an explicit copy of a byval argument when
Chris Lattner [Sat, 12 Jan 2008 18:54:29 +0000 (18:54 +0000)]
we don't have to make an explicit copy of a byval argument when
inlining a function if we know that the function does not write
to *any* memory.  This implements test/Transforms/Inline/byval2.ll

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

16 years agoIndirect call with byval parameter requires a cast first.
Evan Cheng [Sat, 12 Jan 2008 18:53:07 +0000 (18:53 +0000)]
Indirect call with byval parameter requires a cast first.

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

16 years agoBe more liberal in what parameter attributes are
Duncan Sands [Sat, 12 Jan 2008 16:42:01 +0000 (16:42 +0000)]
Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.

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

16 years agoAllow clients to specify the inline threshold when creating
Chris Lattner [Sat, 12 Jan 2008 06:49:13 +0000 (06:49 +0000)]
Allow clients to specify the inline threshold when creating
the inliner pass.  Patch by Robert Zeh.

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

16 years agoAdd support for NetBSD, patch by Krister Walfridsson!
Chris Lattner [Sat, 12 Jan 2008 06:46:09 +0000 (06:46 +0000)]
Add support for NetBSD, patch by Krister Walfridsson!

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

16 years agoAdd -disable-lto optimization.
Evan Cheng [Sat, 12 Jan 2008 04:27:18 +0000 (04:27 +0000)]
Add -disable-lto optimization.

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

16 years agothis actually does pass with 4.0
Chris Lattner [Sat, 12 Jan 2008 01:45:22 +0000 (01:45 +0000)]
this actually does pass with 4.0

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

16 years agoCode clean up.
Evan Cheng [Sat, 12 Jan 2008 01:08:07 +0000 (01:08 +0000)]
Code clean up.

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

16 years agoByVal arguments are passed on stack. Make sure to allocate a slot using size and...
Evan Cheng [Sat, 12 Jan 2008 01:07:41 +0000 (01:07 +0000)]
ByVal arguments are passed on stack. Make sure to allocate a slot using size and alignment information on the parameter attribute.

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

16 years agofix a wordo that gordon noticed :)
Chris Lattner [Sat, 12 Jan 2008 00:53:16 +0000 (00:53 +0000)]
fix a wordo that gordon noticed :)

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

16 years agoAny x86 instruction that reads from an invariant location is invariant.
Chris Lattner [Sat, 12 Jan 2008 00:35:08 +0000 (00:35 +0000)]
Any x86 instruction that reads from an invariant location is invariant.
This allows us to sink things like:
cvtsi2sd 32(%esp), %xmm1
when reading from the argument area, for example.

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

16 years agoimplement support for sinking a load out the bottom of a block that
Chris Lattner [Sat, 12 Jan 2008 00:17:41 +0000 (00:17 +0000)]
implement support for sinking a load out the bottom of a block that
has no stores between the load and the end of block.  This works
great and sinks hundreds of stores, but we can't turn it on because
machineinstrs don't have volatility information and we don't want to
sink volatile stores :(

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

16 years agoremove some incorrect classof's.
Chris Lattner [Fri, 11 Jan 2008 23:25:16 +0000 (23:25 +0000)]
remove some incorrect classof's.

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

16 years agoWhen DAE drops the varargs part of a function, ensure any
Duncan Sands [Fri, 11 Jan 2008 23:13:45 +0000 (23:13 +0000)]
When DAE drops the varargs part of a function, ensure any
attributes on the vararg call arguments are also dropped.

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

16 years agoMore cbe byval fixes.
Evan Cheng [Fri, 11 Jan 2008 23:10:11 +0000 (23:10 +0000)]
More cbe byval fixes.

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

16 years agollvm-g++ 4.0 has completely different code for this warning,
Chris Lattner [Fri, 11 Jan 2008 23:06:56 +0000 (23:06 +0000)]
llvm-g++ 4.0 has completely different code for this warning,
just xfail it.

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

16 years agonew testcase
Chris Lattner [Fri, 11 Jan 2008 23:04:14 +0000 (23:04 +0000)]
new testcase

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

16 years agoDo not allow attributes beyond a function's last
Duncan Sands [Fri, 11 Jan 2008 22:36:48 +0000 (22:36 +0000)]
Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.

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

16 years agoTeach argpromote to ruthlessly hack small byval structs when it can
Chris Lattner [Fri, 11 Jan 2008 22:31:41 +0000 (22:31 +0000)]
Teach argpromote to ruthlessly hack small byval structs when it can
get away with it, which exposes opportunities to eliminate the memory
objects entirely.  For example, we now compile byval.ll to:

define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
%tmp2 = add i32 %b.0, 1 ; <i32> [#uses=0]
ret void
}

define i32 @main() nounwind  {
entry:
call void @f1( i32 1, i64 2 )
ret i32 0
}

This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...

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

16 years agoTwo occurrences on one line count as one...
Duncan Sands [Fri, 11 Jan 2008 21:46:24 +0000 (21:46 +0000)]
Two occurrences on one line count as one...

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