Граф коммитов

20 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner f742eb0196 Rename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
it is a predicate, not an action.  Change the return type to be a bool,
not the incomplete member.  Enhace it to detect the recursive compilation
case, allowing us to compile Eli's testcase on llvmdev:

struct T {
 struct T (*p)(void);
} t;

into:

%struct.T = type { {}* }

@t = common global %struct.T zeroinitializer, align 8




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134853 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-10 00:18:59 +00:00
Chris Lattner e0fd832b07 implement a tiny amount of codegen support for gnu array range
designators: allowing codegen when the element initializer is a
constant or something else without a side effect.  This unblocks
enough to let process.c in the linux kernel build, PR9257.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 22:28:58 +00:00
Chris Lattner 1b726771d0 Improve codegen for initializer lists to use memset more aggressively
when an initializer is variable (I handled the constant case in a previous
patch).  This has three pieces:

1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that
   the memory being stored into has previously been memset to zero.
2. Teach CGExprAgg to not emit stores of zero to isZeroed memory.
3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine
   whether they are profitable to emit a memset + inividual stores vs
   stores for everything.

The heuristic used is that a global has to be more than 16 bytes and
has to be 3/4 zero to be candidate for this xform.  The two testcases
are illustrative of the scenarios this catches.  We now codegen test9 into:

 call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false)
 %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0
 %tmp = load i32* %X.addr, align 4
 store i32 %tmp, i32* %.array

and test10 into:

  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false)
  %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0
  %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0
  %tmp2 = load i32* %X.addr, align 4
  store i32 %tmp2, i32* %tmp1, align 4
  %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3
  %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4
  %tmp11 = load i32* %X.addr, align 4
  store i32 %tmp11, i32* %tmp10, align 4

Previously we produced 99 stores of zero for test9 and also tons for test10.
This xforms should substantially speed up -O0 builds when it kicks in as well
as reducing code size and optimizer heartburn on insane cases.  This resolves
PR279.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 07:07:26 +00:00
Chris Lattner 70b02943dd Enhance the init generation logic to emit a memset followed by a few stores when
a global is larger than 32 bytes and has fewer than 6 non-zero values in the
initializer.  Previously we'd turn something like this:

char test8(int X) {
  char str[10000] = "abc";

into a 10K global variable which we then memcpy'd from.  Now we generate:

  %str = alloca [10000 x i8], align 16
  %tmp = getelementptr inbounds [10000 x i8]* %str, i64 0, i64 0
  call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 10000, i32 16, i1 false)
  store i8 97, i8* %tmp, align 16
  %0 = getelementptr [10000 x i8]* %str, i64 0, i64 1
  store i8 98, i8* %0, align 1
  %1 = getelementptr [10000 x i8]* %str, i64 0, i64 2
  store i8 99, i8* %1, align 2

Which is much smaller in space and also likely faster.

This is part of PR279



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120645 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:58:41 +00:00
Chris Lattner 9046c224f1 Allow a string literal to initialize a tail array (PR8217), patch
by Pierre Habouzit!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116165 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-10 17:49:49 +00:00
John McCall 0f2b692bb1 Don't consider casted non-global pointers to be evaluatable.
Fixes rdar://problem/8154689



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 05:08:32 +00:00
Nuno Lopes a75b71f967 recommit r101568 to fix PR6766
as a side-effect, remove two FIXMEs now fixed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101726 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 19:06:43 +00:00
Chris Lattner 7a22f02a02 revert r101568, which miscompiles this testcase, distilled from ldecod:
void exit_picture()
{
  char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};
  foo(yuv_types);
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101623 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 06:53:44 +00:00
Nuno Lopes 6784704d47 fix PR6766: codegen of var initialized with wide char
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101568 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 23:19:41 +00:00
Chris Lattner b35baae19b add a codegen hack to work around an AST bug, allowing us to compile the
code in PR6537.  This should be reverted when the ast bug is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 21:08:07 +00:00
Daniel Dunbar a5728872c7 Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Daniel Dunbar 4fcfde4d5c Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 01:45:36 +00:00
Daniel Dunbar d7d5f0223b Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Daniel Dunbar e4c9238795 Set constant bit on static block vars as well. Patch by Anders Johnson!q
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64502 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 22:58:39 +00:00
Douglas Gregor b574e5630d Upgrade the "excess elements in array initializer" warning to an
error, since both C99 and C++ consider it an error. For reference, GCC
makes this a warning while G++ makes it an error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 22:26:29 +00:00
Chris Lattner d3c3856c15 add a testcase
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 00:56:25 +00:00
Lauro Ramos Venancio 145cd89f92 Simplify aggregate initilizer implementation. Use the CodeGenModule::EmitConstantExpr method when
possible.
Fix mediabench/mpeg2/mpeg2dec test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47336 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 19:27:31 +00:00
Lauro Ramos Venancio 305762c089 Implement multi-dimension array initalizer.
Fix McCat/08-main test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 22:44:02 +00:00
Anders Carlsson a3881fc62a Correctly handle constants that refer to enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 01:28:48 +00:00
Anders Carlsson f6884ac7cf Correctly handle scalars in braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 01:15:48 +00:00