Commit Graph

4524 Commits

Author SHA1 Message Date
Pedro Artigas
6eda081345 One more step towards making doInitialization and doFinalization useful for
start up and clean up module passes, now that ASAN and TSAN are fixed the
tests pass



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168905 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 17:47:05 +00:00
Shuxin Yang
9b7f6f2de8 Instruction::isAssociative() returns true for fmul/fadd if they are tagged "unsafe" mode.
Approved by: Eli and Michael.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168848 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 01:47:31 +00:00
Patrik Hägglund
dacb9a51bd Fix warning. [-Wunused-variable]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168792 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 14:32:52 +00:00
Patrik Hägglund
37d5be777c Add error handling in getInt.
Accordingly, update a testcase with a broken datalayout string.

Also, we never parse negative numbers, because '-' is used as a
separator. Therefore, use unsigned as result type.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168785 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 12:13:12 +00:00
Bill Wendling
efd08d413c Remove the dependent libraries feature.
The dependent libraries feature was never used and has bit-rotted. Remove it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168694 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 09:55:56 +00:00
Owen Anderson
9780d352b9 Revert r168635 "Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model".
It appears to have broken at least one buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168654 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:53:24 +00:00
Michael Ilseman
15c13d3e63 Fast-math flags for LLVM IR parsing and printing
Added in the ability to read LLVM IR text that contains fast-math flags as a sequence of capital letters separated by spaces in any order. Added in the printing of the fast-math flags in a canonical order, and don't print the other flags when 'fast' is specified, as 'fast' implies all the others.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168645 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:42:44 +00:00
Michael Ilseman
125fc7fefd Fast-math interfaces for Instructions
Add in getter/setter methods for Instructions, allowing them to be the interface to FPMathOperator similarly to now NUS/NSW is handled.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168642 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:41:22 +00:00
Owen Anderson
0d30d30d58 Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model
Patch by Pedro Artigas, with feedback from by Chandler Carruth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168635 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 23:54:47 +00:00
Zhou Sheng
9853db7072 Fix a PassManager pointer use-after-free bug.
The bug can be triggered when we require LoopInfo analysis ahead of DominatorTree construction in a Module Pass. The cause is that the LoopInfo analysis itself also invokes DominatorTree construction, therefore, when PassManager schedules LoopInfo, it will add DominatorTree first. Then after that, when the PassManger turns to schedule DominatorTree invoked by the above ModulePass, it finds there is already a DominatorTree, so it delete the redundant one. However, somehow it still try to access that pass pointer after free as code pasted below, which results in segment fault.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168581 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 05:45:53 +00:00
Benjamin Kramer
a91eead943 Move semantics are great, don't destroy the optimization opportunity with trivial copy ctors.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168561 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-25 11:52:03 +00:00
Patrik Hägglund
834518f1ce Disallow the undocumented practice of starting the datalayout string with '-'.
Update some test cases accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168516 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23 14:51:42 +00:00
Bill Wendling
0976e00fd1 Make the AttrListPtr object a part of the LLVMContext.
When code deletes the context, the AttributeImpls that the AttrListPtr points to
are now invalid. Therefore, instead of keeping a separate managed static for the
AttrListPtrs that's reference counted, move it into the LLVMContext and delete
it when deleting the AttributeImpls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-20 05:09:20 +00:00
Eric Christopher
5f214ae179 80-column and whitespace fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168344 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-20 00:15:36 +00:00
Eric Christopher
c4639d6ec2 Remove a function argument and propagate const around accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168338 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 22:42:15 +00:00
NAKAMURA Takumi
1fcbb8fbf9 Promote the constant 1 to long long, 1LL or 1ULL in int64_t-sensitive context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168304 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 10:03:09 +00:00
James Molloy
b9478c2aef Add a new function to ConstantExpr - getAsInstruction. This returns its Instruction* corollary, which may be useful if a user
wishes to transform a ConstantExpr so that one of its operands is no longer constant.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168262 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 17:56:30 +00:00
Hans Wennborg
fbeb956876 Constant::IsThreadDependent(): Use dyn_cast<Constant> instead of cast
It turns out that the operands of a Constant are not always themselves
Constant. For example, one of the operands of BlockAddress is
BasicBlock, which is not a Constant.

