1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

2705 Commits

Author SHA1 Message Date
Chris Lattner
665b9e2a3c Random updates to passes for indbr, I need blockaddress before I can do much more.
llvm-svn: 85316
2009-10-27 21:27:42 +00:00
Victor Hernandez
0f662a7acf Rename MallocFreeHelper as MemoryBuiltins
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
6c86b93663 Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
673c036bc7 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Dan Gohman
c8468855a7 Teach BasicAA how to analyze Select instructions, and make it more
aggressive on PHI instructions.

llvm-svn: 85158
2009-10-26 21:55:43 +00:00
Devang Patel
9eb437047b Add support to encode type info using llvm::Constant.
Patch by Talin!

llvm-svn: 85126
2009-10-26 16:54:35 +00:00
Nick Lewycky
2b8400628d Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky
711c726c97 Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Chris Lattner
d8db8b6952 Teach FoldBitCast to be able to handle bitcasts from (e.g.) i128 -> <4 x float>.
This allows us to simplify this:
union vec2d {
    double e[2];
    double v __attribute__((vector_size(16)));
};
typedef union vec2d vec2d;

static vec2d a={{1,2}}, b={{3,4}};
    
vec2d foo () {
    return (vec2d){ .v = a.v + b.v * (vec2d){{5,5}}.v };
}

down to:

