David Greene
ede60e521f
Fix a build error by adding a missing commit.
...
llvm-svn: 92670
2010-01-05 01:36:30 +00:00
Chris Lattner
89b1b63bdf
teach instcombine to optimize pointer difference idioms involving constant
...
expressions. This is a step towards comment #4 in PR3351.
llvm-svn: 92401
2010-01-01 22:29:12 +00:00
Chris Lattner
f1704b24be
remove #include that comes in from ConstantFolder.h
...
llvm-svn: 92232
2009-12-28 21:52:06 +00:00
Chris Lattner
28de6cdbf5
remove #include of Function.h from IRBuilder
...
llvm-svn: 92231
2009-12-28 21:50:56 +00:00
Chris Lattner
e70c40e8ac
move debug info stuff out of line, allowing two #includes
...
to go away from IRBuilder.h
llvm-svn: 92230
2009-12-28 21:45:40 +00:00
Chris Lattner
e0b9847223
split code that doesn't need to be templated out of IRBuilder into a new
...
non-templated IRBuilderBase class. Move that large CreateGlobalString
out of line, eliminating the need to #include GlobalVariable.h in IRBuilder.h
llvm-svn: 92227
2009-12-28 21:28:46 +00:00
Chris Lattner
13e5945d1d
rename ivar to be more descriptive.
...
llvm-svn: 92226
2009-12-28 21:12:29 +00:00
Chris Lattner
cd3aa9d1ff
rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
...
doesn't exist already, eliminate registerMDKind. Tidy up a bunch
of random stuff.
llvm-svn: 92225
2009-12-28 20:45:51 +00:00
Bill Wendling
baec6e54f4
Add an "ATTRIBUTE_UNUSED" macro (and use it). It's for variables which are
...
mainly used in debugging and/or assert situations. It should make the compiler
and the static analyzer stop nagging us about them.
llvm-svn: 92181
2009-12-28 01:20:29 +00:00
David Greene
d411e1b728
Fix a comment.
...
llvm-svn: 92082
2009-12-23 23:19:43 +00:00
David Greene
ac142c7e5d
Convert debug messages to use dbgs(). Generally this means
...
s/errs/dbgs/g except for certain special cases.
llvm-svn: 92016
2009-12-23 18:25:37 +00:00
David Greene
3f7cf289ed
Provide dbgs(), a circular-buffering debug output stream. By default it
...
simply passes output to errs(). If -debug-buffer-size=N is set N > 0,
dbgs() buffers its output until program termination and dumps the last N
characters sent to it. This is handy when debugging very large inputs.
llvm-svn: 92002
2009-12-23 16:39:06 +00:00
David Greene
f1f78a15e1
Add circular_raw_ostream, which buffers its output in a circular queue
...
and outputs it when explicitly flushed. The intent is to use it in
situations such as debug output logging where a signal handler can take
care of flushing the buffer at program termination.
llvm-svn: 92001
2009-12-23 16:08:15 +00:00
Anton Korobeynikov
903c2a0cb5
Restore snprintf weirdness for VCPP only
...
llvm-svn: 91918
2009-12-22 20:11:00 +00:00
Chris Lattner
e1abf0437c
don't run GVN at -O1, GCC doesn't do it's equivalent at that optimization level.
...
llvm-svn: 91886
2009-12-22 04:47:41 +00:00
Anton Korobeynikov
299ec7d3e7
Remove uber-gross hack. The define _snprintf to snprintf is invalid due to two reasons: 1. Accroding to C++ standard snprintf should be available in std namespace (and __gnu_cxx in case of GCC to). Such ifdef will change all snprintf's to _snprintf's, but won't bring snprintf to all necessary namespaces. Thus e.g. any locale-using code on mingw will yield an error (include this file + string to see the result) 2. MSVCRT's _snprintf does not comply with C99 standard. Standard one is snprintf.
...
llvm-svn: 91842
2009-12-21 20:19:37 +00:00
Chris Lattner
e390b70e2c
Make some methods const. The only interesting change here is that
...
it changes raw_fd_ostream::preferred_buffer_size to return zero on
a scary stat failure instead of setting the stream to an error state.
This method really should not mutate the stream.
llvm-svn: 91740
2009-12-19 01:38:42 +00:00
Dan Gohman
3ceb7c0c47
Add utility routines for NSW multiply.
...
llvm-svn: 91664
2009-12-18 03:10:26 +00:00
Dan Gohman
6bb50740f4
Add utility routines for creating integer negation operators with NSW set.
...
Integer negation only overflows with INT_MIN, but that's an important case.
llvm-svn: 91662
2009-12-18 02:58:50 +00:00
Chris Lattner
f1a0d32b5f
improve isPodLike to know that all non-class types are pod.
...
llvm-svn: 91425
2009-12-15 07:40:44 +00:00
Chris Lattner
587962c667
Remove isPod() from DenseMapInfo, splitting it out to its own
...
isPodLike type trait. This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.
llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Chris Lattner
05651d4544
add an ALWAYS_INLINE macro, which does the obvious thing.
...
llvm-svn: 91416
2009-12-15 06:14:33 +00:00
Dan Gohman
8e0956f734
Micro-optimize these functions in the case where they are not inlined.
...
llvm-svn: 91316
2009-12-14 19:32:31 +00:00
Jeffrey Yasskin
9cba192e78
Make it easier to use the llvm_unreachable and DEBUG macros without "using
...
namespace llvm" by qualifying their implementations with ::llvm::.
llvm-svn: 91206
2009-12-12 04:08:32 +00:00
Anders Carlsson
25a1bae472
Add qualifiers for calls to member functions in dependent bases.
...
llvm-svn: 91087
2009-12-11 01:04:42 +00:00
Chris Lattner
aee232cb03
Add helper methods for forming shift operations with a constant
...
shift amount.
llvm-svn: 90694
2009-12-06 01:56:22 +00:00
Bob Wilson
b8002101b4
Fix indentation.
...
llvm-svn: 90613
2009-12-04 22:46:47 +00:00
Mike Stump
cbbfda910a
Create yet another helper for Invoke.
...
llvm-svn: 90514
2009-12-04 01:53:15 +00:00
Mike Stump
9bc36df3e7
Add some helpers for Invoke to mirror CreateCall helpers.
...
llvm-svn: 90508
2009-12-04 01:26:26 +00:00
Benjamin Kramer
49b3c58272
Fix odd declaration.
...
llvm-svn: 90138
2009-11-30 15:52:29 +00:00
Tobias Grosser
74c7605daf
Remove ShortNames from getNodeLabel in DOTGraphTraits
...
llvm-svn: 90134
2009-11-30 12:38:47 +00:00
Tobias Grosser
48d8ba7043
Instantiate DefaultDOTGraphTraits
...
llvm-svn: 90133
2009-11-30 12:38:13 +00:00
Tobias Grosser
4b6d3d58f6
Do not point edge heads to source labels
...
If no destination label is available, just point to the node itself
instead of pointing to some source label. Source and destination labels are
not related in any way.
llvm-svn: 90132
2009-11-30 12:37:39 +00:00
Tobias Grosser
72a78e2a22
Only print edgeSourceLabels if they are not empty
...
Graphviz can layout the graphs better if a node does not contain source
ports. Therefore only print the ports if the source ports are useful,
that means are not labeled with the empty string "".
This patch also simplifies graphs without any edgeSourceLabels e.g. the
dominance trees.
llvm-svn: 90131
2009-11-30 12:24:40 +00:00
Daniel Dunbar
11a4dce179
SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the source line output.
...
llvm-svn: 89627
2009-11-22 22:08:00 +00:00
Daniel Dunbar
d4a7e3e760
Use ExtractElementInst::Create instead of new; patch by Artur Pietrek!
...
llvm-svn: 89606
2009-11-22 18:27:43 +00:00
Jeffrey Yasskin
eaf0187422
Remove spurious @verbatim. Patch by Timo Juhani Lindfors!
...
llvm-svn: 89252
2009-11-18 22:04:44 +00:00
Duncan Sands
bebe645914
Following a suggestion of Daniel Dunbar, stop people passing the name
...
as the isSigned bool to CreateIntCast by having this resolve to a call
to a private method, rather than by using a gcc attribute.
llvm-svn: 89067
2009-11-17 08:34:52 +00:00
Douglas Gregor
a92bd85bea
Make ERROR_IF_USED macro work with GCC <= 4.2, Apple GCCs
...
llvm-svn: 88916
2009-11-16 16:56:48 +00:00
Duncan Sands
d67a1e3fa8
Make sure that if anyone passes a name by accident for the isSigned
...
parameter of CreateIntCast then they get an error from the compiler
(or from the linker with a non-gcc compiler). Another possibility
is to flip the order of the DestTy and isSigned parameters, since you
should then get a compiler warning if you try to use a char* for a
Type*.
llvm-svn: 88913
2009-11-16 15:28:17 +00:00
Chris Lattner
5bbbe72be5
add attributes for readnone/readonly functions.
...
llvm-svn: 88862
2009-11-15 19:54:31 +00:00
Benjamin Kramer
e9ba686ab8
Implement DISABLE_INLINE for MSVC. This required changing the position in all
...
forward declaration and patching tblgen to emit it right. Patch by Amine Khaldi!
llvm-svn: 88798
2009-11-14 16:37:18 +00:00
Benjamin Kramer
521985553a
Make NORETURN working with MSVC. MSVC only accepts NORETURN in front of the
...
decl so move it there. GCC accepts it both in front and after decls.
llvm-svn: 88791
2009-11-14 14:14:58 +00:00
Nuno Lopes
aa4a883855
implement shl, ashr, and lshr methods. shl is not fully implemented as it is quite tricky.
...
llvm-svn: 86986
2009-11-12 14:53:53 +00:00
Devang Patel
304b516363
Add SetDebugLocation() variant to
...
add debug info location to an instruction.
llvm-svn: 86859
2009-11-11 19:06:06 +00:00
Chris Lattner
1f7f78ea94
jump threading does everything that condprop does any more. This passes
...
bootstrap on darwin i386.
llvm-svn: 86758
2009-11-10 23:54:10 +00:00
Jeffrey Yasskin
23ac706aab
Fix DenseMap iterator constness.
...
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.
The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.
Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.
Patch by Victor Zverovich!
llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Daniel Dunbar
886e51b5c1
Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
...
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.
llvm-svn: 86630
2009-11-10 00:43:58 +00:00
Nuno Lopes
5b15b50af4
add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APInt
...
llvm-svn: 86549
2009-11-09 15:36:28 +00:00
Daniel Dunbar
4daaf9d3f4
Pass StringRef by value.
...
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Chris Lattner
6a31c1141c
remove some more Context arguments.
...
llvm-svn: 86235
2009-11-06 05:59:53 +00:00
Chris Lattner
903ae55e1c
remove a bunch of extraneous LLVMContext arguments
...
from various APIs, addressing PR5325.
llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Dan Gohman
8d72615df7
InstrTypes.h includes Instruction.h, so it's not necessary to include both.
...
llvm-svn: 86162
2009-11-05 19:42:20 +00:00
Douglas Gregor
2272ca3d44
Move llvm: 🆑 :opt's conversion function into the base classes that
...
actually need that conversion function. Silences a Clang++ warning.
llvm-svn: 86148
2009-11-05 18:30:50 +00:00
Chris Lattner
d04294d7b8
Declare classes with matched tags, pointed out by a clang++ warning.
...
llvm-svn: 86144
2009-11-05 17:51:44 +00:00
Douglas Gregor
eff068fbcb
Make two more LLVM headers standalone
...
llvm-svn: 86131
2009-11-05 13:39:23 +00:00
Douglas Gregor
4f2fc40ae8
Make a few headers standalone. Plus, add a missing "template" keyword
...
that Clang diagnoses but GCC does not.
llvm-svn: 86130
2009-11-05 13:30:28 +00:00
Chris Lattner
dddec653f1
make IRBuilder zap "X|0" and "X&-1" when building IR, this happens
...
during bitfield codegen and slows down -O0 compile times by making
useless IR. rdar://7362516
llvm-svn: 86006
2009-11-04 05:00:12 +00:00
Chris Lattner
3ea71a58aa
turn IPSCCP back on by default, try #3 or 4? Woo.
...
llvm-svn: 85929
2009-11-03 19:35:13 +00:00
Duncan Sands
531ed64b09
Run the functionattrs pass after the inliner, and not before.
...
This makes both logical sense (see below) and increases the
number of functions marked readnone/readonly by about 1-2%
in practice. The number of functions marked nocapture goes
up by about 5-10%. The reason it makes sense is shown by
the following example: if you run -functionattrs -inline on
it, then no attributes are assigned. But if you instead run
-inline -functionattrs then @f is marked readnone because the
simplifications produced by the inliner eliminate the store.
@x = external global i32
define void @w(i1 %b) {
br i1 %b, label %write, label %return
write:
store i32 1, i32 *@x
br label %return
return:
ret void
}
define void @f() {
call void @w(i1 0)
ret void
}
llvm-svn: 85893
2009-11-03 09:40:08 +00:00
Daniel Dunbar
b5c7546aaf
Speculatively redisable IPSCCP, I think its still breaking things.
...
llvm-svn: 85884
2009-11-03 07:49:22 +00:00
Chris Lattner
b1dfdadabd
turn IPSCCP back on now that the iterator invalidation bug is fixed.
...
llvm-svn: 85858
2009-11-03 03:42:51 +00:00
Chris Lattner
6f515d4ba8
revert r8579[56], which are causing unhappiness in buildbot land.
...
llvm-svn: 85818
2009-11-02 19:31:10 +00:00
Chris Lattner
8243ac1abf
now that ip sccp *really* subsumes ipcp, remove ipcp again.
...
llvm-svn: 85796
2009-11-02 07:34:29 +00:00
Chris Lattner
dc9cf48396
fix two strange things in the default passmgr:
...
1. we'd run simplifycfg at the very start, even though
the per function passes have already cleaned this up.
2. In the main per-function pipeline that is interlaced with inlining
etc, we would do instcombine, jump threading, simplifycfg *before*
doing SROA. SROA is much more likely to expose opportunities for
these passes than they are for SROA, so move SRoA up earlier.
also add some comments.
llvm-svn: 85742
2009-11-01 20:41:59 +00:00
Chris Lattner
2db49d0a22
IPSCCP apparently is not a superset of IPCP, this is bad,
...
but I'll investigate it separately. This unbreaks
test/FrontendC/weak_constant.c
llvm-svn: 85735
2009-11-01 19:29:12 +00:00
Chris Lattner
73fa16be5d
only run GlobalDCE at -O3 and run it late instead of early.
...
GlobalOpt already deletes trivially dead functions/globals,
so GlobalDCE only adds values for cycles of dead things.
llvm-svn: 85731
2009-11-01 19:09:12 +00:00
Chris Lattner
69549467e3
We currently only run ipsccp at LTO time, which is silly. It subsumes
...
ipconstprop and doesn't take much time. Just run it in its place.
This adds a testcase for it, which I plan to expand to cover other
"integration" cases, where we expect the optimizer to be able to
eliminate various things. Due to phase order issues we've regressed
in a number of areas and integration tests are the only way I see to
prevent this.
llvm-svn: 85729
2009-11-01 18:57:49 +00:00
Evan Cheng
eb9c268ba0
Rather than having llvm-gcc changing the meaning of OptimizeSize, just make sure loop unswitch is conservative when optimization level is < 3.
...
llvm-svn: 85581
2009-10-30 07:23:49 +00:00
Chris Lattner
64ba3671c9
add IRBuilder support for IndirectBr
...
llvm-svn: 85445
2009-10-28 23:25:00 +00:00
Chris Lattner
a77d439989
add a new 'SetCurrentDebugType' API (requested by Andrew Haley for JIT
...
stuff) to programmatically control the current debug flavor. While
I'm at it, doxygenate Debug.h and clean it up.
llvm-svn: 85395
2009-10-28 15:32:19 +00:00
Chris Lattner
2bc8002f4c
rename indbr -> indirectbr to appease the residents of #llvm.
...
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Chris Lattner
fdda543cea
add enough support for indirect branch for the feature test to pass
...
(assembler,asmprinter, bc reader+writer) and document it. Codegen
currently aborts on it.
llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Chris Lattner
71d02f1af8
lang points out that the comment is out of date with the code.
...
llvm-svn: 85203
2009-10-27 04:58:10 +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
7c0dc4ab00
Add CreateZExtOrBitCast and CreateSExtOrBitCast to TargetFolder
...
for consistency with ConstantFolder.
llvm-svn: 85137
2009-10-26 18:36:40 +00:00
Chandler Carruth
766362c707
Move DataTypes.h to include/llvm/System, update all users. This breaks the last
...
direct inclusion edge from System to Support.
llvm-svn: 85086
2009-10-26 01:35:46 +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
Jeffrey Yasskin
e90afea0ba
Try r84890 again (adding ValueMap<>), now that I've tested the compile on
...
gcc-4.4.
llvm-svn: 84902
2009-10-22 22:11:22 +00:00
Jeffrey Yasskin
7555ed8cdc
Revert r84890, which broke the linux build.
...
llvm-svn: 84892
2009-10-22 20:23:43 +00:00
Jeffrey Yasskin
ad8692124f
Add a ValueMap<ValueOrSubclass*, T> type. ValueMap<Value*, T> is safe to use
...
even when keys get RAUWed and deleted during its lifetime. By default the keys
act like WeakVHs, but users can pass a third template parameter to configure
how updates work and whether to do anything beyond updating the map on each
action.
It's also possible to automatically acquire a lock around ValueMap updates
triggered by RAUWs and deletes, to support the ExecutionEngine.
llvm-svn: 84890
2009-10-22 20:10:20 +00:00
Devang Patel
7edc7aa34d
Cosmetic changes.
...
s/validName/isValidName/g
s/with an Instruction/to an Instruction/g
s/RegisterMDKind/registerMDKind/g
llvm-svn: 84689
2009-10-20 22:50:27 +00:00
Jeffrey Yasskin
fdb36c1a29
Clean up the JITResolver stub/callsite<->function maps.
...
The JITResolver maps Functions to their canonical stubs and all callsites for
lazily-compiled functions to their target Functions. To make Function
destruction work, I'm going to need to remove all callsites on destruction, so
this patch also adds the reverse mapping for that.
There was an incorrect assumption in here that the only stub for a function
would be the one caused by needing to lazily compile it, while x86-64 far calls
and dlsym-stubs could also cause such stubs, but I didn't look for a test case
that the assumption broke.
This also adds DenseMapInfo<AssertingVH> so I can use DenseMaps instead of
std::maps.
llvm-svn: 84522
2009-10-19 18:49:59 +00:00
Eric Christopher
41d8dc960b
More warnings patrol: Another unused argument and more implicit
...
conversions.
llvm-svn: 84382
2009-10-17 23:56:18 +00:00
Daniel Dunbar
5aa3eebc5d
Add raw_ostream::write_escaped, for writing escaped strings.
...
llvm-svn: 84355
2009-10-17 20:43:08 +00:00
Victor Hernandez
a25a2890fa
Remove MallocInst from LLVM Instructions.
...
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Eric Christopher
fd8bbb9270
One more iteration here and a yet better way to solve it.
...
llvm-svn: 84150
2009-10-14 22:14:18 +00:00
Eric Christopher
11e07e9ef1
Fix the unused argument problem here a different way - cast to void.
...
llvm-svn: 84147
2009-10-14 21:45:49 +00:00
Dan Gohman
ae76dc48d6
Delete bogus semicolons.
...
llvm-svn: 84132
2009-10-14 20:39:01 +00:00
Eric Christopher
a7407c0921
Remove a bunch of unused arguments from functions, silencing a
...
warning.
llvm-svn: 84130
2009-10-14 20:28:33 +00:00
Devang Patel
72f708ec2f
s/DebugLoc.CompileUnit/DebugLoc.Scope/g
...
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g
llvm-svn: 84054
2009-10-13 23:28:53 +00:00
Douglas Gregor
1fd6052176
Add is_same type trait
...
llvm-svn: 84029
2009-10-13 21:17:00 +00:00
Jeffrey Yasskin
7d85d5a366
Fix http://llvm.org/PR5160 , to let CallbackVHs modify other ValueHandles on the
...
same Value without breaking things.
llvm-svn: 83861
2009-10-12 17:43:32 +00:00
Chris Lattner
2a0366af9e
add a helper for matching "1".
...
llvm-svn: 83760
2009-10-11 07:51:25 +00:00
Chris Lattner
a9bbfdf699
there is no need to run mem2reg after jump threading at LTO time now.
...
llvm-svn: 83753
2009-10-11 04:17:33 +00:00
Chris Lattner
54621efc37
add some WeakVH::operator='s. Without these, assigning
...
a Value* to a WeakVH was constructing a temporary WeakVH
(due to the implicit assignment operator). This avoids
that cost.
llvm-svn: 83704
2009-10-10 08:27:29 +00:00
Evan Cheng
1a5c370be3
Rename enum NumOccurrences to NumOccurrencesFlag since there is a member named NumOccurrences.
...
llvm-svn: 83273
2009-10-04 05:25:42 +00:00
Douglas Gregor
a3fb17c280
Teach CMake to look for bidirectional_iterator, iterator, forward_iterator, uint64_t, and u_int64_t, from Yonggang Luo
...
llvm-svn: 83203
2009-10-01 17:25:36 +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