This should fix the dragonegg-x86_64-linux-gcc-4.6-test build which
broke in r168037.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168147 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 10:33:25 +00:00
Michael Ilseman
407a6169b7 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168103 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 22:34:00 +00:00
Dmitri Gribenko
79c07d2a36 Use empty parens for empty function parameter list instead of '(void)'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168049 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 16:51:49 +00:00
Duncan Sands
b983f5d4ce Do not handle void types in DataLayout. Patch by Patrick Hägglund.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168042 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 14:45:30 +00:00
Hans Wennborg
1839858983 Make GlobalOpt be conservative with TLS variables (PR14309)
For global variables that get the same value stored into them
everywhere, GlobalOpt will replace them with a constant. The problem is
that a thread-local GlobalVariable looks like one value (the address of
the TLS var), but is different between threads.

This patch introduces Constant::isThreadDependent() which returns true
for thread-local variables and constants which depend on them (e.g. a GEP
into a thread-local array), and teaches GlobalOpt not to track such
values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168037 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 11:40:00 +00:00
Owen Anderson
40b6fdb81e Add doInitialization and doFinalization methods to ModulePass's, to allow them to be re-initialized and reused on multiple Module's.
Patch by Pedro Artigas.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168008 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 00:14:15 +00:00
Patrik Hägglund
1e65676a12 Revert some redundant parts of r142605.
This seems like redundant leftovers from r142288 - exposing
TargetData::parseSpecifier to LLParser - which got reverted. Removes
redunant td != NULL checks in parseSpecifier, and simplifies the
interface to parseSpecifier and init.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167924 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 09:04:56 +00:00
Eric Christopher
242343d1ab Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."
temporarily as it is breaking the gdb bots.

This reverts commit r167806/e7ff4c14b157746b3e0228d2dce9f70712d1c126.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 23:30:43 +00:00
Duncan Sands
2333e29be4 Relax the restrictions on vector of pointer types, and vector getelementptr.
Previously in a vector of pointers, the pointer couldn't be any pointer type,
it had to be a pointer to an integer or floating point type.  This is a hassle
for dragonegg because the GCC vectorizer happily produces vectors of pointers
where the pointer is a pointer to a struct or whatever.  Vector getelementptr
was restricted to just one index, but now that vectors of pointers can have
any pointer type it is more natural to allow arbitrary vector getelementptrs.
There is however the issue of struct GEPs, where if each lane chose different
struct fields then from that point on each lane will be working down into
unrelated types.  This seems like too much pain for too little gain, so when
you have a vector struct index all the elements are required to be the same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167828 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 12:59:33 +00:00
Evan Cheng
310fa65ab9 Revert r167759. Ben is right this isn't likely to help much.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167809 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 02:56:38 +00:00
Bill Wendling
e7ff4c14b1 Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167806 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 02:31:47 +00:00
Evan Cheng
0655668b11 Cache size of PassVector to speed up getNumContainedPasses().
getNumContainedPasses() used to compute the size of the vector on demand. It is
called repeated in loops (such as runOnFunction()) and it can be updated while
inside the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167759 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 21:42:53 +00:00
David Blaikie
78c796e203 Include all the fields so we can correctly emit DW_TAG_structure_type for C++ structs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167334 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 23:33:23 +00:00
Duncan Sands
9825d1edf0 Enable the assertion in getIntPtrType (I've audited all users of this method and
they are now all correct; hopefully the buildbots will agree!).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 09:02:37 +00:00
Chandler Carruth
1521406a4b Remove a weird static helper from the GEP instruction and just directly
compute the address space in the one place it was used.

Also write the getPointerAddressSpace member in terms of the
getPointerOperandType member.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167226 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-01 10:59:30 +00:00
Chandler Carruth
8fb614cb3b Teach Type::getPointerAddressSpace to look through pointer vectors
politely and document this feature.

This simple API extension then allows us to write all of the
Instructions' address space query methods much more simply. No
functionality change intended here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167223 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-01 09:37:49 +00:00
Chandler Carruth
ece6c6bb63 Revert the series of commits starting with r166578 which introduced the
getIntPtrType support for multiple address spaces via a pointer type,
and also introduced a crasher bug in the constant folder reported in
PR14233.

These commits also contained several problems that should really be
addressed before they are re-committed. I have avoided reverting various
cleanups to the DataLayout APIs that are reasonable to have moving
forward in order to reduce the amount of churn, and minimize the number
of commits that were reverted. I've also manually updated merge
conflicts and manually arranged for the getIntPtrType function to stay
in DataLayout and to be defined in a plausible way after this revert.

