Commit Graph

28850 Commits

Author SHA1 Message Date
Dan Gohman
f57478f381 Use Type::isIntOrIntVector and Type::isFPOrFPVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:25:12 +00:00
Dan Gohman
6de29f8d96 Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:12:54 +00:00
Dan Gohman
24b108bc8c Fix a typo in a diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:52:11 +00:00
Anton Korobeynikov
bb62962342 Rename methods for the sake of consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:46:20 +00:00
Devang Patel
11a407f43f Gracefully handle imbalanced inline function begin and end markers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:45:50 +00:00
Evan Cheng
2077e18caf ifcvt should ignore cfg where true and false successors are the same.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:24:34 +00:00
Evan Cheng
675860758e Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73422 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:18:20 +00:00
Bill Wendling
927788c500 The Ls and Qs were mixed up. Patch by Sean.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73417 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 20:59:31 +00:00
Dale Johannesen
c1f104054d Fix the crash in this test. This is basically the same
problem addressed in 31284, but the patch there only
addressed the case where an invoke is the first thing in
a block.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 20:59:27 +00:00
Evan Cheng
d780f35794 Do not form ldrd / strd if the two dests / srcs are the same. Code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 20:54:56 +00:00
Owen Anderson
636768458f Merge PartialInliner changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73412 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 20:50:26 +00:00
Bill Wendling
453eb26106 "The Intel instruction tables should include the 64-bit and 32-bit instructions
that push immediate operands of 1, 2, and 4 bytes (extended to the native
register size in each case).  The assembly mnemonics are "pushl" and "pushq."
One such instruction appears at the beginning of the "start" function , so this
is essential for accurate disassembly when unwinding."

Patch by Sean Callanan!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 19:39:04 +00:00
Evan Cheng
7f04428738 Silence a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 19:36:32 +00:00
Dan Gohman
743e41eae1 Code cleanups. getSCEVAtScope no longer uses SCEVCouldNotCompute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73401 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 18:38:59 +00:00
Dan Gohman
c915c95978 Make the EnableLoadPRE variable static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 18:30:15 +00:00
Dan Gohman
070c42f311 glibc has two versions of strerror_r, a standards compliant one and a GNU
specific one. The GNU one is chosen when _GNU_SOURCE is defined. g++ always
defines _GNU_SOURCE on linux platforms because glibc's headers won't compile
in C++ mode without it. The GNU strerror_r doesn't always modify the buffer
which causes empty error messages on linux.

This patch changes MakeErrMsg to use the return value of strerror_r to get
the string instead of assuming the buffer will be modified, on GLIBC.

Patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 18:05:46 +00:00
Arnold Schwaighofer
5d2c01e48a CheckTailCallReturnConstraints is missing a check on the
incomming chain of the RETURN node. The incomming chain must
be the outgoing chain of the CALL node. This causes the
backend to identify tail calls that are not tail calls. This
patch fixes this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73387 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 14:43:36 +00:00
Evan Cheng
358dec5180 Part 1.
- Change register allocation hint to a pair of unsigned integers. The hint type is zero (which means prefer the register specified as second part of the pair) or entirely target dependent.
- Allow targets to specify alternative register allocation orders based on allocation hint.

Part 2.
- Use the register allocation hint system to implement more aggressive load / store multiple formation.
- Aggressively form LDRD / STRD. These are formed *before* register allocation. It has to be done this way to shorten live interval of base and offset registers. e.g.
v1025 = LDR v1024, 0
v1026 = LDR v1024, 0
=>
v1025,v1026 = LDRD v1024, 0

If this transformation isn't done before allocation, v1024 will overlap v1025 which means it more difficult to allocate a register pair.

- Even with the register allocation hint, it may not be possible to get the desired allocation. In that case, the post-allocation load / store multiple pass must fix the ldrd / strd instructions. They can either become ldm / stm instructions or back to a pair of ldr / str instructions.

This is work in progress, not yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73381 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 08:28:29 +00:00
Chris Lattner
c5718d073c "This patch implements the method with the GetModuleFileName function for windows."
Patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 05:38:04 +00:00
Chris Lattner
3771071dd8 remove extraneous const qualifier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:42:32 +00:00
Chris Lattner
2e06dd2101 I got J and K backward, many thanks to Eli for spotting this!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:39:05 +00:00
Chris Lattner
88d7e403d0 add a new static method to portably determine whether a patch is
absolute or not, based on a patch by Gregory Curfman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:17:07 +00:00
Chris Lattner
e4935150c7 implement support for the 'K' asm constraint, PR4347
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:01:39 +00:00
Dan Gohman
a119de86a0 Fix old-style type names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 23:30:43 +00:00
Dan Gohman
bd59d7b603 Implement more aggressive folding of add operand lists when
they contain multiplications of constants with add operations.
This helps simplify several kinds of things; in particular it
helps simplify expressions like ((-1 * (%a + %b)) + %a) to %b,
as expressions like this often come up in loop trip count
computations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73361 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:58:51 +00:00
Dan Gohman
7f7c4366ca Check for the short-circuiting condition before performing
the potentially expensive erase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:53:57 +00:00
Dan Gohman
4dfad29547 Do compare constant SCEV values in SCEVComplexityCompare, because
even though the order doesn't matter at the top level of an expression,
it does matter when the constant is a subexpression of an n-ary
expression, because n-ary expressions are sorted lexicographically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:51:25 +00:00
Dan Gohman
a82752c9eb Convert several parts of the ScalarEvolution framework to use
SmallVector instead of std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:47:23 +00:00
Dan Gohman
ea73f3c2e1 Add another item to the list of things that indvars does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:38:41 +00:00
Evan Cheng
90f95f88c6 Move register allocation preference (or hint) from LiveInterval to MachineRegisterInfo. This allows more passes to set them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 20:22:55 +00:00
Torok Edwin
caf6b2bbaf Fix CMake build. Patch from Ingmar Vanhassel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 13:39:56 +00:00
Owen Anderson
ca399021d4 Add an early implementation of a partial inlining pass. The idea behind this
is that, for functions whose bodies are entirely guarded by an if-statement, it
can be profitable to pull the test out of the callee and into the caller.

