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