define %0 @foo() nounwind ssp {
entry:
  %mrv5 = insertvalue %0 undef, double 1.600000e+01, 0 ; <%0> [#uses=1]
  %mrv6 = insertvalue %0 %mrv5, double 2.200000e+01, 1 ; <%0> [#uses=1]
  ret %0 %mrv6
}

instead of:

define %0 @foo() nounwind ssp {
entry:
  %mrv5 = insertvalue %0 undef, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 0), 0 ; <%0> [#uses=1]
  %mrv6 = insertvalue %0 %mrv5, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 1), 1 ; <%0> [#uses=1]
  ret %0 %mrv6
}

llvm-svn: 85040
2009-10-25 06:15:37 +00:00
Chris Lattner
d80c1f61d2 move FoldBitCast earlier in the file, and use it instead of
ConstantExpr::getBitCast in various places.

llvm-svn: 85039
2009-10-25 06:08:26 +00:00
Chris Lattner
f6cb8d6b90 refactor FoldBitCast to reduce nesting and to always return a constantexpr
instead of returning null on failure.  No functionality change.

llvm-svn: 85038
2009-10-25 06:02:57 +00:00
Chris Lattner
5f456758c6 various cleanups suggested by Duncan
llvm-svn: 84993
2009-10-24 05:27:19 +00:00
Chris Lattner
9a1f5c9f90 fix PR5287, a serious regression from my previous patches. Thanks to
Duncan for the nice tiny testcase.

llvm-svn: 84992
2009-10-24 05:22:15 +00:00
Victor Hernandez
e8998896f5 Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Victor Hernandez
8428eb5720 Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Chris Lattner
4874f5bce5 teach libanalysis to simplify vector loads with bitcast sources. This
implements something out of Target/README.txt producing:

_foo:                                                       ## @foo
	movl	4(%esp), %eax
	movapd	LCPI1_0, %xmm0
	movapd	%xmm0, (%eax)
	ret	$4

instead of:

_foo:                                                       ## @foo
	movl	4(%esp), %eax
	movapd	_b, %xmm0
	mulpd	LCPI1_0, %xmm0
	addpd	_a, %xmm0
	movapd	%xmm0, (%eax)
	ret	$4

llvm-svn: 84942
2009-10-23 06:57:37 +00:00
Chris Lattner
2ee1f0f0b5 enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32
bytes (i256).

llvm-svn: 84941
2009-10-23 06:50:36 +00:00
Chris Lattner
b1d2706a4c teach libanalysis to fold int and fp loads from almost arbitrary
non-type-safe constant initializers.  This sort of thing happens
quite a bit for 4-byte loads out of string constants, unions, 
bitfields, and an interesting endianness check from sqlite, which
is something like this:

const int sqlite3one = 1;
# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)

all of these macros now constant fold away.

This implements PR3152 and is based on a patch started by Eli, but heavily
modified and extended.

llvm-svn: 84936
2009-10-23 06:23:49 +00:00
Chris Lattner
cd80b1711b move another load optimization from instcombine -> libanalysis.
llvm-svn: 84841
2009-10-22 06:44:07 +00:00
Chris Lattner
3fb4c19b7d move 'loading i32 from string' optimization from instcombine
to libanalysis.  Instcombine shrinking... does this even 
make sense???

llvm-svn: 84840
2009-10-22 06:38:35 +00:00
Chris Lattner
2c8c8533b1 Move some constant folding logic for loads out of instcombine into
Analysis/ConstantFolding.cpp.  This doesn't change the behavior of
instcombine but makes other clients of ConstantFoldInstruction
able to handle loads.  This was partially extracted from Eli's patch
in PR3152.

llvm-svn: 84836
2009-10-22 06:25:11 +00:00
Dan Gohman
bc58eb97fe Fix another place that calls Loop::contains a lot to construct a sorted
container of the blocks and do efficient lookups. This makes
isLoopSimplifyForm much faster on large loops, fixing a significant
compile-time issue in builds with assertions enabled.

llvm-svn: 84673
2009-10-20 20:41:13 +00:00
Chris Lattner
5b8e288c5f fix the other issue with ID's, hopefully really fixing the linux build.
llvm-svn: 84403
2009-10-18 04:58:34 +00:00
Chris Lattner
a1aaf47423 fix some problems with ID definitions, which will hopefully fix the build bots.
llvm-svn: 84399
2009-10-18 04:27:14 +00:00
Chris Lattner
8851d6cf9c add function passes for printing various dominator datastructures
accessible through opt.  Patch by Tobias Grosser!

llvm-svn: 84397
2009-10-18 04:10:40 +00:00
Chris Lattner
f202995415 make DOTGraphTraits public, patch by Tobias Grosser!
llvm-svn: 84396
2009-10-18 04:09:11 +00:00
Chris Lattner
a72ccc6fee inline isGEP away.
llvm-svn: 84373
2009-10-17 23:48:54 +00:00
Victor Hernandez
a25a2890fa Remove MallocInst from LLVM Instructions.
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Victor Hernandez
6d11519b1f Invert isSafeToGetMallocArraySize check because we return NULL when we don't know the size.
Thanks to Duncan Sands for noticing this bug.

llvm-svn: 84261
2009-10-16 18:08:17 +00:00
Evan Cheng
54b34ff68d When checking aliases between phi sources and V2, we know the sources are not themselves phi nodes. However, V2 may be. Call aliasCheck with V2 first to potentially eliminate a std::swap call.
llvm-svn: 84226
2009-10-16 00:33:09 +00:00
Victor Hernandez
603a11de4e Fix bug where array malloc with unexpected computation of the size argument resulted in MallocHelper
identifying the malloc as a non-array malloc.  This broke GlobalOpt's optimization of stores of mallocs 
to global variables.

The fix is to classify malloc's into 3 categories:
1. non-array mallocs
2. array mallocs whose array size can be determined
3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized

getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their 
malloc optimization if this function returns NULL.

Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in
isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples.

llvm-svn: 84199
2009-10-15 20:14:52 +00:00
Nick Lewycky
7ec7f1ce0f Add missing break statements! Thanks to Duncan Sands for pointing this out!
llvm-svn: 84191
2009-10-15 18:48:58 +00:00
Nick Lewycky
4ba7b77812 Teach basicaa about memcpy/memmove/memset. The length argument can be used to
improve alias results if constant, and the source pointer can't be modified.

llvm-svn: 84175
2009-10-15 07:11:24 +00:00
Nick Lewycky
14a06f7051 Teach BasicAA to use the size parameter of the memory use marker intrinsics.
llvm-svn: 84174
2009-10-15 06:12:11 +00:00
Nick Lewycky
a12f6e8f78 Take advantage of TargetData when available; we know that the atomic intrinsics
only dereference the element they point to directly with no pointer arithmetic.

llvm-svn: 84159
2009-10-15 00:36:35 +00:00
Evan Cheng
37a7a18748 Clear VisitedPHIs after use.
llvm-svn: 84080
2009-10-14 06:46:26 +00:00
Evan Cheng
907fd9c3fb Another BasicAA fix. If a value does not alias a GEP's base pointer, then it
cannot alias the GEP. GEP pointer alias rule states this clearly:
A pointer value formed from a getelementptr instruction is associated with the
addresses associated with the first operand of the getelementptr.

llvm-svn: 84079
2009-10-14 06:41:49 +00:00
Evan Cheng
c1056d9269 More code clean up based on patch feedback.
llvm-svn: 84074
2009-10-14 05:22:03 +00:00
Evan Cheng
efc0f806a4 Change VisitedPHIs into an instance variable that's freed by each alias() call.
llvm-svn: 84072
2009-10-14 05:05:02 +00:00
Evan Cheng
3130aba687 Teach basic AA about PHI nodes. If all operands of a phi NoAlias another value than it's safe to declare the PHI NoAlias the value. Ditto for MustAlias.
llvm-svn: 84038
2009-10-13 22:02:20 +00:00
Dan Gohman
c1e210fa10 Compute a full cost value even when a setjmp call is found.
llvm-svn: 84015
2009-10-13 20:10:10 +00:00
Dan Gohman
665e336185 Split code not specific to Function inlining out into a separate class,
named CodeMetrics. Move it to be a non-nested class. Rename RegionInfo
back to FunctionInfo.

llvm-svn: 84013
2009-10-13 19:58:07 +00:00
Benjamin Kramer
679377c816 Update the other CMake file.
llvm-svn: 84003
2009-10-13 18:50:54 +00:00
Evan Cheng
84c5224fa2 Refactor some code. No functionality changes.
llvm-svn: 84000
2009-10-13 18:42:04 +00:00
Dan Gohman
18cdd7ef1b Move the InlineCost code from Transforms/Utils to Analysis.
llvm-svn: 83998
2009-10-13 18:30:07 +00:00
Devang Patel
ee9d2f0cc0 "there is not any instruction with attached debug info in this module" does not mean "there is no debug info in this module". :)
llvm-svn: 83984
2009-10-13 17:35:35 +00:00
Nick Lewycky
72f185f281 Teach BasicAA a little something about the atomic intrinsics: they can only
modify through the pointer they're given.

llvm-svn: 83959
2009-10-13 07:48:38 +00:00
Victor Hernandez
21280bc3af Memory dependence analysis was incorrectly stopping to scan for stores to a pointer at bitcast uses of a malloc call.
It should continue scanning until the malloc call, and this patch fixes that.

llvm-svn: 83931
2009-10-13 01:42:53 +00:00
Dan Gohman
731afb3b6e Revert r83606 and add comments explaining why it isn't safe.
llvm-svn: 83649
2009-10-09 16:35:06 +00:00
Dan Gohman
e81a040ce7 Preserve HasNSW and HasNUW when constructing SCEVs for Add and Mul
instructions.

llvm-svn: 83606
2009-10-09 00:41:22 +00:00
Dan Gohman
4cdd530887 Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.
llvm-svn: 83601
2009-10-09 00:10:36 +00:00
Douglas Gregor
57f2c22857 Update CMake build yet again after a source file was removed
llvm-svn: 83575
2009-10-08 21:24:34 +00:00
Bill Wendling
d47d348cdf It's possible for a global variable to be optimized out of a metadata object. So
we should allow a "null" with this dyn_cast.

llvm-svn: 83573
2009-10-08 20:52:51 +00:00
Chris Lattner
41b5fd5218 remove LoopVR pass. According to Nick:
"LoopVR's logic was copied into ScalarEvolution::getUnsignedRange and 
::getSignedRange. Please delete LoopVR."

llvm-svn: 83531
2009-10-08 06:42:44 +00:00
Devang Patel
a7456a1335 Extract subprogram and compile unit information from the debug info attached to an instruction.
llvm-svn: 83491
2009-10-07 22:04:08 +00:00
Torok Edwin
6a66b4edd1 Add PR to this FIXME, looks like I didn't commit this change after all.
llvm-svn: 83457
2009-10-07 09:22:55 +00:00
Duncan Sands
2400ad7236 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.

llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Evan Phoenix
1b803795c7 Extend ConstantFolding to understand signed overflow variants
llvm-svn: 83338
2009-10-05 22:53:52 +00:00
Torok Edwin
1a53fd9356 Don't treat malloc calls with non-matching prototype as malloc.
Fixes second part of PR5130, miscompilation in FreeBSD kernel, where malloc takes 3 params,
and *does* initialize memory.

llvm-svn: 83324
2009-10-05 21:15:43 +00:00
Dan Gohman
176e47a413 Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.

llvm-svn: 83311
2009-10-05 16:36:26 +00:00
Chris Lattner
7d19c8841c teach the optimizer how to constant fold uadd/usub intrinsics.
llvm-svn: 83295
2009-10-05 05:26:04 +00:00
Chris Lattner
8b72a24a35 simplify this code a bunch.
llvm-svn: 83294
2009-10-05 05:06:24 +00:00
Chris Lattner
24a77e2ade code simplifications.
llvm-svn: 83292
2009-10-05 05:00:35 +00:00
Mike Stump
532ed49e39 Expand api out in the usual inserter way, though, I do have a
question, can we get rid of the BasicBlock versions of all inserters
and use Head == 0 to indicate the old case when GetInsertBlock == 0?

llvm-svn: 83216
2009-10-01 22:08:58 +00:00
Devang Patel
4f1147e386 Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions.
llvm-svn: 83190
2009-10-01 01:15:28 +00:00
Devang Patel
cb516787d0 Add isFOO() helpers. Fix getDirectory() and getFilename() for DIScope.
llvm-svn: 83180
2009-09-30 22:34:41 +00:00
Mike Stump
a3bce35a07 Add a way for a frontend to generate more complex dwarf location
information.  This allows arbitrary code involving DW_OP_plus_uconst
and DW_OP_deref.  The scheme allows for easy extention to include,
any, or all of the DW_OP_ opcodes.  I thought about just exposing all
of them, but, wasn't sure if people wanted the dwarf opcodes exposed
in the api.  Is that a layering violation?

With this scheme, the entire existing block scheme used by llvm-gcc
can be switched over to the new scheme.  I think that would be
cleaner, as then the compiler specific bits are not present in llvm
proper.  Before the old code can be yanked however, similar code in
clang would have to be removed.

Next up, more testing.

llvm-svn: 83120
2009-09-30 00:08:22 +00:00
Devang Patel
e5be8e79df Remove std::string uses from DebugInfo interface.
llvm-svn: 83083
2009-09-29 18:40:58 +00:00
Dan Gohman
c3081dd9eb When extending the operands of an addrec, iterate through all
the operands, rather than trying to partition them into a start
and a step. This handles non-affine add recurrences correctly.

llvm-svn: 83011
2009-09-28 21:01:47 +00:00
Dan Gohman
bfa2d75c49 Create a README.txt for lib/Analysis, and add an entry.
llvm-svn: 83001
2009-09-28 18:38:53 +00:00
Dan Gohman
7a5cb984e6 Fix this debug output to handle the case where the loop has been deleted.
llvm-svn: 82994
2009-09-28 15:40:01 +00:00
Dan Gohman
aade5fefdb Include the name of the loop header in debug messages.
llvm-svn: 82993
2009-09-28 15:07:18 +00:00
Dan Gohman
bd50ec69e4 Move the dominator verification code out of special code embedded within
the PassManager code into a regular verifyAnalysis method.

Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.

llvm-svn: 82952
2009-09-28 00:27:48 +00:00
Dan Gohman
195c5bdf41 Move this assert to check the condition as soon as it is known.
llvm-svn: 82951
2009-09-28 00:10:28 +00:00
Dan Gohman
09f5f7f190 Extend the StartPassTimer and StopPassTimer functions so that the
code that stops the timer doesn't have to search to find the timer
object before it stops the timer. This avoids a lock acquisition
and a few other things done with the timer running.

llvm-svn: 82949
2009-09-28 00:07:05 +00:00
Dan Gohman
000a17774e Fix an old copy+pasto.
llvm-svn: 82947
2009-09-27 23:52:07 +00:00
Dan Gohman
db89691ec4 Extract the code for inserting a loop into the loop queue into
a separate function.

llvm-svn: 82946
2009-09-27 23:49:43 +00:00
Dan Gohman
0ea6efde4e When a loop is deleted, immediately release all of the active
LoopPasses for that loop. This avoids trouble with the PassManager
trying to call verifyAnalysis on them, and frees up some memory
sooner rather than later.

llvm-svn: 82945
2009-09-27 23:43:07 +00:00
Dan Gohman
2d607af763 Delete a bogus comment.
llvm-svn: 82908
2009-09-27 17:50:44 +00:00
Dan Gohman
8b4c141d97 Fix SCEVExpander's canonical addrec expansion code to work on loops that
aren't in canonical loop-simplify form, since it doesn't itself depend
on LoopSimplify. This means handling loops without preheaders and loops
with multiple backedges.

llvm-svn: 82905
2009-09-27 17:46:40 +00:00
Dan Gohman
16398e3bc0 Instead of testing whether an instruction dominates the loop preheader,
test whether it properly dominates the loop header. This is equivalent
when the loop has a preheader, and has the advantage of working when
the loop doesn't have a preheader. Since IVUsers doesn't Require
LoopSimplify, the loop isn't guaranteed to have a preheader.

llvm-svn: 82899
2009-09-27 15:30:00 +00:00
Dan Gohman
b84f5a3421 Add a properlyDominates member function to ScalarEvolution.
llvm-svn: 82898
2009-09-27 15:26:03 +00:00
Dan Gohman
9cc0852f45 Remove a redundant #include.
llvm-svn: 82897
2009-09-27 15:21:52 +00:00
Dan Gohman
60964df13d Fix a case where ScalarEvolution was expanding pointer arithmetic
to inttoptr/ptrtoint unnecessarily.

llvm-svn: 82864
2009-09-26 16:11:57 +00:00
Dale Johannesen
53c365d807 Handle sqrt in CannotBeNegativeZero. absf and absl
appear to be misspellings, removed in favor of fabs*.

llvm-svn: 82796
2009-09-25 20:54:50 +00:00
Victor Hernandez
d2cc74eb2d No need to verify that malloc's return type is i8*.
llvm-svn: 82561
2009-09-22 18:50:03 +00:00
Daniel Dunbar
14c9a4d355 Switch DIDescriptor to use a TrackingVH. - This makes it much safer to work with debug info, since it was extraordinarily easy to have dangling pointers thanks to MDNode uniquing.
llvm-svn: 82507
2009-09-22 02:03:18 +00:00
Chris Lattner
de39a12610 Revert r82404, it is causing a bootstrap miscompile. This is very very
scary, as it indicates a lurking bug. yay.

llvm-svn: 82411
2009-09-20 22:44:26 +00:00
Chris Lattner
a9a2b9a4cc improve memdep to eliminate bitcasts (and aliases, and noop geps)
early for the stated reasons: this allows it to find more 
equivalences and depend less on code layout.

llvm-svn: 82404
2009-09-20 21:00:18 +00:00
Daniel Dunbar
378331a13d Tabs -> spaces, and remove trailing whitespace.
llvm-svn: 82355
2009-09-20 02:20:51 +00:00
Daniel Dunbar
39c0d90339 Strip trailing whitespace.
llvm-svn: 82332
2009-09-19 20:40:05 +00:00
Nick Lewycky
e539e55f2a Add a comment explaining why you would ever want to do this.
llvm-svn: 82319
2009-09-19 19:00:06 +00:00
Nick Lewycky
441d1e8dd5 Lett users of sparse propagation do their own thing with phi nodes if they want
to. This can be combined with LCSSA or SSI form to store more information on a
PHINode than can be computed by looking at its incoming values.

llvm-svn: 82317
2009-09-19 18:33:36 +00:00
Duncan Sands
6f1a8215c0 The flag "--dot-cfg-only" is at the moment equivalent to the flag "--dot-cfg".
It prints the content of all bbs, instead of printing empty bbs to make the
CFG more readable.  Fix this.  Patch by Tobias Grosser.

llvm-svn: 82315
2009-09-19 11:25:44 +00:00
Victor Hernandez
66d4042178 Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst.
Reviewed by Eli Friedman.

llvm-svn: 82281
2009-09-18 21:34:51 +00:00
Victor Hernandez
065bc44d01 Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants.

Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array.

Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type.

Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls.

Add verification for malloc calls.

Reviewed by Dan Gohman.

llvm-svn: 82257
2009-09-18 19:20:02 +00:00
Nick Lewycky
9143d2c7a2 Add newlines.
llvm-svn: 82206
2009-09-18 07:36:47 +00:00
Dan Gohman
723717853b Teach ScalarEvolution how to reason about no-wrap flags on loops
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.

llvm-svn: 82151
2009-09-17 18:05:20 +00:00
Devang Patel
371df479d4 Provide a way to extract location info from DILocation.
llvm-svn: 82064
2009-09-16 18:20:05 +00:00
Andreas Neustifter
15e9f61d26 Reapplied r81355 with the problems fixed.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086737.html and
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086746.html)