This code has had some cursory testing, but still has a number of known issues
on the LLVM test suite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 08:26:32 +00:00
Bruno Cardoso Lopes
ae9163f0e2 Introduce new BinaryObject (blob) class, ELF Writer modified to use it. BinaryObject.h by Aaron Gray
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 07:53:21 +00:00
Nick Lewycky
a142c9302b Unlike the other instructions, GEP really does need to look at the type of a
pointer. This fixes kimwitu++. Pointed out by Frits van Bommel on review!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 19:09:52 +00:00
Sanjiv Gupta
dcb6da3efd The subprogram descriptor for a function may be missing (llvm-ld linking two static functions with same name), so pick up the compilation unit for the function from the first valid debug loc of its instructions.
This patch also emits debug info for structure (aggregate types in 
general) types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73295 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 17:35:54 +00:00
Dan Gohman
4d8414f420 Teach SCEVExpander's visitAddRecExpr to reuse an existing canonical
induction variable when the addrec to be expanded does not require
a wider type. This eliminates the need for IndVarSimplify to
micro-manage SCEV expansions, because SCEVExpander now
automatically expands them in the form that IndVarSimplify considers
to be canonical. (LSR still micro-manages its SCEV expansions,
because it's optimizing for the target, rather than for
other optimizations.)

Also, this uses the new getAnyExtendExpr, which has more clever
expression simplification logic than the IndVarSimplify code it
replaces, and this cleans up some ugly expansions in code such as
the included masked-iv.ll testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 16:25:49 +00:00
Dan Gohman
2ce84c8d47 Add a ScalarEvolution::getAnyExtendExpr utility function for performing
extension with unspecified bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 15:56:47 +00:00
Evan Cheng
e7d6df7353 Add a ARM specific pre-allocation pass that re-schedule loads / stores from
consecutive addresses togther. This makes it easier for the post-allocation pass
to form ldm / stm.

This is step 1. We are still missing a lot of ldm / stm opportunities because
of register allocation are not done in the desired order. More enhancements
coming.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73291 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 09:12:55 +00:00
Devang Patel
daf9e02893 llvm.dbg.region.end() intrinsic is not required to be in _last_ basic block in a function. If that happens then any basic block that follows (lexically) the block with regin.end will not have scope info available. LexicalScopeStack relies on processing basic block in CFG order, but this processing order is not guaranteed. Things get complicated when the optimizer gets a chance to optimizer IR with dbg intrinsics.
Apply defensive patch to preserve at least one lexical scope till the end of function.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 02:16:18 +00:00
Owen Anderson
a21f31bca5 Improve style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 22:07:19 +00:00
Owen Anderson
5b6139a4d1 This is supposed to be a preorder numbering of the dominator tree, not the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 21:50:22 +00:00
Owen Anderson
fdf72c6607 Now with less iterator invalidation, and other forms of crashing!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 21:41:29 +00:00
Evan Cheng
4a274e573d If killed register is defined by implicit_def, do not clear it since it's live range may overlap another def of same register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 21:34:26 +00:00
Chris Lattner
69074a51f9 second half of fix for PR4366: don't zap store to null of
non-default addrspaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 21:01:07 +00:00
Evan Cheng
cd799b99cb Mark some pattern-less instructions as neverHasSideEffects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 20:46:18 +00:00
Devang Patel
9217f793bf Clear AbstractInstanceRootMap at the end of the function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 19:24:05 +00:00
Dan Gohman
e54aba5fa9 Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, because
it may round differently. This fixes PR4374.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 19:23:25 +00:00
Dan Gohman
194ae785e1 Give Instruction::isSameOperationAs a corresponding comment to note
the relationship with MergeFunctions.cpp's isEquivalentOperation,
and make a trivial code reordering so that the two functions are
easier to compare.

Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's
isEquivalentOperation's comment, and fix a nearby 80-column violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 19:03:05 +00:00
Nick Lewycky
93531e4986 Keep callers of a weak function calling it, instead of the non-weak equivalent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 17:16:48 +00:00
Arnold Schwaighofer
bbd8c33ee6 Fix Bug 4278: X86-64 with -tailcallopt calling convention
out of sync with regular cc.

The only difference between the tail call cc and the normal
cc was that one parameter register - R9 - was reserved for
calling functions through a function pointer. After time the
tail call cc has gotten out of sync with the regular cc. 

We can use R11 which is also caller saved but not used as
parameter register for potential function pointers and
remove the special tail call cc on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 16:26:57 +00:00