Reid Spencer
8f166b0ef3
Comparison of primitive type sizes should now be done in bits, not bytes.
...
This patch converts getPrimitiveSize to getPrimitiveSizeInBits where it is
appropriate to do so (comparison of integer primitive types).
llvm-svn: 33012
2007-01-08 16:32:00 +00:00
Reid Spencer
c635f47d9a
For PR950:
...
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int -> Int32
4. [U]Long -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
and other methods related to signedness. In a few places this warranted
identifying the signedness information from other sources.
llvm-svn: 32785
2006-12-31 05:48:39 +00:00
Reid Spencer
266e42b312
For PR950:
...
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.
llvm-svn: 32751
2006-12-23 06:05:41 +00:00
Chris Lattner
f171af97d5
add a simple fast-path for dead allocas
...
llvm-svn: 32750
2006-12-22 23:14:42 +00:00
Chris Lattner
79a42ac941
Switch over Transforms/Scalar to use the STATISTIC macro. For each statistic
...
converted, we lose a static initializer. This also allows GCC to emit warnings
about unused statistics.
llvm-svn: 32690
2006-12-19 21:40:18 +00:00
Chris Lattner
8f7b775bf4
re-enable a temporarily-reverted patch
...
llvm-svn: 32595
2006-12-15 07:32:38 +00:00
Chris Lattner
7c1dff99dc
revert my recent int<->fp and vector union promotion changes, they expose
...
obscure bugs affecting the X86 code generator. I will reenable this
when fixed.
llvm-svn: 32524
2006-12-13 02:26:45 +00:00
Chris Lattner
6e5fe376ec
Patch for PR1045 and Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll
...
llvm-svn: 32468
2006-12-12 04:24:41 +00:00
Chris Lattner
e810140c4b
trunc to integer, not to FP.
...
llvm-svn: 32426
2006-12-11 01:17:00 +00:00
Chris Lattner
23f4b68f7e
implement promotion of unions containing two packed types of the same width.
...
This implements Transforms/ScalarRepl/union-packed.ll
llvm-svn: 32422
2006-12-11 00:35:08 +00:00
Chris Lattner
216c3028e6
* Eliminate calls to CastInst::createInferredCast.
...
* Add support for promoting unions with fp values in them. This produces
our new int<->fp bitcast instructions, implementing
Transforms/ScalarRepl/union-fp-int.ll
As an example, this allows us to compile this:
union intfloat { int i; float f; };
float invsqrt(const float arg_x) {
union intfloat x = { .f = arg_x };
const float xhalf = arg_x * 0.5f;
x.i = 0x5f3759df - (x.i >> 1);
return x.f * (1.5f - xhalf * x.f * x.f);
}
into:
_invsqrt:
movss 4(%esp), %xmm0
movd %xmm0, %eax
sarl %eax
movl $1597463007, %ecx
subl %eax, %ecx
movd %ecx, %xmm1
mulss LCPI1_0, %xmm0
mulss %xmm1, %xmm0
movss LCPI1_1, %xmm2
mulss %xmm1, %xmm0
subss %xmm0, %xmm2
movl 8(%esp), %eax
mulss %xmm2, %xmm1
movss %xmm1, (%eax)
ret
instead of:
_invsqrt:
subl $4, %esp
movss 8(%esp), %xmm0
movss %xmm0, (%esp)
movl (%esp), %eax
movl $1597463007, %ecx
sarl %eax
subl %eax, %ecx
movl %ecx, (%esp)
mulss LCPI1_0, %xmm0
movss (%esp), %xmm1
mulss %xmm1, %xmm0
mulss %xmm1, %xmm0
movss LCPI1_1, %xmm2
subss %xmm0, %xmm2
mulss %xmm2, %xmm1
movl 12(%esp), %eax
movss %xmm1, (%eax)
addl $4, %esp
ret
llvm-svn: 32418
2006-12-10 23:56:50 +00:00
Chris Lattner
700b873130
Detemplatize the Statistic class. The only type it is instantiated with
...
is 'unsigned'.
llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Reid Spencer
6c38f0bb07
For PR950:
...
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.
llvm-svn: 31931
2006-11-27 01:05:10 +00:00
Bill Wendling
5dbf43c983
Removed #include <iostream> and replaced with llvm_* streams.
...
llvm-svn: 31923
2006-11-26 09:46:52 +00:00
Reid Spencer
fdff938a7e
For PR950:
...
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.
llvm-svn: 31542
2006-11-08 06:47:33 +00:00
Chris Lattner
4967f6ddea
scalarrepl should not split the two elements of the vsiidx array:
...
int func(vFloat v0, vFloat v1) {
int ii;
vSInt32 vsiidx[2];
vsiidx[0] = _mm_cvttps_epi32(v0);
vsiidx[1] = _mm_cvttps_epi32(v1);
ii = ((int *) vsiidx)[4];
return ii;
}
This fixes Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll
llvm-svn: 31524
2006-11-07 22:42:47 +00:00
Reid Spencer
de46e48420
For PR786:
...
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.
llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Chris Lattner
ebb1ad4382
Fix Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll
...
llvm-svn: 31151
2006-10-24 06:26:32 +00:00
Reid Spencer
e0fc4dfc22
For PR950:
...
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.
llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner
41b442242d
Implement SROA of unions with mixed pointers/integers in them. This implements
...
PR892 and Transforms/ScalarRepl/union-pointer.ll:test2
llvm-svn: 30825
2006-10-08 23:53:04 +00:00
Chris Lattner
05f8272afa
Implement Transforms/ScalarRepl/union-pointer.ll:test
...
llvm-svn: 30823
2006-10-08 23:28:04 +00:00
Chris Lattner
c2d3d3112e
eliminate RegisterOpt. It does the same thing as RegisterPass.
...
llvm-svn: 29925
2006-08-27 22:42:52 +00:00
Chris Lattner
3d27be1333
s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
...
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Chris Lattner
996795b0dd
Use hidden visibility to make symbols in an anonymous namespace get
...
dropped. This shrinks libllvmgcc.dylib another 67K
llvm-svn: 28975
2006-06-28 23:17:24 +00:00
Chris Lattner
dae49df407
Fix Transforms/ScalarRepl/2006-04-20-PromoteCrash.ll
...
llvm-svn: 27912
2006-04-20 20:48:50 +00:00
Chris Lattner
3323ce165d
Teach scalarrepl to promote unions of vectors and floats, producing
...
insert/extractelement operations. This implements
Transforms/ScalarRepl/vector_promote.ll
llvm-svn: 27710
2006-04-14 21:42:41 +00:00
Chris Lattner
fc34f8bb48
Fix a miscompilation of 188.ammp with the new CFE. 188.ammp is accessing
...
arrays out of range in a horrible way, but we shouldn't break it anyway.
Details in the comments.
llvm-svn: 26606
2006-03-08 01:05:29 +00:00
Chris Lattner
c0f633a598
Fix Regression/Transforms/ScalarRepl/2006-01-24-IllegalUnionPromoteCrash.ll
...
llvm-svn: 25587
2006-01-24 19:36:27 +00:00
Chris Lattner
c597b8a55e
Make iostream #inclusion explicit
...
llvm-svn: 25514
2006-01-22 23:32:06 +00:00
Chris Lattner
8c9e14620f
Fix Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll, a crash on undefined
...
behavior in 126.gcc on big-endian systems.
llvm-svn: 24708
2005-12-14 17:23:59 +00:00
Chris Lattner
3b0a62d8a5
Implement a little hack for parity with GCC on crafty. This speeds up
...
186.crafty by about 16% (from 15.109s to 13.045s) on my system.
This turns allocas with unions/casts into scalars. For example crafty has
something like this:
union doub {
unsigned short i[4];
long long d;
};
int f(long long a) {
return ((union doub){.d=a}).i[1];
}
Instead of generating loads and stores to an alloca, we now promote the
whole thing to a scalar long value.
This implements: Transforms/ScalarRepl/AggregatePromote.ll
llvm-svn: 24667
2005-12-12 07:19:13 +00:00
Nate Begeman
848622f87f
Add support alignment of allocation instructions.
...
Add support for specifying alignment and size of setjmp jmpbufs.
No targets currently do anything with this information, nor is it presrved
in the bytecode representation. That's coming up next.
llvm-svn: 24196
2005-11-05 09:21:28 +00:00
Misha Brukman
b1c9317bb4
Remove trailing whitespace
...
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Chris Lattner
ce274ce93d
Silence warnings
...
llvm-svn: 19379
2005-01-08 19:34:41 +00:00
Reid Spencer
9339638e9c
Remove unused variable for compilation by VC++.
...
Patch contributed by Morten Ofstad.
llvm-svn: 17830
2004-11-15 17:29:41 +00:00
Chris Lattner
fe3f4e6ebd
Teach SROA how to promote an array index that is variable, if the dimension
...
of the array is just two. This occurs 8 times in gcc, 6 times in crafty, and
12 times in 099.go.
This implements ScalarRepl/sroa_two.ll
llvm-svn: 17727
2004-11-14 05:00:19 +00:00
Chris Lattner
8881912d71
Rearrange some code, no functionality changes.
...
llvm-svn: 17724
2004-11-14 04:24:28 +00:00
Chris Lattner
3e86084641
Prototype these functions more accurately
...
llvm-svn: 16432
2004-09-20 04:43:15 +00:00
Reid Spencer
7c16caa336
Changes For Bug 352
...
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.
llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Misha Brukman
2b3387a6d9
Fix #includes of i*.h => Instructions.h as per PR403.
...
llvm-svn: 15328
2004-07-29 17:05:13 +00:00
Chris Lattner
9a63520b1a
Fixes working towards PR341
...
llvm-svn: 14839
2004-07-15 01:50:47 +00:00
Chris Lattner
b5f8eb8315
Do not loop over uses as we delete them. This causes iterators to be
...
invalidated out from under us. This bug goes back to revision 1.1: scary.
llvm-svn: 14242
2004-06-19 02:02:22 +00:00
Chris Lattner
69193f93b6
Support getelementptr instructions which use uint's to index into structure
...
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.
llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner
40d2aeb28f
Finegrainify namespacification
...
Fix regressions ScalarRepl/basictest.ll & arraytest.ll
llvm-svn: 10287
2003-12-02 17:43:55 +00:00
Chris Lattner
52310702a1
Do not use index type to determine what it is indexing into!
...
llvm-svn: 10226
2003-11-25 21:09:18 +00:00
Brian Gaeke
960707c335
Put all LLVM code into the llvm namespace, as per bug 109.
...
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
bcb0f4bf2e
Fix PR66 & ScalarRepl/2003-10-29-ArrayProblem.ll
...
llvm-svn: 9585
2003-10-29 17:55:44 +00:00
John Criswell
482202a601
Added LLVM project notice to the top of every C++ source file.
...
Header files will be on the way.
llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
a906bacfdd
Change the interface to PromoteMemToReg to also take a DominatorTree
...
llvm-svn: 8883
2003-10-05 21:20:13 +00:00
Chris Lattner
5dac64f629
Rename Function::getEntryNode -> getEntryBlock
...
llvm-svn: 8625
2003-09-20 14:39:18 +00:00
Chris Lattner
7fdde92b1f
Do not return success after checking only the FIRST USE of a gep instruction.
...
Instead, check all uses.
This fixes bug: ScalarRepl/2003-09-12-IncorrectPromote.ll
This also fixes the miscompilation of Ptrdist/bc
llvm-svn: 8493
2003-09-12 16:02:12 +00:00
Chris Lattner
9a95f2a944
Minor optimization efficiency improvement:
...
- Run mem2reg promotion first
- Only rerun passes if the previous thing changed something
llvm-svn: 8490
2003-09-12 15:36:03 +00:00
Misha Brukman
217ca0bcb9
Apostrophes are only used for possession and quoting.
...
llvm-svn: 8473
2003-09-11 16:58:31 +00:00
Chris Lattner
5d8a12e094
Integrate functionality of the mem2reg pass directly into this pass to make
...
the combination more effective
llvm-svn: 8471
2003-09-11 16:45:55 +00:00
Chris Lattner
c817458b66
ScalarRepl does not modify the CFG. Say so!
...
llvm-svn: 8243
2003-08-31 00:45:13 +00:00
Chris Lattner
8abcd56c74
DEBUG got moved to Support/Debug.h
...
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Chris Lattner
6077c3195f
Simplify code by using ConstantInt::getRawValue instead of checking to see
...
whether the constant is signed or unsigned, then casting
llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner
0078d9c5bb
Okay totally give up on trying to optimize aggregates that cannot be completely
...
broken up into their elements. Too many programs break because of this.
llvm-svn: 6440
2003-05-30 19:22:14 +00:00
Chris Lattner
d847be0539
add a check that allows the SRoA pass to avoid breaking programs, even if their
...
behavior is technically undefined
llvm-svn: 6438
2003-05-30 18:09:57 +00:00
Chris Lattner
38d88c07f4
Fix bug: ScalarRepl/2003-05-30-MultiLevel.ll
...
llvm-svn: 6428
2003-05-30 05:26:30 +00:00
Chris Lattner
6e5398d69d
Fix bug: ScalarRepl/2003-05-29-ArrayFail.ll
...
llvm-svn: 6425
2003-05-30 04:15:41 +00:00
Chris Lattner
c16b210349
* Actually USE the statistic that we made
...
* Implement SRoA for arrays
llvm-svn: 6349
2003-05-27 16:09:27 +00:00
Chris Lattner
fb41a50d15
Implementation of the simple "scalar replacement of aggregates" transformation
...
llvm-svn: 6346
2003-05-27 15:45:27 +00:00