llvm-svn: 82039
2009-09-16 11:35:50 +00:00
Chris Lattner
6302039748 simplify some code
llvm-svn: 81961
2009-09-16 00:08:07 +00:00
Dan Gohman
78b99e3761 Teach ValueTracking how to look through GlobalAliases. GlobalAliases are
not folded in the constant folder because the constant folder doesn't
simplify ConstantExpr operands.

llvm-svn: 81864
2009-09-15 16:14:44 +00:00
Chris Lattner
d219c7b6ee add a new CallGraphNode::replaceCallEdge method and use it from
argpromote to avoid invalidating an iterator.  This fixes PR4977.
All clang tests now pass with expensive checking (on my system 
at least).

llvm-svn: 81843
2009-09-15 05:40:35 +00:00
Chris Lattner
50438771c0 make -debug-pass=Executions show information about what call graph nodes
are in the SCC for each execution of a CGSCC pass.

llvm-svn: 81838
2009-09-15 05:03:04 +00:00
Andreas Neustifter
13935bc5be Bugfix. Sorry.
llvm-svn: 81517
2009-09-11 08:43:15 +00:00
Andreas Neustifter
9d49ec27fa Make ProfileEstimator even more robust on general CFGs.
llvm-svn: 81516
2009-09-11 08:39:33 +00:00
Dan Gohman
aa66e3d968 Teach lib/VMCore/ConstantFold.cpp how to set the inbounds keyword and
how to fold notionally-out-of-bounds array getelementptr indices instead
of just doing these in lib/Analysis/ConstantFolding.cpp, because it can
be done in a fairly general way without TargetData, and because not all
constants are visited by lib/Analysis/ConstantFolding.cpp. This enables
more constant folding.