Thanks to Duncan for working through this exact strategy with me, and
Nick Lewycky for tracking down the really annoying crasher this
triggered. (Test case to follow in its own commit.)

After discussing with Duncan extensively, and based on a note from
Micah, I'm going to continue to back out some more of the more
problematic patches in this series in order to ensure we go into the
LLVM 3.2 branch with a reasonable story here. I'll send a note to
llvmdev explaining what's going on and why.

Summary of reverted revisions:

r166634: Fix a compiler warning with an unused variable.
r166607: Add some cleanup to the DataLayout changes requested by
         Chandler.
r166596: Revert "Back out r166591, not sure why this made it through
         since I cancelled the command. Bleh, sorry about this!
r166591: Delete a directory that wasn't supposed to be checked in yet.
r166578: Add in support for getIntPtrType to get the pointer type based
         on the address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-01 08:07:29 +00:00
Quentin Colombet
9a419f656e Change ForceSizeOpt attribute into MinSize attribute
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167020 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 16:32:52 +00:00
Duncan Sands
446cf94cdb Fix isEliminableCastPair to work correctly in the presence of pointers
with different sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167018 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 16:03:32 +00:00
Duncan Sands
7adfe3fd60 Add a helper for telling whether a type is a pointer or vector of pointer type.
Simplify the implementation of the corresponding integer and float functions and
move them inline while there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167014 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 13:38:54 +00:00
Ulrich Weigand
3467b9fd5d Enable some additional constant folding for PPCDoubleDouble.
This fixes Clang :: CodeGen/complex-builtints.c on PowerPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167013 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 12:33:18 +00:00
Duncan Sands
7ed4f94c13 Remove a wrapper around getIntPtrType added to GVN by Hal in commit 166624 (the
wrapper returns a vector of integers when passed a vector of pointers) by having
getIntPtrType itself return a vector of integers in this case.  Outside of this
wrapper, I didn't find anywhere in the codebase that was relying on the old
behaviour for vectors of pointers, so give this a whirl through the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166939 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-29 17:31:46 +00:00
Duncan Sands
edece78550 Factorize code: rather than duplication the logic in getPointerTypeSizeInBits,
just call getPointerTypeSizeInBits.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166926 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-29 14:30:05 +00:00
Benjamin Kramer
276c43f022 Lowercase the argument for TargetTransformInfo so it's consistent with all other passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166794 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-26 18:46:15 +00:00
Joerg Sonnenberger
475832cc0f Don't explicitly require RTTI and EH.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166772 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-26 12:15:29 +00:00
Micah Villmow
b52fb87617 Add some cleanup to the DataLayout changes requested by Chandler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 18:36:13 +00:00
Micah Villmow
b8bce928f4 Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166596 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 17:25:11 +00:00
Micah Villmow
2f87640b86 Delete a directory that wasn't supposed to be checked in yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166591 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 17:20:04 +00:00
Micah Villmow
aa76e9e2cf Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the
clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 15:52:52 +00:00
Elena Demikhovsky
3575222175 Special calling conventions for Intel OpenCL built-in library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 14:46:16 +00:00
Richard Smith
30f57da439 Fix ODR violations: a virtual function must be defined, even if it's never
called. Provide an (asserting) definition of Operator's private destructor.
Remove destructors from all classes derived from Operator. We don't need them
for safety, because their implicit definitions would be ill-formed (they'd call
Operator's private destructor), and we don't need them to avoid emitting
vtables, because we don't do anything with Operator subclasses which would
trigger vtable instantiation.

The Operator hierarchy is still a complete disaster with regard to undefined
behavior, but this at least allows LLVM to link when using Clang's
-fcatch-undefined-behavior with a new vptr-based type checking mechanism.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166530 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 00:30:41 +00:00
Nadav Rotem
c97410eed2 Add a comment which explains why the assert fired and how to fix it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166467 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-23 04:35:40 +00:00
Nadav Rotem
e743942bc8 Add the "ForceSizeOpt" attribute.
Patch by Quentin Colombet <qcolombet@apple.com>

Original description:
"""
The attached patch is the first step to have a better control on Oz related optimizations.
The Oz optimization level focuses on code size, thus I propose to add an attribute called ForceSizeOpt.
"""



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 17:33:31 +00:00