Dan Gohman
70b9b2f77f
Don't mark scalar integer multiplication as Expand on x86, since x86
...
has plain one-result scalar integer multiplication instructions.
This avoids expanding such instructions into MUL_LOHI sequences that
must be special-cased at isel time, and avoids the problem with that
code that provented memory operands from being folded.
This fixes PR1874, addressesing the most common case. The uncommon
cases of optimizing multiply-high operations will require work
in DAGCombiner.
llvm-svn: 47277
2008-02-18 17:55:26 +00:00
Chris Lattner
a378b03483
Transforming -A + -B --> -(A + B) isn't safe for FP, thanks
...
to Dale for noticing this!
llvm-svn: 47276
2008-02-18 17:50:16 +00:00
Chris Lattner
a3318d17d4
minor code simplification, no functionality change.
...
llvm-svn: 47275
2008-02-18 17:47:29 +00:00
Duncan Sands
a85448506d
Simplify caller updating using a CallSite, as
...
requested by Chris. While there, do the same
for an existing function committed by someone
called "lattner" :)
llvm-svn: 47273
2008-02-18 17:32:13 +00:00
Chris Lattner
57eff5b5f5
don't bother calling getUnderlyingObject for non-pointers.
...
llvm-svn: 47272
2008-02-18 17:28:21 +00:00
Owen Anderson
f3107c8546
Since we're not checking for the more general AllocationInst first, we need to explicitly check
...
that Object is an Argument before casting it to one.
llvm-svn: 47268
2008-02-18 10:11:00 +00:00
Roman Levenstein
a7d4ae1435
New helper function getMBBFromIndex() that given an index in any instruction of an MBB returns a pointer the MBB. Reviewed by Evan.
...
llvm-svn: 47267
2008-02-18 09:35:30 +00:00
Owen Anderson
7b092ea631
Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls
...
another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct
return value. llvm-gcc does not emit this by default. Instead, it allocates space in the caller for the sret of
the tail call and then uses memcpy to copy the result into the caller's sret parameter. This optimization detects
and optimizes that case.
llvm-svn: 47265
2008-02-18 09:24:53 +00:00
Owen Anderson
e4e1706f95
I got the predicate backwards in my last patch. The comment is correct, the code was not.
...
llvm-svn: 47264
2008-02-18 09:22:21 +00:00
Owen Anderson
1b743c32fd
This check is not correct for mallocs, so exclude them earlier.
...
llvm-svn: 47263
2008-02-18 09:11:02 +00:00
Evan Cheng
6eeae5bd62
For now, avoid commuting def MI for copy MI's whose source is not killed. That simply trade a live interval for another and because only the non-two-address operands can be folded into loads, may end up pessimising code.
...
llvm-svn: 47262
2008-02-18 08:40:53 +00:00
Chris Lattner
b22dbdf4fc
switch simplifycfg from using vectors for most things to smallvectors,
...
this speeds it up 2.3% on eon.
llvm-svn: 47261
2008-02-18 07:42:56 +00:00
Chris Lattner
9851db050b
optimize away stackrestore calls that have no intervening alloca or call.
...
llvm-svn: 47258
2008-02-18 06:12:38 +00:00
Owen Anderson
18a7d290cb
Duncan pointed out that we can fast fail here, because the sret parameter of
...
a function must be the first parameter.
llvm-svn: 47254
2008-02-18 04:06:26 +00:00
Owen Anderson
b0891af18b
Fix a comment, and a bug where we weren't applying the tail call logic in cases that failed the first test.
...
llvm-svn: 47253
2008-02-18 03:52:21 +00:00
Owen Anderson
0ef73a5d06
Fix bugs that Chris noticed in my last patch.
...
llvm-svn: 47252
2008-02-18 02:31:23 +00:00
Chris Lattner
0b6ec4a6b2
simplify some code, BreakUpSubtract always returns nonnull now.
...
llvm-svn: 47251
2008-02-18 02:18:25 +00:00
Chris Lattner
d5885d43ef
bitcasts of pointers are always pointers.
...
If we see a memcpy of a pointer, make sure to check later
uses of the pointer as well.
llvm-svn: 47250
2008-02-18 02:11:28 +00:00
Owen Anderson
48dd6a0f96
Add a predicate to Argument to check for the StructRet attribute.
...
llvm-svn: 47248
2008-02-17 23:22:28 +00:00
Owen Anderson
884f6801df
Teach getModRefInfo that memcpy, memmove, and memset don't "capture" memory addresses.
...
Also, noalias arguments are be considered "like" stack allocated ones for this purpose, because
the only way they can be modref'ed is if they escape somewhere in the current function.
llvm-svn: 47247
2008-02-17 21:29:08 +00:00
Chris Lattner
2fa904b3af
Fold (-x + -y) -> -(x+y) which promotes better association, fixing
...
the second half of PR2047
llvm-svn: 47244
2008-02-17 21:03:36 +00:00
Chris Lattner
51a663a8fe
fix pasto
...
llvm-svn: 47242
2008-02-17 20:54:40 +00:00
Chris Lattner
4a34461d64
Split up subtracts into add+negate if they have a reassociable use or operand
...
that is also a subtract. This implements PR2047 and Transforms/Reassociate/subtest2.ll
llvm-svn: 47241
2008-02-17 20:51:26 +00:00
Chris Lattner
cd6f9cea98
make the logic for breaking up subtracts more explicit, no
...
functionality change.
llvm-svn: 47239
2008-02-17 20:44:51 +00:00
Chris Lattner
3e886fa85a
move PR2053 to here.
...
llvm-svn: 47237
2008-02-17 19:43:57 +00:00
Duncan Sands
cd0325cce1
Remove any 'nest' parameter attributes if the function
...
is not passed as an argument to a trampoline intrinsic.
llvm-svn: 47220
2008-02-16 20:56:04 +00:00
Duncan Sands
753597d1cf
Some micro-optimizations.
...
llvm-svn: 47219
2008-02-16 20:53:06 +00:00
Andrew Lenharth
da54523742
I cannot find a libgcc function for this builtin. Therefor expanding it to a noop (which is how it use to be treated). If someone who knows the x86 backend better than me could tell me how to get a lock prefix on an instruction, that would be nice to complete x86 support.
...
llvm-svn: 47213
2008-02-16 14:46:26 +00:00
Duncan Sands
22ebf8b70f
Teach LegalizeTypes how to expand the operands of
...
br_cc. This fixes 5 "make check" failures.
llvm-svn: 47212
2008-02-16 10:29:26 +00:00
Evan Cheng
dd13a96a60
Refactor some code; check if commuteInstruction is able to commute the instruction.
...
llvm-svn: 47208
2008-02-16 02:32:17 +00:00
Andrew Lenharth
c178981b85
llvm.memory.barrier, and impl for x86 and alpha
...
llvm-svn: 47204
2008-02-16 01:24:58 +00:00
Bill Wendling
34dd48a10c
Fix typos.
...
llvm-svn: 47200
2008-02-16 01:09:25 +00:00
Dan Gohman
a9386d8501
Rename CountMemOperands to ComputeMemOperandsEnd to reflect what
...
it actually does. Simplify CountOperands a little by reusing
ComputeMemOperandsEnd. And reword some comments for both.
llvm-svn: 47198
2008-02-16 00:36:48 +00:00
Dan Gohman
9ce252af04
Revert 47177, which was incorrect.
...
llvm-svn: 47196
2008-02-16 00:25:40 +00:00
Scott Michel
3ad0263173
Make tblgen a little smarter about constants smaller than i32. Currently,
...
tblgen will complain if a sign-extended constant does not fit into a
data type smaller than i32, e.g., i16. This causes a problem when certain
hex constants are used, such as 0xff for byte masks or immediate xor
values.
tblgen will try the sign-extended value first and, if the sign extended
value would overflow, it tries to see if the unsigned value will fit.
Consequently, a software developer can now safely incant:
(XORHIr16 R16C:$rA, 0xffff)
which is somewhat clearer and more informative than incanting:
(XORHIr16 R16C:$rA, (i16 -1))
even if the two are bitwise equivalent.
Tblgen also outputs the 64-bit unsigned constant in the generated ISel code
when getTargetConstant() is invoked.
llvm-svn: 47188
2008-02-15 23:05:48 +00:00
Evan Cheng
09fee0e727
The copy instruction being coalesced will be removed, it is not a kill.
...
llvm-svn: 47179
2008-02-15 21:36:51 +00:00
Ted Kremenek
83e9c3ba5c
Fixed bug in FoldingSetIteratorImpl where we did not correctly check if
...
we had reached the "fake bucket" after the last bucket, allowing the iterator
in some cases to run off the end of the hashtable.
llvm-svn: 47178
2008-02-15 21:12:46 +00:00
Dan Gohman
547cd33955
Skip over the defs and start at the uses when looking for operands
...
with the TIED_TO attribute.
llvm-svn: 47177
2008-02-15 20:59:17 +00:00
Dan Gohman
06ac7aca3e
Use the TargetInstrDescr to determine the number of operands
...
that should be checked for the TIED_TO attribute instead of
using CountOperands.
llvm-svn: 47176
2008-02-15 20:50:13 +00:00
Duncan Sands
bf7d428157
Teach LegalizeTypes how to promote the flags
...
in a ret node. These are created as i32 constants
but on some platforms i32 is not legal. This
fixes 26 "make check" failures, for example
Alpha/2005-07-12-TwoMallocCalls.ll.
llvm-svn: 47172
2008-02-15 19:34:17 +00:00
Chris Lattner
d55c26a77d
Handle \n's in value names for more targets. The asm printers
...
really really really need refactoring :(
llvm-svn: 47171
2008-02-15 19:04:54 +00:00
Chris Lattner
cf98f7291b
If the llvm name contains an unprintable character, don't print it in
...
the global comment. This prevents printing things like:
... # foo
bar
when the name is "foo\nbar".
llvm-svn: 47170
2008-02-15 18:56:05 +00:00
Chris Lattner
bab03a1b50
targets that support quotes for mangled names still need to escape newlines
...
when they occur in the name, just like " is escaped.
llvm-svn: 47169
2008-02-15 18:54:56 +00:00
Dale Johannesen
b9e1a37497
Cosmetics.
...
llvm-svn: 47168
2008-02-15 18:40:53 +00:00
Evan Cheng
bb357cd8a6
- Removing the infamous r2rMap_ and rep() method. Now the coalescer will update
...
register defs and uses after each successful coalescing.
- Also removed a number of hacks and fixed some subtle kill information bugs.
llvm-svn: 47167
2008-02-15 18:24:29 +00:00
Evan Cheng
2cb3fd8f72
Added CommuteChangesDestination(). This returns true if commuting the specified
...
machine instr will change its definition register.
llvm-svn: 47166
2008-02-15 18:21:33 +00:00
Evan Cheng
fff5254adf
Remove unnecessary #include.
...
llvm-svn: 47164
2008-02-15 18:12:09 +00:00
Dan Gohman
8ff2d5e0e3
Use StoreSDNode::getValue instead of calling getOperand directly
...
with a hard-coded operand number.
llvm-svn: 47163
2008-02-15 18:11:59 +00:00
Dale Johannesen
de53aaec39
Remove warning about 64-bit code on processor
...
that doesn't support it. Per Chris.
llvm-svn: 47162
2008-02-15 18:09:51 +00:00
Lauro Ramos Venancio
4fcf9513f1
It is not safe to call fork in PrintStackTrace. Sometimes it freezes the program.
...
llvm-svn: 47161
2008-02-15 18:05:54 +00:00