Also, set the "inbounds" flag when the getelementptr indices are
one-past-the-end.

llvm-svn: 81483
2009-09-11 00:04:14 +00:00
Dan Gohman
97819c7fe8 Give these files top-level comments that describe the current code.
llvm-svn: 81473
2009-09-10 23:07:18 +00:00
Dale Johannesen
fa355ddba3 Fix uppercaseo.
llvm-svn: 81463
2009-09-10 22:01:32 +00:00
Victor Hernandez
bcdf5ed5ae Fit code within 80 columns
llvm-svn: 81459
2009-09-10 20:18:57 +00:00
Andreas Neustifter
7a526c9491 Make ProfileEstimator more robust on general CFGs.
llvm-svn: 81450
2009-09-10 16:30:38 +00:00
Benjamin Kramer
200a6693fb Add some braces to make newer GCCs happy and update CMakeLists.
llvm-svn: 81443
2009-09-10 11:31:39 +00:00
Andreas Neustifter
4d8afb529c Cleaned up code by factoring out common portions of edge loading into function.
llvm-svn: 81438
2009-09-10 07:12:35 +00:00
Evan Cheng
78182244f1 Add malloc call utility functions. Patch by Victor Hernandez.
llvm-svn: 81426
2009-09-10 04:36:43 +00:00
Andreas Neustifter
2a16f0658b Reverted r81358.
llvm-svn: 81364
2009-09-09 18:19:35 +00:00
Benjamin Kramer
66572030a8 Fix build, add missing simicolon.
llvm-svn: 81362
2009-09-09 18:03:46 +00:00
Andreas Neustifter
8b995d7f88 Add the first functions for updating ProfileInfo.
llvm-svn: 81359
2009-09-09 17:52:57 +00:00
Andreas Neustifter
e97b505f2d Cleaned up code by factoring out common portions of edge loading into funcion.
llvm-svn: 81358
2009-09-09 17:51:39 +00:00
Chris Lattner
cfd0d3e363 revert r81335, which breaks the build.
llvm-svn: 81347
2009-09-09 16:00:57 +00:00
Andreas Neustifter
14bc5768e0 Fixed wrong storage option for ProfileVerifierDisableAssertions.
Fixed non working -profile-verifier-noassert option.
Fixed missing newline in debugEntry().
Cleaned up assert messages. (assert(0 && Message) is still shown, but the message is printed before.)
When verifiying loaded profiles the ProfileVerifier got confused when block was a setjmp target, this is checked now.
When verifiying loaded profiles the ProfileVerifier got confused when block eventually reaching an exit(), this is checked now.

llvm-svn: 81338
2009-09-09 13:01:03 +00:00
Andreas Neustifter
ea41c1b35e Updated ProfileInfo to have clean seperation between different sentinels.
llvm-svn: 81335
2009-09-09 12:48:26 +00:00
Dan Gohman
cdaa08e706 Re-apply r80926, with fixes: keep the domtree informed of new blocks
that get created during loop unswitching, and fix SplitBlockPredecessors'
LCSSA updating code to create new PHIs instead of trying to just move
existing ones.

Also, optimize Loop::verifyLoop, since it gets called a lot. Use
searches on a sorted list of blocks instead of calling the "contains"
function, as is done in other places in the Loop class, since "contains"
does a linear search. Also, don't call verifyLoop from LoopSimplify or
LCSSA, as the PassManager is already calling verifyLoop as part of
LoopInfo's verifyAnalysis.

llvm-svn: 81221
2009-09-08 15:45:00 +00:00
Chris Lattner
37dbbde91b fix ComputeMaskedBits handling of zext/sext/trunc to work with vectors.
This fixes PR4905

llvm-svn: 81174
2009-09-08 00:13:52 +00:00
Chris Lattner
1247f36e13 add some comments to describe the invariants.
llvm-svn: 81173
2009-09-08 00:06:16 +00:00
Duncan Sands
357614a0ca Do not try to override non-virtual methods, especially
when the new method gives the same result as the original
(as far as I can see).  This will hopefully pacify icc.

llvm-svn: 81131
2009-09-06 20:02:00 +00:00
Duncan Sands
0d5fa5f018 Mark more constants unsigned, as warned about by icc (#68).
Patch by Erick Tryzelaar.

llvm-svn: 81116
2009-09-06 12:56:52 +00:00
Evan Cheng
a191202da5 Revert r80926. It causes loop unswitch assertion and slow down some JIT tests significantly.
llvm-svn: 81101
2009-09-06 02:26:10 +00:00
Andreas Neustifter
bba38af145 Prevent warnings on compilers for which its not clear that assert won't return.
llvm-svn: 81044
2009-09-04 21:22:04 +00:00
Andreas Neustifter
a956e23520 Cleaned up ProfileVerifierPass.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086219.html)

llvm-svn: 81007
2009-09-04 17:15:10 +00:00
Daniel Dunbar
e1e99bbb67 Revert "--- Reverse-merging r80908 into '.':", I already "fixed" this.
llvm-svn: 80970
2009-09-03 23:40:10 +00:00
Dan Gohman
b9b2864a49 Revert 80959. It isn't sufficient to solve the full problem. And it
introduced regressions in the Ocaml bindings tests.

llvm-svn: 80969
2009-09-03 23:34:49 +00:00
Bill Wendling
faf3fd8b85 --- Reverse-merging r80908 into '.':
D    test/Analysis/Profiling

--- Reverse-merging r80907 into '.':
U    lib/Analysis/ProfileInfoLoaderPass.cpp

Attempt to remove failure in the self-hosting build bot.

llvm-svn: 80966
2009-09-03 23:13:46 +00:00
Dan Gohman
e5ec3c1a26 Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,
and exact flags. Because ConstantExprs are uniqued, creating an
expression with this flag causes all expressions with the same operands
to have the same flag, which may not be safe. Add, sub, mul, and sdiv
ConstantExprs are usually folded anyway, so the main interesting flag
here is inbounds, and the constant folder already knows how to set the
inbounds flag automatically in most cases, so there isn't an urgent need
for the API support.

This can be reconsidered in the future, but for now just removing these
API bits eliminates a source of potential trouble with little downside.

llvm-svn: 80959
2009-09-03 22:17:40 +00:00
Dan Gohman
0cfbcef167 Smallvectorize switchExitBlocks.
llvm-svn: 80942
2009-09-03 20:36:13 +00:00
Dan Gohman
7296225414 Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verify
that these passes are properly preserved.

Fix several transformation passes that claimed to preserve LoopSimplify
form but weren't.

llvm-svn: 80926
2009-09-03 16:31:42 +00:00
Dan Gohman
382f174be1 Move getUniqueExitBlocks from LoopBase to Loop, since they depend on
LoopSimplify form, which is currently only available on Loops (and
not MachineLoops). Also, move the code out of the header file.

llvm-svn: 80923
2009-09-03 16:10:48 +00:00
Dan Gohman
addca8bad6 Don't try to verify a LoopPass analysis if the loop has been deleted.
llvm-svn: 80919
2009-09-03 15:09:24 +00:00
Dan Gohman
d32bdb4c58 Remove references to expression "handles", which are no longer used.
llvm-svn: 80918
2009-09-03 15:00:26 +00:00
Andreas Neustifter
9fd76dee00 Fix build warning.
llvm-svn: 80912
2009-09-03 09:11:10 +00:00
Andreas Neustifter
0b3bf54823 Code Cleanup.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086139.html)

llvm-svn: 80909
2009-09-03 08:41:05 +00:00
Daniel Dunbar
51ec7bb5aa Remove undefined behavior when loading optimal edge profile info.
llvm-svn: 80907
2009-09-03 07:37:42 +00:00
Gabor Greif
4604e0739b back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure
llvm-svn: 80871
2009-09-03 02:02:59 +00:00
Gabor Greif
68c4f27e59 re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...
llvm-svn: 80858
2009-09-03 00:18:58 +00:00
Torok Edwin
31cf28eefd Fix DbgStopPointInst->getFileName/getDirectory, broken by the MDNodification in
r80406, and readd a -print-dbginfo test.

llvm-svn: 80778
2009-09-02 11:13:56 +00:00
Chris Lattner
1f08c79edc fix PR4848 an infinite loop when indexing down through a recursive gep
and we get the original pointer type.  This doesn't mean that we're
at the first pointer being indexed.  Correct the predicate.

llvm-svn: 80762
2009-09-02 05:35:45 +00:00
Chris Lattner
140720ab83 revert my patch, duncan points out what is wrong with my logic. Add
a comment so that I don't change this in the future :)

llvm-svn: 80760
2009-09-02 04:39:04 +00:00
Chris Lattner
e1637fa3f6 one more try at making this simpler, hopefully it won't break everything :)
llvm-svn: 80759
2009-09-02 04:34:06 +00:00
Duncan Sands
b970a46d06 Complicate Chris's simplification, avoiding complaints
about singular iterators when building with expensive
checks turned on.

llvm-svn: 80757
2009-09-02 03:48:41 +00:00
Daniel Dunbar
ed881c3427 Fix build warning.
llvm-svn: 80730
2009-09-01 22:07:12 +00:00
Chris Lattner
7db43e1b57 debug intrinsics do not go in the callgraph, this fixes a couple
clang regtest failures.

llvm-svn: 80724
2009-09-01 21:37:50 +00:00