From evan.cheng at apple.com Mon May 28 21:42:34 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 28 May 2007 19:42:34 -0700 Subject: [llvm-commits] Regalloc Refactoring In-Reply-To: <4659B197.4090001@obbligato.org> References: <463E6E94.60909@obbligato.org> <46425F43.1020602@obbligato.org> <3CBCE7D6-1A4D-4B84-BB38-9AAB4C44D77C@apple.com> <464B632B.2020707@obbligato.org> <46548D77.1030607@obbligato.org> <0E38B24F-2C39-49B6-A3E0-A638133F0521@apple.com> <4659B197.4090001@obbligato.org> Message-ID: <91A9AA5E-6B30-43AA-98C1-A06ACF5655B4@apple.com> On May 27, 2007, at 9:28 AM, David Greene wrote: > Evan Cheng wrote: >> That's fine. Please check in what you have now after you've merged in >> the recent changes. > > I don't have write access to the repository. :-/ I'd gladly do the > update merge and commit if someone wants to grant me access. Ah right. Please merge in the changes and resubmit the patch. I'll check it in. Thanks, Evan > > Thanks for getting this in. As soon as I wrap up my regalloc work > here > I'll be tacking a coalescer, among other things. > > -Dave > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue May 29 00:30:03 2007 From: clattner at apple.com (clattner at apple.com) Date: Mon, 28 May 2007 22:30:03 -0700 (PDT) Subject: [llvm-commits] [127759] Fix an llvm-gcc build problem when configuring for x86_64-unknown-linux-gnu . Message-ID: <20070529053003.0487555F6992@src> Revision: 127759 Author: clattner Date: 2007-05-28 22:30:03 -0700 (Mon, 28 May 2007) Log Message: ----------- Fix an llvm-gcc build problem when configuring for x86_64-unknown-linux-gnu. Apparently, on this config, config/i386/linux64.h is used, but not config/i386/linux.h. As such, the PIC-related stuff in i386/linux.h wasn't being picked up, and pic codegen didn't work. This moves the code up to config/linux.h which is apparently picked up on all linux configs. This allows special code from arm/linux-elf.h to be removed. Thanks to Richard Guenther for sending me information necessary to track this down. Modified Paths: -------------- apple-local/branches/llvm/gcc/config/arm/linux-elf.h apple-local/branches/llvm/gcc/config/i386/linux.h apple-local/branches/llvm/gcc/config/linux.h Modified: apple-local/branches/llvm/gcc/config/arm/linux-elf.h =================================================================== --- apple-local/branches/llvm/gcc/config/arm/linux-elf.h 2007-05-28 11:27:34 UTC (rev 127758) +++ apple-local/branches/llvm/gcc/config/arm/linux-elf.h 2007-05-29 05:30:03 UTC (rev 127759) @@ -149,17 +149,3 @@ #ifdef HAVE_LD_AS_NEEDED #define USE_LD_AS_NEEDED 1 #endif - -/* APPLE LOCAL begin LLVM */ -#ifdef ENABLE_LLVM - -/* PIC codegen for ARM-Linux-ELF target */ -#define LLVM_SET_TARGET_OPTIONS(argvec) \ - if (flag_pic) \ - argvec.push_back ("--relocation-model=pic"); \ - else \ - argvec.push_back ("--relocation-model=static"); - -/* APPLE LOCAL end LLVM */ - -#endif Modified: apple-local/branches/llvm/gcc/config/i386/linux.h =================================================================== --- apple-local/branches/llvm/gcc/config/i386/linux.h 2007-05-28 11:27:34 UTC (rev 127758) +++ apple-local/branches/llvm/gcc/config/i386/linux.h 2007-05-29 05:30:03 UTC (rev 127759) @@ -189,16 +189,8 @@ /* APPLE LOCAL begin LLVM */ #ifdef ENABLE_LLVM -/* Yes, we're supporting PIC codegen for X86-Linux-ELF target! */ -#define LLVM_SET_TARGET_OPTIONS(argvec) \ - if (flag_pic) \ - argvec.push_back ("--relocation-model=pic"); \ - else \ - argvec.push_back ("--relocation-model=static"); - /* Add general target specific stuff */ #include "llvm-i386-target.h" -/* APPLE LOCAL end LLVM */ - #endif +/* APPLE LOCAL end LLVM */ Modified: apple-local/branches/llvm/gcc/config/linux.h =================================================================== --- apple-local/branches/llvm/gcc/config/linux.h 2007-05-28 11:27:34 UTC (rev 127758) +++ apple-local/branches/llvm/gcc/config/linux.h 2007-05-29 05:30:03 UTC (rev 127759) @@ -104,3 +104,17 @@ #define TARGET_C99_FUNCTIONS 1 #define TARGET_HAS_F_SETLKW + +/* APPLE LOCAL begin LLVM */ +#ifdef ENABLE_LLVM + +/* Yes, we're supporting PIC codegen for linux targets! */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else \ + argvec.push_back ("--relocation-model=static"); + +#endif +/* APPLE LOCAL end LLVM */ + From isanbard at gmail.com Tue May 29 04:24:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 29 May 2007 04:24:55 -0500 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200705290924.l4T9OtlW022651@zion.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.42 -> 1.43 --- Log message: Added "doc_class" div tags to code segments. --- Diffs of the changes: (+44 -17) FAQ.html | 61 ++++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 44 insertions(+), 17 deletions(-) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.42 llvm/docs/FAQ.html:1.43 --- llvm/docs/FAQ.html:1.42 Wed Feb 14 01:40:16 2007 +++ llvm/docs/FAQ.html Tue May 29 04:24:33 2007 @@ -311,11 +311,20 @@

For example, if you built LLVM with the command:

-

gmake ENABLE_PROFILING=1 +

+
+% gmake ENABLE_PROFILING=1
+
+

...then you must run the tests with the following commands:

-

cd llvm/test
gmake ENABLE_PROFILING=1

+
+
+% cd llvm/test
+% gmake ENABLE_PROFILING=1
+
+
@@ -354,11 +363,11 @@

If the error is of the form:

- +
 gmake[2]: *** No rule to make target `/path/to/somefile', needed by
 `/path/to/another/file.d'.
Stop. -
+

This may occur anytime files are moved within the CVS repository or removed @@ -471,11 +480,14 @@

The only way this can happen is if you haven't installed the runtime library. To correct this, do:

+ +
-  % cd llvm/runtime
-  % make clean ; make install-bytecode
+% cd llvm/runtime
+% make clean ; make install-bytecode
 
+

@@ -512,14 +524,20 @@

  1. Compile your program as normal with llvm-g++:

  2. -
    $ llvm-g++ x.cpp -o program
    +
    +
    +% llvm-g++ x.cpp -o program
    +
    +

    or:

    - llvm-g++ a.cpp -c
    - llvm-g++ b.cpp -c
    - llvm-g++ a.o b.o -o program +
    +% llvm-g++ a.cpp -c
    +% llvm-g++ b.cpp -c
    +% llvm-g++ a.o b.o -o program
    +

    With llvm-gcc3, this will generate program and program.bc. The .bc file is @@ -528,11 +546,19 @@

  3. Convert the LLVM code to C code, using the LLC tool with the C backend:

  4. -
    $ llc -march=c program.bc -o program.c
    +
    +
    +% llc -march=c program.bc -o program.c
    +
    +
  5. Finally, compile the c file:

  6. -
    $ cc x.c
    +
    +
    +% cc x.c
    +
    +
@@ -650,12 +676,13 @@ variable before you use it. For example, the C function:

- int X() { int i; return i; } +
+int X() { int i; return i; }
+
-

Is compiled to "ret int undef" because "i" never has a value -specified for it. -

+

Is compiled to "ret i32 undef" because "i" never has +a value specified for it.

@@ -668,7 +695,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
- Last modified: $Date: 2007/02/14 07:40:16 $ + Last modified: $Date: 2007/05/29 09:24:33 $ From isanbard at gmail.com Tue May 29 04:05:13 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 29 May 2007 04:05:13 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200705290905.l4T95DSt022193@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.246 -> 1.247 --- Log message: Fix for PR1452: http://llvm.org/PR1452 . Removed "define" keyword from the C code. Added "
" to code examples. --- Diffs of the changes: (+85 -45) LangRef.html | 130 ++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 85 insertions(+), 45 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.246 llvm/docs/LangRef.html:1.247 --- llvm/docs/LangRef.html:1.246 Thu May 24 14:13:27 2007 +++ llvm/docs/LangRef.html Tue May 29 04:04:49 2007 @@ -252,9 +252,11 @@ accepts and what is considered 'well formed'. For example, the following instruction is syntactically okay, but not well formed:

+
-  %x = add i32 1, %x
+%x = add i32 1, %x
 
+

...because the definition of %x does not dominate all of its uses. The LLVM infrastructure provides a verification pass that may @@ -263,6 +265,7 @@ the optimizer before it outputs bytecode. The violations pointed out by the verifier pass indicate bugs in transformation passes or input to the parser.

+
@@ -310,23 +313,29 @@

The easy way:

+
-  %result = mul i32 %X, 8
+%result = mul i32 %X, 8
 
+

After strength reduction:

+
-  %result = shl i32 %X, i8 3
+%result = shl i32 %X, i8 3
 
+

And the hard way:

+
-  add i32 %X, %X           ; yields {i32}:%0
-  add i32 %0, %0           ; yields {i32}:%1
-  %result = add i32 %1, %1
+add i32 %X, %X           ; yields {i32}:%0
+add i32 %0, %0           ; yields {i32}:%1
+%result = add i32 %1, %1
 
+

This last way of multiplying %X by 8 illustrates several important lexical features of LLVM:

@@ -367,6 +376,7 @@ global variable) definitions, resolves forward declarations, and merges symbol table entries. Here is an example of the "hello world" module:

+
; Declare the string constant as a global constant...
 %.LC0 = internal constant [13 x i8 ] c"hello world\0A\00"          ; [13 x i8 ]*
@@ -384,7 +394,9 @@
         call i32 %puts(i8 * %cast210)                              ; i32
         ret i32 0
}
+ href="#i_ret">ret i32 0
}
+ +

This example is made up of a global variable named ".LC0", an external declaration of the "puts" @@ -647,9 +659,11 @@

For example, the following defines a global with an initializer, section, and alignment:

+
-  %G = constant float 1.0, section "foo", align 4
+%G = constant float 1.0, section "foo", align 4
 
+
@@ -719,9 +733,11 @@
Syntax:
+
-    @<Name> = [Linkage] [Visibility] alias <AliaseeTy> @<Aliasee>
+@<Name> = [Linkage] [Visibility] alias <AliaseeTy> @<Aliasee>
   
+
@@ -739,9 +755,15 @@

Parameter attributes are simple keywords that follow the type specified. If multiple parameter attributes are needed, they are space separated. For - example:

-    %someFunc = i16 (i8 sext %someParam) zext
-    %someFunc = i16 (i8 zext %someParam) zext
+ example:

+ +
+
+%someFunc = i16 (i8 sext %someParam) zext
+%someFunc = i16 (i8 zext %someParam) zext
+
+
+

Note that the two function types above are unique because the parameter has a different attribute (sext in the first one, zext in the second). Also note that the attribute for the function result (zext) comes immediately after the @@ -787,10 +809,12 @@ desired. The syntax is very simple:

-
-  module asm "inline asm code goes here"
-  module asm "more can go here"
-
+
+
+module asm "inline asm code goes here"
+module asm "more can go here"
+
+

The strings can contain any character by escaping non-printable characters. The escape sequence used is simply "\xx" where "xx" is the two digit hex code @@ -1015,6 +1039,7 @@ +

@@ -1398,11 +1423,13 @@ href="#t_pointer">pointer type. For example, the following is a legal LLVM file:

+
-  %X = global i32 17
-  %Y = global i32 42
-  %Z = global [2 x i32*] [ i32* %X, i32* %Y ]
+%X = global i32 17
+%Y = global i32 42
+%Z = global [2 x i32*] [ i32* %X, i32* %Y ]
 
+
@@ -1556,18 +1583,22 @@ inline assembler expression is:

+
-  i32 (i32) asm "bswap $0", "=r,r"
+i32 (i32) asm "bswap $0", "=r,r"
 
+

Inline assembler expressions may only be used as the callee operand of a call instruction. Thus, typically we have:

+
-  %X = call i32 asm "bswap $0", "=r,r"(i32 %Y)
+%X = call i32 asm "bswap $0", "=r,r"(i32 %Y)
 
+

Inline asms with side effects not visible in the constraint list must be marked @@ -1575,9 +1606,11 @@ 'sideeffect' keyword, like so:

+
-  call void asm sideeffect "eieio", ""()
+call void asm sideeffect "eieio", ""()
 
+

TODO: The format of the asm and constraints string still need to be documented here. Constraints on what can be done (e.g. duplication, moving, etc @@ -2663,8 +2696,8 @@

   %ptr = alloca i32                              ; yields {i32*}:ptr
-  %ptr = alloca i32, i32 4                      ; yields {i32*}:ptr
-  %ptr = alloca i32, i32 4, align 1024          ; yields {i32*}:ptr
+  %ptr = alloca i32, i32 4                       ; yields {i32*}:ptr
+  %ptr = alloca i32, i32 4, align 1024           ; yields {i32*}:ptr
   %ptr = alloca i32, align 1024                  ; yields {i32*}:ptr
 
@@ -2754,35 +2787,39 @@

For example, let's consider a C code fragment and how it gets compiled to LLVM:

+
-  struct RT {
-    char A;
-    i32 B[10][20];
-    char C;
-  };
-  struct ST {
-    i32 X;
-    double Y;
-    struct RT Z;
-  };
+struct RT {
+  char A;
+  i32 B[10][20];
+  char C;
+};
+struct ST {
+  i32 X;
+  double Y;
+  struct RT Z;
+};
 
-  define i32 *foo(struct ST *s) {
-    return &s[1].Z.B[5][13];
-  }
+i32 *foo(struct ST *s) {
+  return &s[1].Z.B[5][13];
+}
 
+

The LLVM code generated by the GCC frontend is:

+
-  %RT = type { i8 , [10 x [20 x i32]], i8  }
-  %ST = type { i32, double, %RT }
+%RT = type { i8 , [10 x [20 x i32]], i8  }
+%ST = type { i32, double, %RT }
 
-  define i32* %foo(%ST* %s) {
-  entry:
-    %reg = getelementptr %ST* %s, i32 1, i32 2, i32 1, i32 5, i32 13
-    ret i32* %reg
-  }
+define i32* %foo(%ST* %s) {
+entry:
+  %reg = getelementptr %ST* %s, i32 1, i32 2, i32 1, i32 5, i32 13
+  ret i32* %reg
+}
 
+
Semantics:
@@ -3694,6 +3731,7 @@ instruction and the variable argument handling intrinsic functions are used.

+
 define i32 @test(i32 %X, ...) {
   ; Initialize variable argument processing
@@ -3721,6 +3759,8 @@
 
+ +
'llvm.va_start' Intrinsic @@ -4786,7 +4826,7 @@ Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2007/05/24 19:13:27 $ + Last modified: $Date: 2007/05/29 09:04:49 $ From isanbard at gmail.com Tue May 29 04:35:56 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 29 May 2007 04:35:56 -0500 Subject: [llvm-commits] CVS: llvm/docs/FAQ.html Message-ID: <200705290935.l4T9ZuuN022880@zion.cs.uiuc.edu> Changes in directory llvm/docs: FAQ.html updated: 1.43 -> 1.44 --- Log message: Added "llvmc" to the FAQ. --- Diffs of the changes: (+14 -2) FAQ.html | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) Index: llvm/docs/FAQ.html diff -u llvm/docs/FAQ.html:1.43 llvm/docs/FAQ.html:1.44 --- llvm/docs/FAQ.html:1.43 Tue May 29 04:24:33 2007 +++ llvm/docs/FAQ.html Tue May 29 04:35:34 2007 @@ -51,7 +51,9 @@
  • When I use the test suite, all of the C Backend tests fail. What is wrong?
  • After CVS update, rebuilding gives the error "No rule to make - target".
  • + target". +
  • The llvmc program gives me errors/doesn't + work.
  • Source Languages @@ -386,6 +388,16 @@ rebuilding.

  • + + +
    +

    llvmc is experimental and isn't really supported. We suggest + using llvm-gcc instead.

    +
    + @@ -695,7 +707,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2007/05/29 09:24:33 $ + Last modified: $Date: 2007/05/29 09:35:34 $ From isanbard at gmail.com Tue May 29 04:42:35 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 29 May 2007 04:42:35 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200705290942.l4T9gZoV023047@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.247 -> 1.248 --- Log message: Fixed some formatting. --- Diffs of the changes: (+10 -9) LangRef.html | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.247 llvm/docs/LangRef.html:1.248 --- llvm/docs/LangRef.html:1.247 Tue May 29 04:04:49 2007 +++ llvm/docs/LangRef.html Tue May 29 04:42:13 2007 @@ -734,9 +734,9 @@
    Syntax:
    -
    +
     @<Name> = [Linkage] [Visibility] alias <AliaseeTy> @<Aliasee>
    -  
    +
    @@ -1961,7 +1961,8 @@

    The value produced is the integer or floating point difference of the two operands.

    Example:
    -
      <result> = sub i32 4, %var          ; yields {i32}:result = 4 - %var
    +
    +  <result> = sub i32 4, %var          ; yields {i32}:result = 4 - %var
       <result> = sub i32 0, %val          ; yields {i32}:result = -%var
     
    @@ -2607,11 +2608,11 @@
       %array  = malloc [4 x i8 ]                    ; yields {[%4 x i8]*}:array
     
    -  %size   = add i32 2, 2                          ; yields {i32}:size = i32 4
    -  %array1 = malloc i8, i32 4                   ; yields {i8*}:array1
    -  %array2 = malloc [12 x i8], i32 %size        ; yields {[12 x i8]*}:array2
    -  %array3 = malloc i32, i32 4, align 1024         ; yields {i32*}:array3
    -  %array4 = malloc i32, align 1024                 ; yields {i32*}:array4
    +  %size   = add i32 2, 2                        ; yields {i32}:size = i32 4
    +  %array1 = malloc i8, i32 4                    ; yields {i8*}:array1
    +  %array2 = malloc [12 x i8], i32 %size         ; yields {[12 x i8]*}:array2
    +  %array3 = malloc i32, i32 4, align 1024       ; yields {i32*}:array3
    +  %array4 = malloc i32, align 1024              ; yields {i32*}:array4
     
    @@ -4826,7 +4827,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2007/05/29 09:04:49 $ + Last modified: $Date: 2007/05/29 09:42:13 $ From sabre at nondot.org Tue May 29 10:44:23 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 10:44:23 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200705291544.l4TFiNRU031208@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.248 -> 1.249 --- Log message: more fixes to C code. --- Diffs of the changes: (+4 -4) LangRef.html | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.248 llvm/docs/LangRef.html:1.249 --- llvm/docs/LangRef.html:1.248 Tue May 29 04:42:13 2007 +++ llvm/docs/LangRef.html Tue May 29 10:43:56 2007 @@ -2792,16 +2792,16 @@
     struct RT {
       char A;
    -  i32 B[10][20];
    +  int B[10][20];
       char C;
     };
     struct ST {
    -  i32 X;
    +  int X;
       double Y;
       struct RT Z;
     };
     
    -i32 *foo(struct ST *s) {
    +int *foo(struct ST *s) {
       return &s[1].Z.B[5][13];
     }
     
    @@ -4827,7 +4827,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2007/05/29 09:42:13 $ + Last modified: $Date: 2007/05/29 15:43:56 $ From sabre at nondot.org Tue May 29 11:01:23 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 11:01:23 -0500 Subject: [llvm-commits] CVS: llvm-www/releases/2.0/LICENSE.TXT Message-ID: <200705291601.l4TG1Nhq031641@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/2.0: LICENSE.TXT added (r1.1) --- Log message: Add missing file --- Diffs of the changes: (+69 -0) LICENSE.TXT | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 69 insertions(+) Index: llvm-www/releases/2.0/LICENSE.TXT diff -c /dev/null llvm-www/releases/2.0/LICENSE.TXT:1.1 *** /dev/null Tue May 29 11:01:08 2007 --- llvm-www/releases/2.0/LICENSE.TXT Tue May 29 11:00:58 2007 *************** *** 0 **** --- 1,69 ---- + ============================================================================== + LLVM Release License + ============================================================================== + University of Illinois/NCSA + Open Source License + + Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign. + All rights reserved. + + Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal with + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to do + so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE + SOFTWARE. + + ============================================================================== + Copyrights and Licenses for Third Party Software Distributed with LLVM: + ============================================================================== + The LLVM software contains code written by third parties. Such software will + have its own individual LICENSE.TXT file in the directory in which it appears. + This file will describe the copyrights, license, and restrictions which apply + to that code. + + The disclaimer of warranty in the University of Illinois Open Source License + applies to all code in the LLVM Distribution, and nothing in any of the + other licenses gives permission to use the names of the LLVM Team or the + University of Illinois to endorse or promote products derived from this + Software. + + The following pieces of software have additional or alternate copyrights, + licenses, and/or restrictions: + + Program Directory + ------- --------- + System Library llvm/lib/System + Compiler Driver llvm/tools/llvmc + Autoconf llvm/autoconf + llvm/projects/ModuleMaker/autoconf + llvm/projects/sample/autoconf + GNU Libc llvm/runtime/GCCLibraries/libc From clattner at apple.com Tue May 29 11:02:55 2007 From: clattner at apple.com (clattner at apple.com) Date: Tue, 29 May 2007 09:02:55 -0700 (PDT) Subject: [llvm-commits] [127793] Improve EH generation, patch by Duncan! Message-ID: <20070529160255.75A5656B27D4@src> Revision: 127793 Author: clattner Date: 2007-05-29 09:02:55 -0700 (Tue, 29 May 2007) Log Message: ----------- Improve EH generation, patch by Duncan! Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-29 09:03:03 UTC (rev 127792) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-29 16:02:55 UTC (rev 127793) @@ -1940,7 +1940,13 @@ break; } } - + + CreateExceptionValues(); + + // Fetch and store the exception. + Value *Ex = Builder.CreateCall(FuncEHException, "eh_ptr"); + Builder.CreateStore(Ex, ExceptionValue); + if (!TryCatch) return; // Gather the typeinfo. @@ -1948,8 +1954,6 @@ tree Catches = TREE_OPERAND(TryCatch, 1); GatherTypeInfo(Catches, TypeInfos); - CreateExceptionValues(); - // Choose type of landing pad type. Function *F = FuncEHSelector; @@ -1959,10 +1963,6 @@ F = FuncEHFilter; } - // Fetch and store the exception. - Value *Ex = Builder.CreateCall(FuncEHException, "eh_ptr"); - Builder.CreateStore(Ex, ExceptionValue); - // Fetch and store exception handler. std::vector Args; Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr")); From lattner at cs.uiuc.edu Tue May 29 11:13:58 2007 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 May 2007 11:13:58 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/ Message-ID: <200705291613.l4TGDwnR031998@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg: --- Log message: Directory /var/cvs/llvm/llvm-www/devmtg added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From lattner at cs.uiuc.edu Tue May 29 11:14:13 2007 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 29 May 2007 11:14:13 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/ Message-ID: <200705291614.l4TGEDN8032046@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: --- Log message: Directory /var/cvs/llvm/llvm-www/devmtg/2007-05 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From nicolas.geoffray at lip6.fr Tue May 29 11:33:41 2007 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 29 May 2007 11:33:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp Message-ID: <200705291633.l4TGXfpF032547@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.37 -> 1.38 --- Log message: Implementation of compilation callback in PPC ELF32 --- Diffs of the changes: (+32 -31) PPCJITInfo.cpp | 63 ++++++++++++++++++++++++++++----------------------------- 1 files changed, 32 insertions(+), 31 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.37 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.38 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.37 Sat Feb 24 23:04:13 2007 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Tue May 29 11:33:18 2007 @@ -14,6 +14,7 @@ #define DEBUG_TYPE "jit" #include "PPCJITInfo.h" #include "PPCRelocations.h" +#include "PPCTargetMachine.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/Config/alloca.h" #include "llvm/Support/Debug.h" @@ -147,56 +148,52 @@ ".align 2\n" ".globl PPC32CompilationCallback\n" "PPC32CompilationCallback:\n" - // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the + // Make space for 8 ints r[3-10] and 8 doubles f[1-8] and the // FIXME: need to save v[0-19] for altivec? // FIXME: could shrink frame // Set up a proper stack frame // FIXME Layout - // PowerPC64 ABI linkage - 24 bytes - // parameters - 32 bytes - // 13 double registers - 104 bytes + // 8 double registers - 64 bytes // 8 int registers - 32 bytes "mflr 0\n" "stw 0, 4(1)\n" - "stwu 1, -180(1)\n" + "stwu 1, -104(1)\n" // Save all int arg registers - "stw 10, 176(1)\n" "stw 9, 172(1)\n" - "stw 8, 168(1)\n" "stw 7, 164(1)\n" - "stw 6, 160(1)\n" "stw 5, 156(1)\n" - "stw 4, 152(1)\n" "stw 3, 148(1)\n" + "stw 10, 100(1)\n" "stw 9, 96(1)\n" + "stw 8, 92(1)\n" "stw 7, 88(1)\n" + "stw 6, 84(1)\n" "stw 5, 80(1)\n" + "stw 4, 76(1)\n" "stw 3, 72(1)\n" // Save all call-clobbered FP regs. - "stfd 10, 144(1)\n" - "stfd 9, 136(1)\n" "stfd 8, 128(1)\n" - "stfd 7, 120(1)\n" "stfd 6, 112(1)\n" - "stfd 5, 104(1)\n" "stfd 4, 96(1)\n" - "stfd 3, 88(1)\n" "stfd 2, 80(1)\n" - "stfd 1, 72(1)\n" + "stfd 8, 64(1)\n" + "stfd 7, 56(1)\n" "stfd 6, 48(1)\n" + "stfd 5, 40(1)\n" "stfd 4, 32(1)\n" + "stfd 3, 24(1)\n" "stfd 2, 16(1)\n" + "stfd 1, 8(1)\n" // Arguments to Compilation Callback: // r3 - our lr (address of the call instruction in stub plus 4) // r4 - stub's lr (address of instruction that called the stub plus 4) // r5 - is64Bit - always 0. "mr 3, 0\n" - "lwz 11, 180(1)\n" // stub's frame - "lwz 4, 4(11)\n" // stub's lr + "lwz 5, 104(1)\n" // stub's frame + "lwz 4, 4(5)\n" // stub's lr "li 5, 0\n" // 0 == 32 bit "bl PPCCompilationCallbackC\n" "mtctr 3\n" // Restore all int arg registers - "lwz 10, 176(1)\n" "lwz 9, 172(1)\n" - "lwz 8, 168(1)\n" "lwz 7, 164(1)\n" - "lwz 6, 160(1)\n" "lwz 5, 156(1)\n" - "lwz 4, 152(1)\n" "lwz 3, 148(1)\n" + "lwz 10, 100(1)\n" "lwz 9, 96(1)\n" + "lwz 8, 92(1)\n" "lwz 7, 88(1)\n" + "lwz 6, 84(1)\n" "lwz 5, 80(1)\n" + "lwz 4, 76(1)\n" "lwz 3, 72(1)\n" // Restore all FP arg registers - "lfd 10, 144(1)\n" - "lfd 9, 136(1)\n" "lfd 8, 128(1)\n" - "lfd 7, 120(1)\n" "lfd 6, 112(1)\n" - "lfd 5, 104(1)\n" "lfd 4, 96(1)\n" - "lfd 3, 88(1)\n" "lfd 2, 80(1)\n" - "lfd 1, 72(1)\n" + "lfd 8, 64(1)\n" + "lfd 7, 56(1)\n" "lfd 6, 48(1)\n" + "lfd 5, 40(1)\n" "lfd 4, 32(1)\n" + "lfd 3, 24(1)\n" "lfd 2, 16(1)\n" + "lfd 1, 8(1)\n" // Pop 3 frames off the stack and branch to target - "lwz 1, 184(1)\n" - "lwz 11, 4(1)\n" - "mtlr 11\n" + "lwz 1, 104(1)\n" + "lwz 0, 4(1)\n" + "mtlr 0\n" "bctr\n" ); #else @@ -350,10 +347,14 @@ MCE.emitWordBE(0xf821ffb1); // stdu r1,-80(r1) MCE.emitWordBE(0x7d6802a6); // mflr r11 MCE.emitWordBE(0xf9610060); // std r11, 96(r1) - } else { + } else if (TM.getSubtargetImpl()->isMachoABI()){ MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) MCE.emitWordBE(0x7d6802a6); // mflr r11 MCE.emitWordBE(0x91610028); // stw r11, 40(r1) + } else { + MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) + MCE.emitWordBE(0x7d6802a6); // mflr r11 + MCE.emitWordBE(0x91610024); // stw r11, 36(r1) } intptr_t Addr = (intptr_t)MCE.getCurrentPCValue(); MCE.emitWordBE(0); From sabre at nondot.org Tue May 29 11:57:44 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 11:57:44 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/09-Naroff-CFE.pdf index.html Message-ID: <200705291657.l4TGviPr000705@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: 09-Naroff-CFE.pdf added (r1.1) index.html added (r1.1) --- Log message: first hack at proceedings for the dev mtg, with videos! --- Diffs of the changes: (+246 -0) 09-Naroff-CFE.pdf | 0 index.html | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 246 insertions(+) Index: llvm-www/devmtg/2007-05/09-Naroff-CFE.pdf Index: llvm-www/devmtg/2007-05/index.html diff -c /dev/null llvm-www/devmtg/2007-05/index.html:1.1 *** /dev/null Tue May 29 11:57:44 2007 --- llvm-www/devmtg/2007-05/index.html Tue May 29 11:57:20 2007 *************** *** 0 **** --- 1,246 ---- + + + + +
    May 25, 2007
    LLVM Developers' + Meeting Proceedings
    + +
      +
    1. Summary +
    2. Agenda +
        +
      1. Session 0: LLVM History
      2. +
      3. Session 1: Introductions
      4. +
      5. Session 2: Learning LLVM
      6. +
      7. Session 3: Using LLVM
      8. +
      9. Session 4: Improving LLVM
      10. +
      11. Discussion Topics Submitted
      12. +
    3. +
    4. Attendees
    5. +
    + + +
    +

    Someone write a blurb here. ~60 people attended.

    +
    + + + + + +
    +

    All videos are presented in QuickTime format, all slides are in PDF + format.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    EventMediaWhoDescription

    Session 0:
    Introductions

    videoVikram Adve
    Chris Lattner
    A brief history of LLVM - During this brief session, Vikram and + Chris (the originators of LLVM) presented a brief history of the early + history of LLVM.
    videoEveryoneIntroductions - Everyone introduced themselves to the group. +

    Break

    Session 1:
    Learning LLVM

    MediaSpeakerDescription
    videoDevang PatelDemystifying The LLVM Pass Manager - The PassManager, which + manages the execution of all LLVM passes, was recently revised to be + simpler and more useful. This talk will help you understand what the new + pass manager does and how to use it.
    videoEvan ChengThe LLVM Code Generator - An overview of the LLVM generic code + generator design and changes to it that are coming in the future.
    videoNick LewyckyIntroduction To Predicate Simplifier - A review of the design + and implementation of LLVM's Predicate Simplifier Pass, otherwise known + as VRP (Value Range Propagation). +
    videoReid SpencerHLVM - An overview of HLVM, its current + status and its goals after integration with LLVM.

    Lunch

    Session 2:
    Using LLVM

    MediaSpeakerDescription
    todoScott MichelThe Cell BE Symbiotic Processor Element Backend - A presentation + of the practice and experience that resulted from Aerospace's + implementation of an LLVM back-end Target for the Cell BE Symbiotic + Processor Element.
    videoJohn CriswellSecure Virtual Architecture - A presentation on our research to + create a virtual machine that operates below the operating system and a + brief introduction to some of the novel security capabilities that our + architecture can enable.
    slides
    + video + +
    Steve NaroffNew LLVM C Front-end - This talk describes a new from-scratch + C frontend (which is aiming to support Objective C and C++ someday) + for LLVM, built as a native part of the LLVM system and in the LLVM + design style.
    videoChris LattnerLLVM in OpenGL and for Dynamic Languages - A presentation put + together in 10 minutes, talking about LLVM being used for OpenGL and some + speculative talk about dynamic languages.

    Break

    Session 3:
    Discussions

    MediaLeaderDiscussion Topic
    videoChristopher LambConcurrency Primitives - For multi-threaded shared memory + models.
    videoReid SpencerLLVM Roadmap - Does the development community care to disclose + and maintain advance information about what is being worked on?
    videoChris LattnerAdoption Goals - While our adoption has increased greatly + recently, we're still tiny compared to other compiler and virtual + machine systems.
    videoReid Spencer
    Chris Lattner
    Project Management, License, Naming
    videoChris LattnerFeedback on the Meeting
    +
    + + + + +
    +

    The table below lists the confirmed attendees for the meeting.

    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Confirmed Attendees
    NameOrganization
    Vikram AdveUIUC
    Bob ArcherAdobe Systems Incorporated.
    Owen AndersonIndependent
    Ryan BrownGoogle
    Evan ChengApple Inc.
    Josh ConnerApple Inc.
    John CriswellUIUC
    Kat DanielsonApple Inc.
    Mike EnglerAdobe Systems Incorporated.
    Rafael EspíndolaGoogle
    Tomas EvensenWind River
    Samuel FigueroaApple Inc.
    Han GaoAdobe Systems Incorporated.
    Dan GohmanCray Inc.
    Lang HamesUniversity of Sydney
    Stuart HastingsApple Inc.
    Victor HernandezApple Inc.
    Robert HundtGoogle
    Dale JohannesenApple Inc.
    Ted KremenekIndependent
    Christopher LambAgeia Technologies, Inc.
    Chris LattnerApple Inc.
    Tanya LattnerIndependent
    Andrew LenharthUIUC
    Julien LerougeApple Inc.
    Nick LewyckyIndependent
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Confirmed Attendees
    NameOrganization
    Efrem LipkinCoDesign
    Gabe McArthurIndependent
    Paul McJonesAdobe Systems Incorporated.
    Scott MichelAerospace
    Dan MonizMatasano
    Alireza MoshtaghiMicrochip Technology
    Lakshmankumar MukkavilliCisco Systems
    Robert MyklandAscenium Corp.
    Steve NaroffApple Inc.
    Devang PatelApple Inc.
    Fernando Magno Quintao PereiraUCLA
    Jeff PoznanovicCray Inc.
    Ron PriceApple Inc.
    Chuck RoseAdobe Systems Incorporated.
    Mark SchimmelWind River
    Reid SpencerIndependent
    Raju SubbianWind River
    Mark ThomasAerospace
    Sarah ThompsonNASA, Ames Research Center
    Andrew TrickHP
    Bill WendlingApple Inc.
    Marcel WeiherMetaObject
    James WeisnerAscenium Corp.
    Calum WilkieMicrochip Technology
    Scott WilliamsGoogle
    +
    +

    Total confirmed: 51

    + + + + + + +
    Unconfirmed Attendees
    NameOrganization
    Michael McCrackenUCSD, Ph.D. Candidate
    Kelly WilsonUniversity of Calgary
    Unconfirmed 1NASA, Ames
    +

    Total unconfirmed: 3

    +
    + + +
    +
    + Valid CSS! + Valid HTML 4.01! +
    Last modified: $Date: 2007/05/29 16:57:20 $ +
    + From sabre at nondot.org Tue May 29 11:59:50 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 11:59:50 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/index.html Message-ID: <200705291659.l4TGxo5W000789@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: index.html updated: 1.1 -> 1.2 --- Log message: fix path --- Diffs of the changes: (+3 -3) index.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.1 llvm-www/devmtg/2007-05/index.html:1.2 --- llvm-www/devmtg/2007-05/index.html:1.1 Tue May 29 11:57:20 2007 +++ llvm-www/devmtg/2007-05/index.html Tue May 29 11:59:27 2007 @@ -50,7 +50,7 @@ video - Everyone + Everyone Introductions - Everyone introduced themselves to the group. @@ -241,6 +241,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/29 16:57:20 $ +
    Last modified: $Date: 2007/05/29 16:59:27 $ - + From sabre at nondot.org Tue May 29 12:03:01 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 12:03:01 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/index.html Message-ID: <200705291703.l4TH31P6000902@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: index.html updated: 1.2 -> 1.3 --- Log message: remove toc. --- Diffs of the changes: (+1 -16) index.html | 17 +---------------- 1 files changed, 1 insertion(+), 16 deletions(-) Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.2 llvm-www/devmtg/2007-05/index.html:1.3 --- llvm-www/devmtg/2007-05/index.html:1.2 Tue May 29 11:59:27 2007 +++ llvm-www/devmtg/2007-05/index.html Tue May 29 12:02:39 2007 @@ -9,21 +9,6 @@
    May 25, 2007
    LLVM Developers' Meeting Proceedings
    -
      -
    1. Summary -
    2. Agenda -
        -
      1. Session 0: LLVM History
      2. -
      3. Session 1: Introductions
      4. -
      5. Session 2: Learning LLVM
      6. -
      7. Session 3: Using LLVM
      8. -
      9. Session 4: Improving LLVM
      10. -
      11. Discussion Topics Submitted
      12. -
    3. -
    4. Attendees
    5. -
    - -

    Someone write a blurb here. ~60 people attended.

    @@ -241,6 +226,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/29 16:59:27 $ +
    Last modified: $Date: 2007/05/29 17:02:39 $ From evan.cheng at apple.com Tue May 29 13:31:19 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 13:31:19 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200705291831.l4TIVJV9002981@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.124 -> 1.125 --- Log message: Add missing const qualifiers. --- Diffs of the changes: (+7 -5) TargetInstrInfo.h | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.124 llvm/include/llvm/Target/TargetInstrInfo.h:1.125 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.124 Wed May 23 02:19:12 2007 +++ llvm/include/llvm/Target/TargetInstrInfo.h Tue May 29 13:30:54 2007 @@ -395,19 +395,21 @@ /// isPredicable - Returns true if the instruction is already predicated. /// - virtual bool isPredicated(MachineInstr *MI) const { + virtual bool isPredicated(const MachineInstr *MI) const { return false; } /// PredicateInstruction - Convert the instruction into a predicated /// instruction. It returns true if the operation was successful. - virtual bool PredicateInstruction(MachineInstr *MI, - std::vector &Pred) const; + virtual + bool PredicateInstruction(MachineInstr *MI, + const std::vector &Pred) const; /// SubsumesPredicate - Returns true if the first specified predicated /// subsumes the second, e.g. GE subsumes GT. - virtual bool SubsumesPredicate(std::vector &Pred1, - std::vector &Pred2) const { + virtual + bool SubsumesPredicate(const std::vector &Pred1, + const std::vector &Pred2) const { return false; } From evan.cheng at apple.com Tue May 29 13:31:23 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 13:31:23 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200705291831.l4TIVNxX002986@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.220 -> 1.221 --- Log message: Add missing const qualifiers. --- Diffs of the changes: (+5 -4) MachineInstr.h | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.220 llvm/include/llvm/CodeGen/MachineInstr.h:1.221 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.220 Wed May 16 15:43:42 2007 +++ llvm/include/llvm/CodeGen/MachineInstr.h Tue May 29 13:30:54 2007 @@ -415,15 +415,16 @@ /// findRegisterUseOperandIdx() - Returns the operand index that is a use of /// the specific register or -1 if it is not found. It further tightening /// the search criteria to a use that kills the register if isKill is true. - int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false); + int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false) const; /// findRegisterDefOperand() - Returns the MachineOperand that is a def of /// the specific register or NULL if it is not found. MachineOperand *findRegisterDefOperand(unsigned Reg); - /// findFirstPredOperand() - Find the first operand in the operand list that - // is used to represent the predicate. - MachineOperand *findFirstPredOperand(); + /// findFirstPredOperandIdx() - Find the index of the first operand in the + /// operand list that is used to represent the predicate. It returns -1 if + /// none is found. + int findFirstPredOperandIdx() const; /// copyKillDeadInfo - Copies kill / dead operand properties from MI. /// From evan.cheng at apple.com Tue May 29 13:33:34 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 13:33:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp Message-ID: <200705291833.l4TIXYvo003046@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineInstr.cpp updated: 1.150 -> 1.151 --- Log message: Add missing const qualifiers. --- Diffs of the changes: (+8 -7) MachineInstr.cpp | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.150 llvm/lib/CodeGen/MachineInstr.cpp:1.151 --- llvm/lib/CodeGen/MachineInstr.cpp:1.150 Wed May 16 15:55:34 2007 +++ llvm/lib/CodeGen/MachineInstr.cpp Tue May 29 13:33:12 2007 @@ -191,9 +191,9 @@ /// findRegisterUseOperandIdx() - Returns the MachineOperand that is a use of /// the specific register or -1 if it is not found. It further tightening /// the search criteria to a use that kills the register if isKill is true. -int MachineInstr::findRegisterUseOperandIdx(unsigned Reg, bool isKill) { +int MachineInstr::findRegisterUseOperandIdx(unsigned Reg, bool isKill) const { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { - MachineOperand &MO = getOperand(i); + const MachineOperand &MO = getOperand(i); if (MO.isReg() && MO.isUse() && MO.getReg() == Reg) if (!isKill || MO.isKill()) return i; @@ -212,17 +212,18 @@ return NULL; } -/// findFirstPredOperand() - Find the first operand in the operand list that -// is used to represent the predicate. -MachineOperand *MachineInstr::findFirstPredOperand() { +/// findFirstPredOperandIdx() - Find the index of the first operand in the +/// operand list that is used to represent the predicate. It returns -1 if +/// none is found. +int MachineInstr::findFirstPredOperandIdx() const { const TargetInstrDescriptor *TID = getInstrDescriptor(); if (TID->Flags & M_PREDICABLE) { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND)) - return &getOperand(i); + return i; } - return NULL; + return -1; } /// copyKillDeadInfo - Copies kill / dead operand properties from MI. From evan.cheng at apple.com Tue May 29 13:35:48 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 13:35:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetInstrInfo.cpp Message-ID: <200705291835.l4TIZm24003104@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetInstrInfo.cpp updated: 1.31 -> 1.32 --- Log message: Add missing const qualifiers. --- Diffs of the changes: (+1 -1) TargetInstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/TargetInstrInfo.cpp diff -u llvm/lib/Target/TargetInstrInfo.cpp:1.31 llvm/lib/Target/TargetInstrInfo.cpp:1.32 --- llvm/lib/Target/TargetInstrInfo.cpp:1.31 Wed May 23 02:21:11 2007 +++ llvm/lib/Target/TargetInstrInfo.cpp Tue May 29 13:35:22 2007 @@ -61,7 +61,7 @@ } bool TargetInstrInfo::PredicateInstruction(MachineInstr *MI, - std::vector &Pred) const { + const std::vector &Pred) const { bool MadeChange = false; const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); if (TID->Flags & M_PREDICABLE) { From evan.cheng at apple.com Tue May 29 13:42:45 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 13:42:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.cpp ARMInstrInfo.h ARMLoadStoreOptimizer.cpp ARMRegisterInfo.cpp Message-ID: <200705291842.l4TIgjtS003265@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.cpp updated: 1.31 -> 1.32 ARMInstrInfo.h updated: 1.12 -> 1.13 ARMLoadStoreOptimizer.cpp updated: 1.12 -> 1.13 ARMRegisterInfo.cpp updated: 1.96 -> 1.97 --- Log message: Add missing const qualifiers. --- Diffs of the changes: (+24 -19) ARMInstrInfo.cpp | 20 +++++++++++--------- ARMInstrInfo.h | 12 +++++++----- ARMLoadStoreOptimizer.cpp | 5 +++-- ARMRegisterInfo.cpp | 6 +++--- 4 files changed, 24 insertions(+), 19 deletions(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.cpp diff -u llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.31 llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.32 --- llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.31 Wed May 23 02:22:05 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.cpp Tue May 29 13:42:18 2007 @@ -431,13 +431,13 @@ return false; } -bool ARMInstrInfo::isPredicated(MachineInstr *MI) const { - MachineOperand *PMO = MI->findFirstPredOperand(); - return PMO && PMO->getImmedValue() != ARMCC::AL; +bool ARMInstrInfo::isPredicated(const MachineInstr *MI) const { + int PIdx = MI->findFirstPredOperandIdx(); + return PIdx != -1 && MI->getOperand(PIdx).getImmedValue() != ARMCC::AL; } bool ARMInstrInfo::PredicateInstruction(MachineInstr *MI, - std::vector &Pred) const { + const std::vector &Pred) const { unsigned Opc = MI->getOpcode(); if (Opc == ARM::B || Opc == ARM::tB) { MI->setInstrDescriptor(get(Opc == ARM::B ? ARM::Bcc : ARM::tBcc)); @@ -445,16 +445,18 @@ return true; } - MachineOperand *PMO = MI->findFirstPredOperand(); - if (PMO) { - PMO->setImm(Pred[0].getImmedValue()); + int PIdx = MI->findFirstPredOperandIdx(); + if (PIdx != -1) { + MachineOperand &PMO = MI->getOperand(PIdx); + PMO.setImm(Pred[0].getImmedValue()); return true; } return false; } -bool ARMInstrInfo::SubsumesPredicate(std::vector &Pred1, - std::vector &Pred2) const{ +bool +ARMInstrInfo::SubsumesPredicate(const std::vector &Pred1, + const std::vector &Pred2) const{ if (Pred1.size() > 1 || Pred2.size() > 1) return false; Index: llvm/lib/Target/ARM/ARMInstrInfo.h diff -u llvm/lib/Target/ARM/ARMInstrInfo.h:1.12 llvm/lib/Target/ARM/ARMInstrInfo.h:1.13 --- llvm/lib/Target/ARM/ARMInstrInfo.h:1.12 Wed May 23 02:22:05 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.h Tue May 29 13:42:18 2007 @@ -104,13 +104,15 @@ virtual bool ReverseBranchCondition(std::vector &Cond) const; // Predication support. - virtual bool isPredicated(MachineInstr *MI) const; + virtual bool isPredicated(const MachineInstr *MI) const; - virtual bool PredicateInstruction(MachineInstr *MI, - std::vector &Pred) const; + virtual + bool PredicateInstruction(MachineInstr *MI, + const std::vector &Pred) const; - virtual bool SubsumesPredicate(std::vector &Pred1, - std::vector &Pred1) const; + virtual + bool SubsumesPredicate(const std::vector &Pred1, + const std::vector &Pred1) const; }; // Utility routines Index: llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp diff -u llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp:1.12 llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp:1.13 --- llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp:1.12 Mon May 14 20:29:07 2007 +++ llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Tue May 29 13:42:18 2007 @@ -245,8 +245,9 @@ /// getInstrPredicate - If instruction is predicated, returns its predicate /// condition, otherwise returns AL. static ARMCC::CondCodes getInstrPredicate(MachineInstr *MI) { - MachineOperand *PredMO = MI->findFirstPredOperand(); - return PredMO ? (ARMCC::CondCodes)PredMO->getImmedValue() : ARMCC::AL; + int PIdx = MI->findFirstPredOperandIdx(); + return PIdx == -1 ? ARMCC::AL + : (ARMCC::CondCodes)MI->getOperand(PIdx).getImmedValue(); } static inline bool isMatchingDecrement(MachineInstr *MI, unsigned Base, Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.96 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.97 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.96 Mon May 14 20:29:07 2007 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Tue May 29 13:42:18 2007 @@ -1009,9 +1009,9 @@ if (ScratchReg == 0) // No register is "free". Scavenge a register. ScratchReg = RS->scavengeRegister(&ARM::GPRRegClass, II, SPAdj); - MachineOperand *MO = MI.findFirstPredOperand(); - ARMCC::CondCodes Pred = MO ? - (ARMCC::CondCodes)MO->getImmedValue() : ARMCC::AL; + int PIdx = MI.findFirstPredOperandIdx(); + ARMCC::CondCodes Pred = (PIdx == -1) + ? ARMCC::AL : (ARMCC::CondCodes)MI.getOperand(PIdx).getImmedValue(); emitARMRegPlusImmediate(MBB, II, ScratchReg, FrameReg, Pred, isSub ? -Offset : Offset, TII); MI.getOperand(i).ChangeToRegister(ScratchReg, false, false, true); From evan.cheng at apple.com Tue May 29 14:11:22 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 12:11:22 -0700 Subject: [llvm-commits] initial mips support! In-Reply-To: <275e64e40705211914g8cd6283q6c20f93c455e3f98@mail.gmail.com> References: <275e64e40705211914g8cd6283q6c20f93c455e3f98@mail.gmail.com> Message-ID: Hi, I know nothing about MIPs so I only do some nitpicking. Please fix them and then re-submit: 1. isMoveInstr(): // addiu $n, $n, 0 if (MI.getOpcode() == Mips::ADDiu) { if ((MI.getOperand(1).isRegister()) && (isZeroImm(MI.getOperand(2)))) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(2).getReg(); <=== Is this right? Should it be getOperand(1)? return true; } } 2. isMoveInstrt(), isLoadFromStackSlot(), etc.: Please fix the indentation problems. 3. InsertBranch(): Please don't leave code that's commented out in, 4. MipsISelDAGToDAG.cpp. Please don't include header files that are not needed, e.g. MathExtras.h, SSARegMap.h Also public: MipsDAGToDAGISel(MipsTargetMachine &tm) : SelectionDAGISel(MipsLowering), TM(tm), MipsLowering(*TM.getTargetLowering()) {} //,Subtarget(&TM.getSubtarget()) {} <== Plz remove code that's commented out. 5. MipsInstrInfo.td: Are branches marked isTerminator? 6. MipsInstrFormats.td: I know fields like rs, rt, shamt are not currently used. But it would be nice if there are some simple documentation. Nice work! Thanks, Evan On May 21, 2007, at 7:14 PM, bruno cardoso wrote: > Hello, > > With the files on attachment LLVM has now initial support for MIPS. =) > The support is still simple and experimental. > The status is: > > x - Mips I instructions, without (coprocessor) float point support. > x - Mips o32 ABI calling convention implemented. > x - .s files generated by LLC can be compiled with Mips GCC/GAS. > x - Simple test programs are working on Linux in a Mips emulated > QEMU machine. > x - AsmPrinter does not yet generate all Mips GAS pseudo-instructions > (such as .cpload, .fmask, .mask) > > I hope you enjoy! =) > Cheers, > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.org > > "The Man in Black fled across the desert and the gunslinger followed" > - Childe Roland to the Dark Tower Came > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070529/0c2514d2/attachment.html From sabre at nondot.org Tue May 29 15:44:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 15:44:25 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/index.html Message-ID: <200705292044.l4TKiPBm005882@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: index.html updated: 1.3 -> 1.4 --- Log message: rename video for consistency --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.3 llvm-www/devmtg/2007-05/index.html:1.4 --- llvm-www/devmtg/2007-05/index.html:1.3 Tue May 29 12:02:39 2007 +++ llvm-www/devmtg/2007-05/index.html Tue May 29 15:43:56 2007 @@ -128,7 +128,7 @@ Reid Spencer
    Chris Lattner Project Management, License, Naming - video + video Chris Lattner Feedback on the Meeting @@ -226,6 +226,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/29 17:02:39 $ +
    Last modified: $Date: 2007/05/29 20:43:56 $ From resistor at mac.com Tue May 29 16:54:17 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 16:54:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705292154.l4TLsHNi007475@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp added (r1.1) --- Log message: Very first part of a GVN-PRE implementation. It currently performs a bunch of analysis, and nothing more. It is also quite slow for the moment. However, it should give a sense of what's going on. --- Diffs of the changes: (+459 -0) GVNPRE.cpp | 459 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 459 insertions(+) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -c /dev/null llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.1 *** /dev/null Tue May 29 16:54:00 2007 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 16:53:49 2007 *************** *** 0 **** --- 1,459 ---- + //===- GVNPRE.cpp - Eliminate redundant values and expressions ------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the Owen Anderson and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This pass performs a hybrid of global value numbering and partial redundancy + // elimination, known as GVN-PRE. It performs partial redundancy elimination on + // values, rather than lexical expressions, allowing a more comprehensive view + // the optimization. It replaces redundant values with uses of earlier + // occurences of the same value. While this is beneficial in that it eliminates + // unneeded computation, it also increases register pressure by creating large + // live ranges, and should be used with caution on platforms that a very + // sensitive to register pressure. + // + //===----------------------------------------------------------------------===// + + #define DEBUG_TYPE "gvnpre" + #include "llvm/Value.h" + #include "llvm/Transforms/Scalar.h" + #include "llvm/Instructions.h" + #include "llvm/Function.h" + #include "llvm/Analysis/Dominators.h" + #include "llvm/Analysis/PostDominators.h" + #include "llvm/ADT/DepthFirstIterator.h" + #include "llvm/ADT/Statistic.h" + #include "llvm/Support/Compiler.h" + #include + #include + #include + #include + using namespace llvm; + + namespace { + + class VISIBILITY_HIDDEN GVNPRE : public FunctionPass { + bool runOnFunction(Function &F); + public: + static char ID; // Pass identification, replacement for typeid + GVNPRE() : FunctionPass((intptr_t)&ID) { nextValueNumber = 0; } + + private: + uint32_t nextValueNumber; + + struct Expression { + char opcode; + Value* value; + uint32_t lhs; + uint32_t rhs; + + bool operator<(const Expression& other) const { + if (opcode < other.opcode) + return true; + else if (other.opcode < opcode) + return false; + + if (opcode == 0) { + if (value < other.value) + return true; + else + return false; + } else { + if (lhs < other.lhs) + return true; + else if (other.lhs < lhs) + return true; + else if (rhs < other.rhs) + return true; + else + return false; + } + } + + bool operator==(const Expression& other) const { + if (opcode != other.opcode) + return false; + + if (value != other.value) + return false; + + if (lhs != other.lhs) + return false; + + if (rhs != other.rhs) + return false; + + return true; + } + }; + + typedef std::map ValueTable; + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + AU.addRequired(); + AU.addRequired(); + } + + // Helper fuctions + // FIXME: eliminate or document these better + void dump(ValueTable& VN, std::set& s); + void clean(ValueTable VN, std::set& set); + Expression add(ValueTable& VN, std::set& MS, Instruction* V); + ValueTable::iterator lookup(ValueTable& VN, Value* V); + Expression buildExpression(ValueTable& VN, Value* V); + std::set::iterator find_leader(ValueTable VN, + std::set& vals, + uint32_t v); + void phi_translate(ValueTable& VN, + std::set& anticIn, BasicBlock* B, + std::set& out); + + // For a given block, calculate the generated expressions, temporaries, + // and the AVAIL_OUT set + void CalculateAvailOut(ValueTable& VN, std::set& MS, + DominatorTree::Node* DI, + std::set& currExps, + std::set& currPhis, + std::set& currTemps, + std::set& currAvail, + std::map > availOut); + + }; + + char GVNPRE::ID = 0; + + } + + FunctionPass *llvm::createGVNPREPass() { return new GVNPRE(); } + + RegisterPass X("gvnpre", + "Global Value Numbering/Partial Redundancy Elimination"); + + // Given a Value, build an Expression to represent it + GVNPRE::Expression GVNPRE::buildExpression(ValueTable& VN, Value* V) { + if (Instruction* I = dyn_cast(V)) { + Expression e; + + switch (I->getOpcode()) { + case 7: + e.opcode = 1; // ADD + break; + case 8: + e.opcode = 2; // SUB + break; + case 9: + e.opcode = 3; // MUL + break; + case 10: + e.opcode = 4; // UDIV + break; + case 11: + e.opcode = 5; // SDIV + break; + case 12: + e.opcode = 6; // FDIV + break; + case 13: + e.opcode = 7; // UREM + break; + case 14: + e.opcode = 8; // SREM + break; + case 15: + e.opcode = 9; // FREM + break; + default: + e.opcode = 0; // OPAQUE + e.lhs = 0; + e.rhs = 0; + e.value = V; + return e; + } + + e.value = 0; + + ValueTable::iterator lhs = lookup(VN, I->getOperand(0)); + if (lhs == VN.end()) { + Expression lhsExp = buildExpression(VN, I->getOperand(0)); + VN.insert(std::make_pair(lhsExp, nextValueNumber)); + e.lhs = nextValueNumber; + nextValueNumber++; + } else + e.lhs = lhs->second; + ValueTable::iterator rhs = lookup(VN, I->getOperand(1)); + if (rhs == VN.end()) { + Expression rhsExp = buildExpression(VN, I->getOperand(1)); + VN.insert(std::make_pair(rhsExp, nextValueNumber)); + e.rhs = nextValueNumber; + nextValueNumber++; + } else + e.rhs = rhs->second; + + return e; + } else { + Expression e; + e.opcode = 0; + e.value = V; + e.lhs = 0; + e.rhs = 0; + + return e; + } + } + + GVNPRE::Expression GVNPRE::add(ValueTable& VN, std::set& MS, + Instruction* V) { + Expression e = buildExpression(VN, V); + if (VN.insert(std::make_pair(e, nextValueNumber)).second) + nextValueNumber++; + if (e.opcode != 0 || (e.opcode == 0 && isa(e.value))) + MS.insert(e); + return e; + } + + GVNPRE::ValueTable::iterator GVNPRE::lookup(ValueTable& VN, Value* V) { + Expression e = buildExpression(VN, V); + return VN.find(e); + } + + std::set::iterator GVNPRE::find_leader(GVNPRE::ValueTable VN, + std::set& vals, + uint32_t v) { + for (std::set::iterator I = vals.begin(), E = vals.end(); + I != E; ++I) + if (VN[*I] == v) + return I; + + return vals.end(); + } + + void GVNPRE::phi_translate(GVNPRE::ValueTable& VN, + std::set& anticIn, BasicBlock* B, + std::set& out) { + BasicBlock* succ = B->getTerminator()->getSuccessor(0); + + for (std::set::iterator I = anticIn.begin(), E = anticIn.end(); + I != E; ++I) { + if (I->opcode == 0) { + Value *v = I->value; + if (PHINode* p = dyn_cast(v)) + if (p->getParent() == succ) { + out.insert(buildExpression(VN, p->getIncomingValueForBlock(B))); + continue; + } + } + //out.insert(*I); + } + } + + // Remove all expressions whose operands are not themselves in the set + void GVNPRE::clean(GVNPRE::ValueTable VN, std::set& set) { + unsigned size = set.size(); + unsigned old = 0; + + while (size != old) { + old = size; + + std::vector worklist(set.begin(), set.end()); + while (!worklist.empty()) { + Expression e = worklist.back(); + worklist.pop_back(); + + if (e.opcode == 0) // OPAQUE + continue; + + bool lhsValid = false; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) + if (VN[*I] == e.lhs); + lhsValid = true; + + bool rhsValid = false; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) + if (VN[*I] == e.rhs); + rhsValid = true; + + if (!lhsValid || !rhsValid) + set.erase(e); + } + + size = set.size(); + } + } + + void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { + printf("{ "); + for (std::set::iterator I = s.begin(), E = s.end(); I != E; ++I) { + printf("(%d, %s, value.%d, value.%d) ", I->opcode, I->value == 0 ? "0" : I->value->getName().c_str(), I->lhs, I->rhs); + } + printf("}\n\n"); + } + + void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set& MS, + DominatorTree::Node* DI, + std::set& currExps, + std::set& currPhis, + std::set& currTemps, + std::set& currAvail, + std::map > availOut) { + + BasicBlock* BB = DI->getBlock(); + + // A block inherits AVAIL_OUT from its dominator + if (DI->getIDom() != 0) + currAvail.insert(availOut[DI->getIDom()->getBlock()].begin(), + availOut[DI->getIDom()->getBlock()].end()); + + + for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); + BI != BE; ++BI) { + + // Handle PHI nodes... + if (PHINode* p = dyn_cast(BI)) { + add(VN, MS, p); + currPhis.insert(p); + + // Handle binary ops... + } else if (BinaryOperator* BO = dyn_cast(BI)) { + Expression leftValue = buildExpression(VN, BO->getOperand(0)); + Expression rightValue = buildExpression(VN, BO->getOperand(1)); + + Expression e = add(VN, MS, BO); + + currExps.insert(leftValue); + currExps.insert(rightValue); + currExps.insert(e); + + currTemps.insert(e); + + // Handle unsupported ops + } else { + Expression e = add(VN, MS, BI); + currTemps.insert(e); + } + + currAvail.insert(buildExpression(VN, BI)); + } + } + + bool GVNPRE::runOnFunction(Function &F) { + ValueTable VN; + std::set maximalSet; + + std::map > generatedExpressions; + std::map > generatedPhis; + std::map > generatedTemporaries; + std::map > availableOut; + std::map > anticipatedIn; + + DominatorTree &DT = getAnalysis(); + + // First Phase of BuildSets - calculate AVAIL_OUT + + // Top-down walk of the dominator tree + for (df_iterator DI = df_begin(DT.getRootNode()), + E = df_end(DT.getRootNode()); DI != E; ++DI) { + + // Get the sets to update for this block + std::set& currExps = generatedExpressions[DI->getBlock()]; + std::set& currPhis = generatedPhis[DI->getBlock()]; + std::set& currTemps = generatedTemporaries[DI->getBlock()]; + std::set& currAvail = availableOut[DI->getBlock()]; + + CalculateAvailOut(VN, maximalSet, *DI, currExps, currPhis, + currTemps, currAvail, availableOut); + } + + PostDominatorTree &PDT = getAnalysis(); + + // Second Phase of BuildSets - calculate ANTIC_IN + + bool changed = true; + unsigned iterations = 0; + while (changed) { + changed = false; + std::set anticOut; + + // Top-down walk of the postdominator tree + for (df_iterator PDI = + df_begin(PDT.getRootNode()), E = df_end(DT.getRootNode()); + PDI != E; ++PDI) { + BasicBlock* BB = PDI->getBlock(); + + std::set& anticIn = anticipatedIn[BB]; + std::set old (anticIn.begin(), anticIn.end()); + + if (BB->getTerminator()->getNumSuccessors() == 1) { + phi_translate(VN, anticIn, BB, anticOut); + } else if (BB->getTerminator()->getNumSuccessors() > 1) { + for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { + BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); + std::set temp; + if (i == 0) + temp.insert(maximalSet.begin(), maximalSet.end()); + else + temp.insert(anticIn.begin(), anticIn.end()); + + anticIn.clear(); + std::insert_iterator > ai_ins(anticIn, + anticIn.begin()); + + std::set_difference(anticipatedIn[currSucc].begin(), + anticipatedIn[currSucc].end(), + temp.begin(), + temp.end(), + ai_ins); + } + } + + std::set S; + std::insert_iterator > s_ins(S, S.begin()); + std::set_union(anticOut.begin(), anticOut.end(), + generatedExpressions[BB].begin(), + generatedExpressions[BB].end(), + s_ins); + + anticIn.clear(); + std::insert_iterator > antic_ins(anticIn, + anticIn.begin()); + std::set_difference(S.begin(), S.end(), + generatedTemporaries[BB].begin(), + generatedTemporaries[BB].end(), + antic_ins); + + clean(VN, anticIn); + + + + if (old != anticIn) + changed = true; + + anticOut.clear(); + } + iterations++; + } + + /* printf("Iterations: %d\n", iterations); + + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { + printf("Name: "); + printf(I->getName().c_str()); + printf("\nTMP_GEN: "); + dump(VN, generatedTemporaries[I]); + printf("\nEXP_GEN: "); + dump(VN, generatedExpressions[I]); + //printf("\nANTIC_OUT: "); + //dump(VN, anticipatedOut[I]); + printf("\nANTIC_IN: \n"); + dump(VN, anticipatedIn[I]); + printf("\n"); + } */ + + return false; + } From evan.cheng at apple.com Tue May 29 17:31:45 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 17:31:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200705292231.l4TMVj4x008309@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.13 -> 1.14 --- Log message: If there is an empty block between a source and its successor block, it still requires a unconditional branch. --- Diffs of the changes: (+37 -30) IfConversion.cpp | 67 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 37 insertions(+), 30 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.13 llvm/lib/CodeGen/IfConversion.cpp:1.14 --- llvm/lib/CodeGen/IfConversion.cpp:1.13 Thu May 24 19:59:01 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Tue May 29 17:31:16 2007 @@ -339,6 +339,14 @@ } } +/// InsertUncondBranch - Inserts an unconditional branch from BB to ToBB. +/// +static void InsertUncondBranch(MachineBasicBlock *BB, MachineBasicBlock *ToBB, + const TargetInstrInfo *TII) { + std::vector NoCond; + TII->InsertBranch(*BB, ToBB, NULL, NoCond); +} + /// IfConvertEarlyExit - If convert a early exit sub-CFG. /// bool IfConverter::IfConvertEarlyExit(BBInfo &BBI) { @@ -369,10 +377,8 @@ // unconditional one. BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); MergeBlocks(BBI, *CvtBBI); - if (!isNextBlock(BBI.BB, NextBBI->BB)) { - std::vector NoCond; - TII->InsertBranch(*BBI.BB, NextBBI->BB, NULL, NoCond); - } + if (!isNextBlock(BBI.BB, NextBBI->BB)) + InsertUncondBranch(BBI.BB, NextBBI->BB, TII); std::copy(NewCond.begin(), NewCond.end(), std::back_inserter(BBI.Predicate)); // Update block info. BB can be iteratively if-converted. @@ -430,8 +436,8 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI) { BBI.Kind = ICNotClassfied; - bool TrueNeedCBr; - bool FalseNeedCBr; + bool TrueNeedBr; + bool FalseNeedBr; BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; FeasibilityAnalysis(TrueBBI, BBI.BrCond); @@ -444,14 +450,14 @@ if (Proceed) { // Check the 'true' and 'false' blocks if either isn't ended with a branch. // Either the block fallthrough to another block or it ends with a - // return. If it's the former, add a conditional branch to its successor. - TrueNeedCBr = !TrueBBI.TrueBB && BBI.TrueBB->succ_size(); - FalseNeedCBr = !FalseBBI.TrueBB && BBI.FalseBB->succ_size(); - if (TrueNeedCBr && TrueBBI.ModifyPredicate) { + // return. If it's the former, add a branch to its successor. + TrueNeedBr = !TrueBBI.TrueBB && BBI.TrueBB->succ_size(); + FalseNeedBr = !FalseBBI.TrueBB && BBI.FalseBB->succ_size(); + if (TrueNeedBr && TrueBBI.ModifyPredicate) { TrueBBI.isPredicable = false; Proceed = false; } - if (FalseNeedCBr && FalseBBI.ModifyPredicate) { + if (FalseNeedBr && FalseBBI.ModifyPredicate) { FalseBBI.isPredicable = false; Proceed = false; } @@ -502,32 +508,35 @@ TrueBBI.NonPredSize -= TII->RemoveBranch(*BBI.TrueBB); PredicateBlock(TrueBBI, BBI.BrCond); - // Add a conditional branch to 'true' successor if needed. - if (TrueNeedCBr && TrueBBI.ModifyPredicate && - isNextBlock(BBI.TrueBB, *BBI.TrueBB->succ_begin())) - TrueNeedCBr = false; - if (TrueNeedCBr) - TII->InsertBranch(*BBI.TrueBB, *BBI.TrueBB->succ_begin(), NULL, BBI.BrCond); - // Predicate the 'false' block. PredicateBlock(FalseBBI, RevCond, true); - // Add a conditional branch to 'false' successor if needed. - if (FalseNeedCBr && !TrueBBI.ModifyPredicate && - isNextBlock(BBI.FalseBB, *BBI.FalseBB->succ_begin())) - FalseNeedCBr = false; - if (FalseNeedCBr) - TII->InsertBranch(*BBI.FalseBB, *BBI.FalseBB->succ_begin(), NULL, - RevCond); - // Merge the 'true' and 'false' blocks by copying the instructions // from the 'false' block to the 'true' block. That is, unless the true // block would clobber the predicate, in that case, do the opposite. BBInfo *CvtBBI; if (!TrueBBI.ModifyPredicate) { + // Add a conditional branch from 'true' to 'true' successor if needed. + if (TrueNeedBr) + TII->InsertBranch(*BBI.TrueBB, *BBI.TrueBB->succ_begin(), NULL, + BBI.BrCond); + // Add an unconditional branch from 'false' to to 'false' successor if it + // will not be the fallthrough block. + if (FalseNeedBr && + !isNextBlock(BBI.BB, *BBI.FalseBB->succ_begin())) + InsertUncondBranch(BBI.FalseBB, *BBI.FalseBB->succ_begin(), TII); MergeBlocks(TrueBBI, FalseBBI); CvtBBI = &TrueBBI; } else { + // Add a conditional branch from 'false' to 'false' successor if needed. + if (FalseNeedBr) + TII->InsertBranch(*BBI.FalseBB, *BBI.FalseBB->succ_begin(), NULL, + RevCond); + // Add an unconditional branch from 'true' to to 'true' successor if it + // will not be the fallthrough block. + if (TrueNeedBr && + !isNextBlock(BBI.BB, *BBI.TrueBB->succ_begin())) + InsertUncondBranch(BBI.TrueBB, *BBI.TrueBB->succ_begin(), TII); MergeBlocks(FalseBBI, TrueBBI); CvtBBI = &FalseBBI; } @@ -543,10 +552,8 @@ MergeBlocks(BBI, *CvtBBI); CvtBBI = &BBI; OkToIfcvt = false; - } else { - std::vector NoCond; - TII->InsertBranch(*BBI.BB, CvtBBI->BB, NULL, NoCond); - } + } else + InsertUncondBranch(BBI.BB, CvtBBI->BB, TII); // If the if-converted block fallthrough into the tail block, then // fold the tail block in as well. From resistor at mac.com Tue May 29 17:36:10 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 17:36:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705292236.l4TMaAff008395@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.1 -> 1.2 --- Log message: Add a place where I missed using the maximal set. Note that using the maximal set this way is _SLOW_. Somewhere down the line, I'll look at speeding it up. --- Diffs of the changes: (+3 -3) GVNPRE.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.1 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.2 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.1 Tue May 29 16:53:49 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 17:35:41 2007 @@ -390,7 +390,7 @@ std::set old (anticIn.begin(), anticIn.end()); if (BB->getTerminator()->getNumSuccessors() == 1) { - phi_translate(VN, anticIn, BB, anticOut); + phi_translate(VN, maximalSet, BB, anticOut); } else if (BB->getTerminator()->getNumSuccessors() > 1) { for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); @@ -439,7 +439,7 @@ iterations++; } - /* printf("Iterations: %d\n", iterations); + printf("Iterations: %d\n", iterations); for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { printf("Name: "); @@ -453,7 +453,7 @@ printf("\nANTIC_IN: \n"); dump(VN, anticipatedIn[I]); printf("\n"); - } */ + } return false; } From resistor at mac.com Tue May 29 17:43:32 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 17:43:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705292243.l4TMhWA3008572@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.2 -> 1.3 --- Log message: Comment debug code out that I accidentally uncommented last time. --- Diffs of the changes: (+2 -2) GVNPRE.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.2 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.3 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.2 Tue May 29 17:35:41 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 17:43:03 2007 @@ -439,7 +439,7 @@ iterations++; } - printf("Iterations: %d\n", iterations); + /*printf("Iterations: %d\n", iterations); for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { printf("Name: "); @@ -453,7 +453,7 @@ printf("\nANTIC_IN: \n"); dump(VN, anticipatedIn[I]); printf("\n"); - } + }*/ return false; } From resistor at mac.com Tue May 29 18:15:50 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 18:15:50 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705292315.l4TNFo4C009147@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.3 -> 1.4 --- Log message: Use proper debugging facilities so other people don't have to look at my commented-out debugging lines. --- Diffs of the changes: (+18 -14) GVNPRE.cpp | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.3 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.4 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.3 Tue May 29 17:43:03 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 18:15:21 2007 @@ -28,10 +28,10 @@ #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" #include #include #include -#include using namespace llvm; namespace { @@ -288,11 +288,13 @@ } void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { - printf("{ "); + DOUT << "{ "; for (std::set::iterator I = s.begin(), E = s.end(); I != E; ++I) { - printf("(%d, %s, value.%d, value.%d) ", I->opcode, I->value == 0 ? "0" : I->value->getName().c_str(), I->lhs, I->rhs); + DOUT << "( " << I->opcode << ", " + << (I->value == 0 ? "0" : I->value->getName().c_str()) + << ", value." << I->lhs << ", value." << I->rhs << " ) "; } - printf("}\n\n"); + DOUT << "}\n\n"; } void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set& MS, @@ -439,21 +441,23 @@ iterations++; } - /*printf("Iterations: %d\n", iterations); + DOUT << "Iterations: " << iterations << "\n"; for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { - printf("Name: "); - printf(I->getName().c_str()); - printf("\nTMP_GEN: "); + DOUT << "Name: " << I->getName().c_str() << "\n"; + + DOUT << "TMP_GEN: "; dump(VN, generatedTemporaries[I]); - printf("\nEXP_GEN: "); + DOUT << "\n"; + + DOUT << "EXP_GEN: "; dump(VN, generatedExpressions[I]); - //printf("\nANTIC_OUT: "); - //dump(VN, anticipatedOut[I]); - printf("\nANTIC_IN: \n"); + DOUT << "\n"; + + DOUT << "ANTIC_IN: "; dump(VN, anticipatedIn[I]); - printf("\n"); - }*/ + DOUT << "\n"; + } return false; } From resistor at mac.com Tue May 29 18:26:59 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 18:26:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705292326.l4TNQxxp009357@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.4 -> 1.5 --- Log message: Re-fix a bug, where I was now being too aggressive. --- Diffs of the changes: (+5 -1) GVNPRE.cpp | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.4 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.5 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.4 Tue May 29 18:15:21 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 18:26:30 2007 @@ -376,6 +376,8 @@ // Second Phase of BuildSets - calculate ANTIC_IN + std::set visited; + bool changed = true; unsigned iterations = 0; while (changed) { @@ -388,6 +390,8 @@ PDI != E; ++PDI) { BasicBlock* BB = PDI->getBlock(); + visited.insert(BB); + std::set& anticIn = anticipatedIn[BB]; std::set old (anticIn.begin(), anticIn.end()); @@ -397,7 +401,7 @@ for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); std::set temp; - if (i == 0) + if (visted.find(currSucc) == visited.end()) temp.insert(maximalSet.begin(), maximalSet.end()); else temp.insert(anticIn.begin(), anticIn.end()); From evan.cheng at apple.com Tue May 29 18:32:28 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 18:32:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200705292332.l4TNWShj009472@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.106 -> 1.107 --- Log message: For ldrb, strh, etc., the condition code is before the width specifier. e.g. streqh, not strheq. --- Diffs of the changes: (+23 -23) ARMInstrInfo.td | 46 +++++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 23 deletions(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.106 llvm/lib/Target/ARM/ARMInstrInfo.td:1.107 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.106 Mon May 21 17:42:04 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Tue May 29 18:32:06 2007 @@ -370,7 +370,7 @@ // FIXME: Set all opcodes to 0 for now. : InstARM<0, am, sz, im, cstr> { let OperandList = !con(oprnds, (ops pred:$p)); - let AsmString = !strconcat(opc, !strconcat("$p", asm)); + let AsmString = !strconcat(opc, !strconcat("${p}", asm)); let Pattern = pattern; list Predicates = [IsARM]; } @@ -672,25 +672,25 @@ // Loads with zero extension def LDRH : AI3<(ops GPR:$dst, addrmode3:$addr), - "ldrh", " $dst, $addr", + "ldr", "h $dst, $addr", [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>; def LDRB : AI2<(ops GPR:$dst, addrmode2:$addr), - "ldrb", " $dst, $addr", + "ldr", "b $dst, $addr", [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>; // Loads with sign extension def LDRSH : AI3<(ops GPR:$dst, addrmode3:$addr), - "ldrsh", " $dst, $addr", + "ldr", "sh $dst, $addr", [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>; def LDRSB : AI3<(ops GPR:$dst, addrmode3:$addr), - "ldrsb", " $dst, $addr", + "ldr", "sb $dst, $addr", [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>; // Load doubleword def LDRD : AI3<(ops GPR:$dst, addrmode3:$addr), - "ldrd", " $dst, $addr", + "ldr", "d $dst, $addr", []>, Requires<[IsARM, HasV5T]>; // Indexed loads @@ -701,28 +701,28 @@ "ldr", " $dst, [$base], $offset", "$base = $base_wb", []>; def LDRH_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr), - "ldrh", " $dst, $addr!", "$addr.base = $base_wb", []>; + "ldr", "h $dst, $addr!", "$addr.base = $base_wb", []>; def LDRH_POST : AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset), - "ldrh", " $dst, [$base], $offset", "$base = $base_wb", []>; + "ldr", "h $dst, [$base], $offset", "$base = $base_wb", []>; def LDRB_PRE : AI2pr<(ops GPR:$dst, GPR:$base_wb, addrmode2:$addr), - "ldrb", " $dst, $addr!", "$addr.base = $base_wb", []>; + "ldr", "b $dst, $addr!", "$addr.base = $base_wb", []>; def LDRB_POST : AI2po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am2offset:$offset), - "ldrb", " $dst, [$base], $offset", "$base = $base_wb", []>; + "ldr", "b $dst, [$base], $offset", "$base = $base_wb", []>; def LDRSH_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr), - "ldrsh", " $dst, $addr!", "$addr.base = $base_wb", []>; + "ldr", "sh $dst, $addr!", "$addr.base = $base_wb", []>; def LDRSH_POST: AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset), - "ldrsh", " $dst, [$base], $offset", "$base = $base_wb", []>; + "ldr", "sh $dst, [$base], $offset", "$base = $base_wb", []>; def LDRSB_PRE : AI3pr<(ops GPR:$dst, GPR:$base_wb, addrmode3:$addr), - "ldrsb", " $dst, $addr!", "$addr.base = $base_wb", []>; + "ldr", "sb $dst, $addr!", "$addr.base = $base_wb", []>; def LDRSB_POST: AI3po<(ops GPR:$dst, GPR:$base_wb, GPR:$base,am3offset:$offset), - "ldrsb", " $dst, [$base], $offset", "$base = $base_wb", []>; + "ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>; } // isLoad // Store @@ -733,16 +733,16 @@ // Stores with truncate def STRH : AI3<(ops GPR:$src, addrmode3:$addr), - "strh", " $src, $addr", + "str", "h $src, $addr", [(truncstorei16 GPR:$src, addrmode3:$addr)]>; def STRB : AI2<(ops GPR:$src, addrmode2:$addr), - "strb", " $src, $addr", + "str", "b $src, $addr", [(truncstorei8 GPR:$src, addrmode2:$addr)]>; // Store doubleword def STRD : AI3<(ops GPR:$src, addrmode3:$addr), - "strd", " $src, $addr", + "str", "d $src, $addr", []>, Requires<[IsARM, HasV5T]>; // Indexed stores @@ -757,22 +757,22 @@ (post_store GPR:$src, GPR:$base, am2offset:$offset))]>; def STRH_PRE : AI3pr<(ops GPR:$base_wb, GPR:$src, GPR:$base,am3offset:$offset), - "strh", " $src, [$base, $offset]!", "$base = $base_wb", + "str", "h $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>; def STRH_POST: AI3po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am3offset:$offset), - "strh", " $src, [$base], $offset", "$base = $base_wb", + "str", "h $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_truncsti16 GPR:$src, GPR:$base, am3offset:$offset))]>; def STRB_PRE : AI2pr<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset), - "strb", " $src, [$base, $offset]!", "$base = $base_wb", + "str", "b $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_truncsti8 GPR:$src, GPR:$base, am2offset:$offset))]>; def STRB_POST: AI2po<(ops GPR:$base_wb, GPR:$src, GPR:$base,am2offset:$offset), - "strb", " $src, [$base], $offset", "$base = $base_wb", + "str", "b $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_truncsti8 GPR:$src, GPR:$base, am2offset:$offset))]>; } // isStore @@ -808,10 +808,10 @@ // due to flag operands. def MOVsrl_flag : AI1<(ops GPR:$dst, GPR:$src), - "movs", " $dst, $src, lsr #1", + "mov", "s $dst, $src, lsr #1", [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>; def MOVsra_flag : AI1<(ops GPR:$dst, GPR:$src), - "movs", " $dst, $src, asr #1", + "mov", "s $dst, $src, asr #1", [(set GPR:$dst, (ARMsra_flag GPR:$src))]>; def MOVrx : AI1<(ops GPR:$dst, GPR:$src), "mov", " $dst, $src, rrx", From resistor at mac.com Tue May 29 18:34:50 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 18:34:50 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705292334.l4TNYoOj009525@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.5 -> 1.6 --- Log message: Fix a typo --- Diffs of the changes: (+1 -1) GVNPRE.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.5 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.6 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.5 Tue May 29 18:26:30 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 18:34:14 2007 @@ -401,7 +401,7 @@ for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); std::set temp; - if (visted.find(currSucc) == visited.end()) + if (visited.find(currSucc) == visited.end()) temp.insert(maximalSet.begin(), maximalSet.end()); else temp.insert(anticIn.begin(), anticIn.end()); From evan.cheng at apple.com Tue May 29 18:34:55 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 18:34:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrVFP.td Message-ID: <200705292334.l4TNYt0i009532@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrVFP.td updated: 1.6 -> 1.7 --- Log message: For VFP2 fldm, fstm instructions, the condition code is printed after the address mode and size specifier. e.g. fstmiaseq, not fstmeqias. --- Diffs of the changes: (+4 -4) ARMInstrVFP.td | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Target/ARM/ARMInstrVFP.td diff -u llvm/lib/Target/ARM/ARMInstrVFP.td:1.6 llvm/lib/Target/ARM/ARMInstrVFP.td:1.7 --- llvm/lib/Target/ARM/ARMInstrVFP.td:1.6 Mon May 14 20:29:07 2007 +++ llvm/lib/Target/ARM/ARMInstrVFP.td Tue May 29 18:34:19 2007 @@ -108,21 +108,21 @@ let isLoad = 1 in { def FLDMD : AXDI5<(ops addrmode5:$addr, pred:$p, reglist:$dst1, variable_ops), - "fldm${p}${addr:submode}d ${addr:base}, $dst1", + "fldm${addr:submode}d${p} ${addr:base}, $dst1", []>; def FLDMS : AXSI5<(ops addrmode5:$addr, pred:$p, reglist:$dst1, variable_ops), - "fldm${p}${addr:submode}s ${addr:base}, $dst1", + "fldm${addr:submode}s${p} ${addr:base}, $dst1", []>; } // isLoad let isStore = 1 in { def FSTMD : AXDI5<(ops addrmode5:$addr, pred:$p, reglist:$src1, variable_ops), - "fstm${p}${addr:submode}d ${addr:base}, $src1", + "fstm${addr:submode}d${p} ${addr:base}, $src1", []>; def FSTMS : AXSI5<(ops addrmode5:$addr, pred:$p, reglist:$src1, variable_ops), - "fstm${p}${addr:submode}s ${addr:base}, $src1", + "fstm${addr:submode}s${p} ${addr:base}, $src1", []>; } // isStore From resistor at mac.com Tue May 29 18:36:54 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 18:36:54 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkAllPasses.h Message-ID: <200705292336.l4TNas2A009588@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkAllPasses.h updated: 1.14 -> 1.15 --- Log message: Put GVN-PRE in all the right places. --- Diffs of the changes: (+1 -0) LinkAllPasses.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/LinkAllPasses.h diff -u llvm/include/llvm/LinkAllPasses.h:1.14 llvm/include/llvm/LinkAllPasses.h:1.15 --- llvm/include/llvm/LinkAllPasses.h:1.14 Sun Apr 15 03:47:27 2007 +++ llvm/include/llvm/LinkAllPasses.h Tue May 29 18:36:32 2007 @@ -67,6 +67,7 @@ (void) llvm::createGlobalDCEPass(); (void) llvm::createGlobalOptimizerPass(); (void) llvm::createGlobalsModRefPass(); + (void) llvm::createGVNPREPass(); (void) llvm::createIPConstantPropagationPass(); (void) llvm::createIPSCCPPass(); (void) llvm::createIndVarSimplifyPass(); From resistor at mac.com Tue May 29 18:37:01 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 29 May 2007 18:37:01 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h Message-ID: <200705292337.l4TNb1lf009594@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Scalar.h updated: 1.79 -> 1.80 --- Log message: Put GVN-PRE in all the right places. --- Diffs of the changes: (+7 -0) Scalar.h | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/Transforms/Scalar.h diff -u llvm/include/llvm/Transforms/Scalar.h:1.79 llvm/include/llvm/Transforms/Scalar.h:1.80 --- llvm/include/llvm/Transforms/Scalar.h:1.79 Fri Apr 6 20:25:15 2007 +++ llvm/include/llvm/Transforms/Scalar.h Tue May 29 18:36:32 2007 @@ -318,6 +318,13 @@ //===----------------------------------------------------------------------===// // +// GVN-PRE - This pass performs global value numbering and partial redundancy +// elimination. +// +FunctionPass *createGVNPREPass(); + +//===----------------------------------------------------------------------===// +// // CodeGenPrepare - This pass prepares a function for instruction selection. // FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); From evan.cheng at apple.com Tue May 29 18:37:49 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 29 May 2007 18:37:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200705292337.l4TNbn84009635@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.14 -> 1.15 --- Log message: Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion. --- Diffs of the changes: (+4 -2) IfConversion.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.14 llvm/lib/CodeGen/IfConversion.cpp:1.15 --- llvm/lib/CodeGen/IfConversion.cpp:1.14 Tue May 29 17:31:16 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Tue May 29 18:37:20 2007 @@ -555,9 +555,11 @@ } else InsertUncondBranch(BBI.BB, CvtBBI->BB, TII); - // If the if-converted block fallthrough into the tail block, then + // If the if-converted block fallthrough or unconditionally branch into the + // tail block, and the tail block does not have other predecessors, then // fold the tail block in as well. - if (BBI.TailBB && CvtBBI->BB->succ_size() == 1) { + if (BBI.TailBB && + BBI.TailBB->succ_size() == 1 && CvtBBI->BB->succ_size() == 1) { CvtBBI->NonPredSize -= TII->RemoveBranch(*CvtBBI->BB); BBInfo TailBBI = BBAnalysis[BBI.TailBB->getNumber()]; MergeBlocks(*CvtBBI, TailBBI); From dalej at apple.com Tue May 29 18:48:12 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 29 May 2007 18:48:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200705292348.l4TNmCNM009872@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.58 -> 1.59 --- Log message: Make stable_sort in tail merging actually be stable (it never was, but didn't matter until my last change). Reenable tail merging by default. --- Diffs of the changes: (+16 -1) BranchFolding.cpp | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.58 llvm/lib/CodeGen/BranchFolding.cpp:1.59 --- llvm/lib/CodeGen/BranchFolding.cpp:1.58 Thu May 24 13:31:55 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Tue May 29 18:47:50 2007 @@ -420,6 +420,21 @@ TII->InsertBranch(*CurMBB, SuccBB, NULL, std::vector()); } +static bool MergeCompare(std::pair p, + std::pair q) { + + if (p.first < q.first) + return true; + else if (p.first > q.first) + return false; + else if (p.second->getNumber() < q.second->getNumber()) + return true; + else if (p.second->getNumber() > q.second->getNumber()) + return false; + else + assert(0 && "Predecessor appears twice"); +} + // See if any of the blocks in MergePotentials (which all have a common single // successor, or all have no successor) can be tail-merged. If there is a // successor, any blocks in MergePotentials that are not tail-merged and @@ -435,7 +450,7 @@ // Sort by hash value so that blocks with identical end sequences sort // together. - std::stable_sort(MergePotentials.begin(), MergePotentials.end()); + std::stable_sort(MergePotentials.begin(), MergePotentials.end(), MergeCompare); // Walk through equivalence sets looking for actual exact matches. while (MergePotentials.size() > 1) { From dalej at apple.com Tue May 29 18:48:20 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 29 May 2007 18:48:20 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200705292348.l4TNmKOs009878@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.79 -> 1.80 --- Log message: Make stable_sort in tail merging actually be stable (it never was, but didn't matter until my last change). Reenable tail merging by default. --- Diffs of the changes: (+2 -2) TargetMachine.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.79 llvm/include/llvm/Target/TargetMachine.h:1.80 --- llvm/include/llvm/Target/TargetMachine.h:1.79 Thu May 24 20:00:24 2007 +++ llvm/include/llvm/Target/TargetMachine.h Tue May 29 18:47:50 2007 @@ -187,7 +187,7 @@ /// getEnableTailMergeDefault - the default setting for -enable-tail-merge /// on this target. User flag overrides. - virtual const bool getEnableTailMergeDefault() const { return false; } + virtual const bool getEnableTailMergeDefault() const { return true; } /// addPassesToEmitFile - Add passes to the specified pass manager to get the /// specified file emitted. Typically this will involve several steps of code @@ -322,7 +322,7 @@ /// getEnableTailMergeDefault - the default setting for -enable-tail-merge /// on this target. User flag overrides. - virtual const bool getEnableTailMergeDefault() const { return false; } + virtual const bool getEnableTailMergeDefault() const { return true; } }; } // End llvm namespace From dalej at apple.com Tue May 29 19:32:30 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 29 May 2007 19:32:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200705300032.l4U0WUpV010725@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.59 -> 1.60 --- Log message: Changed per review comment. --- Diffs of the changes: (+2 -3) BranchFolding.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.59 llvm/lib/CodeGen/BranchFolding.cpp:1.60 --- llvm/lib/CodeGen/BranchFolding.cpp:1.59 Tue May 29 18:47:50 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Tue May 29 19:32:01 2007 @@ -420,9 +420,8 @@ TII->InsertBranch(*CurMBB, SuccBB, NULL, std::vector()); } -static bool MergeCompare(std::pair p, - std::pair q) { - +static bool MergeCompare(const std::pair &p, + const std::pair &q) { if (p.first < q.first) return true; else if (p.first > q.first) From sabre at nondot.org Tue May 29 21:56:19 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 21:56:19 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/03-Patel-Passmanager.pdf 04-Cheng-Codegen.pdf 05-Lewycky-Predsimplify.pdf index.html Message-ID: <200705300256.l4U2uJIk013489@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: 03-Patel-Passmanager.pdf added (r1.1) 04-Cheng-Codegen.pdf added (r1.1) 05-Lewycky-Predsimplify.pdf added (r1.1) index.html updated: 1.4 -> 1.5 --- Log message: add some slides, thanks to Devang for providing these --- Diffs of the changes: (+14 -4) 03-Patel-Passmanager.pdf | 0 04-Cheng-Codegen.pdf | 0 05-Lewycky-Predsimplify.pdf | 0 index.html | 18 ++++++++++++++---- 4 files changed, 14 insertions(+), 4 deletions(-) Index: llvm-www/devmtg/2007-05/03-Patel-Passmanager.pdf Index: llvm-www/devmtg/2007-05/04-Cheng-Codegen.pdf Index: llvm-www/devmtg/2007-05/05-Lewycky-Predsimplify.pdf Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.4 llvm-www/devmtg/2007-05/index.html:1.5 --- llvm-www/devmtg/2007-05/index.html:1.4 Tue May 29 15:43:56 2007 +++ llvm-www/devmtg/2007-05/index.html Tue May 29 21:55:57 2007 @@ -45,18 +45,28 @@

    Session 1:
    Learning LLVM

    MediaSpeakerDescription - video + + slides
    + video + Devang Patel Demystifying The LLVM Pass Manager - The PassManager, which manages the execution of all LLVM passes, was recently revised to be simpler and more useful. This talk will help you understand what the new pass manager does and how to use it. - videoEvan Cheng + + slides
    + video + + Evan Cheng The LLVM Code Generator - An overview of the LLVM generic code generator design and changes to it that are coming in the future. - video + + slides
    + video + Nick Lewycky Introduction To Predicate Simplifier - A review of the design and implementation of LLVM's Predicate Simplifier Pass, otherwise known @@ -226,6 +236,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/29 20:43:56 $ +
    Last modified: $Date: 2007/05/30 02:55:57 $ From sabre at nondot.org Tue May 29 22:03:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 22:03:56 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/10-Lattner-OpenGL.pdf index.html Message-ID: <200705300303.l4U33urI013926@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: 10-Lattner-OpenGL.pdf added (r1.1) index.html updated: 1.5 -> 1.6 --- Log message: another set of slide: mine --- Diffs of the changes: (+5 -2) 10-Lattner-OpenGL.pdf | 0 index.html | 7 +++++-- 2 files changed, 5 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2007-05/10-Lattner-OpenGL.pdf Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.5 llvm-www/devmtg/2007-05/index.html:1.6 --- llvm-www/devmtg/2007-05/index.html:1.5 Tue May 29 21:55:57 2007 +++ llvm-www/devmtg/2007-05/index.html Tue May 29 22:03:34 2007 @@ -106,7 +106,10 @@ for LLVM, built as a native part of the LLVM system and in the LLVM design style. - video + + slides + video + Chris Lattner LLVM in OpenGL and for Dynamic Languages - A presentation put together in 10 minutes, talking about LLVM being used for OpenGL and some @@ -236,6 +239,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/30 02:55:57 $ +
    Last modified: $Date: 2007/05/30 03:03:34 $ From sabre at nondot.org Tue May 29 22:12:45 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 29 May 2007 22:12:45 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/05-Lewycky-Predsimplify.pdf Message-ID: <200705300312.l4U3Cj7S014335@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: 05-Lewycky-Predsimplify.pdf updated: 1.1 -> 1.2 --- Log message: new presentation, now with readable graphics! :) --- Diffs of the changes: (+0 -0) 05-Lewycky-Predsimplify.pdf | 0 1 files changed Index: llvm-www/devmtg/2007-05/05-Lewycky-Predsimplify.pdf From clattner at apple.com Tue May 29 23:14:53 2007 From: clattner at apple.com (clattner at apple.com) Date: Tue, 29 May 2007 21:14:53 -0700 (PDT) Subject: [llvm-commits] [127800] redisable i128 codegen from llvm-gcc to work around PR1462 Message-ID: <20070530041453.D15265997B66@src> Revision: 127800 Author: clattner Date: 2007-05-29 21:14:52 -0700 (Tue, 29 May 2007) Log Message: ----------- redisable i128 codegen from llvm-gcc to work around PR1462 Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-29 23:40:14 UTC (rev 127799) +++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-30 04:14:52 UTC (rev 127800) @@ -494,7 +494,7 @@ case 16: case 32: case 64: - case 128: + //case 128: Waiting for PR1462 etc. break; default: static bool Warned = false; From sabre at nondot.org Wed May 30 00:37:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 May 2007 00:37:40 -0500 Subject: [llvm-commits] CVS: llvm/test/CFrontend/2007-05-29-UnionCopy.c Message-ID: <200705300537.l4U5be3x016863@zion.cs.uiuc.edu> Changes in directory llvm/test/CFrontend: 2007-05-29-UnionCopy.c added (r1.1) --- Log message: new testcase for PR1421: http://llvm.org/PR1421 --- Diffs of the changes: (+18 -0) 2007-05-29-UnionCopy.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/test/CFrontend/2007-05-29-UnionCopy.c diff -c /dev/null llvm/test/CFrontend/2007-05-29-UnionCopy.c:1.1 *** /dev/null Wed May 30 00:37:28 2007 --- llvm/test/CFrontend/2007-05-29-UnionCopy.c Wed May 30 00:37:18 2007 *************** *** 0 **** --- 1,18 ---- + // RUN: %llvmgcc -S -o - -emit-llvm %s | grep memcpy + // PR1421 + + struct A { + char c; + int i; + }; + + struct B { + int c; + unsigned char x; + }; + + union U { struct A a; struct B b; }; + + void check(union U *u, union U *v) { + *u = *v; + } From clattner at apple.com Wed May 30 00:38:40 2007 From: clattner at apple.com (clattner at apple.com) Date: Tue, 29 May 2007 22:38:40 -0700 (PDT) Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of Message-ID: <20070530053840.5113259B05AC@src> Revision: 127801 Author: clattner Date: 2007-05-29 22:38:39 -0700 (Tue, 29 May 2007) Log Message: ----------- When an LLVM type has struct padding that overlaps with important fields of GCC types, use memcpy to copy them instead of copying the llvm fields. This helps address PR1421, testcase here: test/CFrontend/2007-05-29-UnionCopy.c Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-convert.cpp apple-local/branches/llvm/gcc/llvm-internal.h apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-30 04:14:52 UTC (rev 127800) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-30 05:38:39 UTC (rev 127801) @@ -1177,15 +1177,16 @@ TREE_INT_CST_LOW(TYPE_SIZE_UNIT(type)) < TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY) { const Type *LLVMTy = ConvertType(type); - if (CountAggregateElements(LLVMTy) <= 8) { + + // If the GCC type is not fully covered by the LLVM type, use memcpy. This + // can occur with unions etc. + if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) && + // Don't copy tons of tiny elements. + CountAggregateElements(LLVMTy) <= 8) { DestPtr = CastToType(Instruction::BitCast, DestPtr, PointerType::get(LLVMTy)); SrcPtr = CastToType(Instruction::BitCast, SrcPtr, PointerType::get(LLVMTy)); - - // FIXME: Is this always safe? The LLVM type might theoretically have - // holes or might be suboptimal to copy this way. It may be better to - // copy the structure by the GCCType's fields. CopyAggregate(DestPtr, SrcPtr, isDstVolatile, isSrcVolatile, Builder); return; } Modified: apple-local/branches/llvm/gcc/llvm-internal.h =================================================================== --- apple-local/branches/llvm/gcc/llvm-internal.h 2007-05-30 04:14:52 UTC (rev 127800) +++ apple-local/branches/llvm/gcc/llvm-internal.h 2007-05-30 05:38:39 UTC (rev 127801) @@ -1,6 +1,6 @@ /* APPLE LOCAL begin LLVM (ENTIRE FILE!) */ /* Internal interfaces between the LLVM backend components -Copyright (C) 2005 Free Software Foundation, Inc. +Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Chris Lattner (sabre at nondot.org) This file is part of GCC. @@ -119,6 +119,12 @@ const Type *ConvertType(tree_node *type); + /// GCCTypeOverlapsWithLLVMTypePadding - Return true if the specified GCC type + /// has any data that overlaps with structure padding in the specified LLVM + /// type. + static bool GCCTypeOverlapsWithLLVMTypePadding(tree_node *t, const Type *Ty); + + /// ConvertFunctionType - Convert the specified FUNCTION_TYPE or METHOD_TYPE /// tree to an LLVM type. This does the same thing that ConvertType does, but /// it also returns the function's LLVM calling convention. Modified: apple-local/branches/llvm/gcc/llvm-types.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-30 04:14:52 UTC (rev 127800) +++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-30 05:38:39 UTC (rev 127801) @@ -1,6 +1,6 @@ /* APPLE LOCAL begin LLVM (ENTIRE FILE!) */ /* Tree type to LLVM type converter -Copyright (C) 2005 Free Software Foundation, Inc. +Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Chris Lattner (sabre at nondot.org) This file is part of GCC. @@ -446,7 +446,169 @@ std::cerr << "TypeRefinementDatabase\n"; } +//===----------------------------------------------------------------------===// +// Helper Routines +//===----------------------------------------------------------------------===// +/// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a +/// structure. +static unsigned getFieldOffsetInBits(tree Field) { + assert(DECL_FIELD_BIT_OFFSET(Field) != 0 && DECL_FIELD_OFFSET(Field) != 0); + unsigned Result = TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(Field)); + if (TREE_CODE(DECL_FIELD_OFFSET(Field)) == INTEGER_CST) + Result += TREE_INT_CST_LOW(DECL_FIELD_OFFSET(Field))*8; + return Result; +} + + +/// FindLLVMTypePadding - If the specified struct has any inter-element padding, +/// add it to the Padding array. +static void FindLLVMTypePadding(const Type *Ty, unsigned BitOffset, + SmallVector, 16> &Padding) { + if (const StructType *STy = dyn_cast(Ty)) { + const TargetData &TD = getTargetData(); + const StructLayout *SL = TD.getStructLayout(STy); + unsigned PrevFieldBitOffset = 0; + for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { + unsigned FieldBitOffset = SL->getElementOffset(i)*8; + + // Get padding of sub-elements. + FindLLVMTypePadding(STy->getElementType(i), + BitOffset+FieldBitOffset, Padding); + // Check to see if there is any padding between this element and the + // previous one. + if (i) { + unsigned PrevFieldEnd = + PrevFieldBitOffset+TD.getTypeSizeInBits(STy->getElementType(i-1)); + if (PrevFieldEnd < FieldBitOffset) + Padding.push_back(std::make_pair(PrevFieldEnd+BitOffset, + FieldBitOffset-PrevFieldEnd)); + } + + PrevFieldBitOffset = FieldBitOffset; + } + + // Check for tail padding. + if (unsigned EltCount = STy->getNumElements()) { + unsigned PrevFieldEnd = PrevFieldBitOffset + + TD.getTypeSizeInBits(STy->getElementType(EltCount-1)); + if (PrevFieldEnd < SL->getSizeInBytes()*8) + Padding.push_back(std::make_pair(PrevFieldEnd, + SL->getSizeInBytes()*8-PrevFieldEnd)); + } + + } else if (const ArrayType *ATy = dyn_cast(Ty)) { + unsigned EltSize = getTargetData().getTypeSizeInBits(ATy->getElementType()); + for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) + FindLLVMTypePadding(ATy->getElementType(), BitOffset+i*EltSize, Padding); + } + + // primitive and vector types have no padding. +} + +/// GCCTypeOverlapsWithPadding - Return true if the specified gcc type overlaps +/// with the specified region of padding. This only needs to handle types with +/// a constant size. +static bool GCCTypeOverlapsWithPadding(tree type, int PadStartBits, + int PadSizeBits) { + assert(type != error_mark_node); + // LLVM doesn't care about variants such as const, volatile, or restrict. + type = TYPE_MAIN_VARIANT(type); + + // If the type does not overlap, don't bother checking below. + if (TYPE_SIZE(type) == 0 || + PadStartBits >= int(TREE_INT_CST_LOW(TYPE_SIZE(type))) || + PadStartBits+PadSizeBits <= 0) + return false; + + + switch (TREE_CODE(type)) { + default: + fprintf(stderr, "Unknown type to compare:\n"); + debug_tree(type); + abort(); + case VOID_TYPE: + case BOOLEAN_TYPE: + case ENUMERAL_TYPE: + case INTEGER_TYPE: + case REAL_TYPE: + case COMPLEX_TYPE: + case VECTOR_TYPE: + case POINTER_TYPE: + case REFERENCE_TYPE: + // These types have no holes. + return true; + + case ARRAY_TYPE: { + unsigned EltSizeBits = TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(type))); + unsigned NumElts = getInt64(arrayLength(type), true); + unsigned OverlapElt = (unsigned)PadStartBits/EltSizeBits; + + // Check each element for overlap. This is inelegant, but effective. + for (unsigned i = 0; i != NumElts; ++i) + if (GCCTypeOverlapsWithPadding(TREE_TYPE(type), + PadStartBits- i*EltSizeBits, PadSizeBits)) + return true; + return false; + } + case UNION_TYPE: { + // If this is a union with the transparent_union attribute set, it is + // treated as if it were just the same as its first type. + if (TYPE_TRANSPARENT_UNION(type)) { + tree Field = TYPE_FIELDS(type); + assert(Field && "Transparent union must have some elements!"); + while (TREE_CODE(Field) != FIELD_DECL) { + Field = TREE_CHAIN(Field); + assert(Field && "Transparent union must have some elements!"); + } + return GCCTypeOverlapsWithPadding(TREE_TYPE(Field), + PadStartBits, PadSizeBits); + } + + // See if any elements overlap. + for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) { + if (TREE_CODE(Field) != FIELD_DECL) continue; + assert(getFieldOffsetInBits(Field) == 0 && "Union with non-zero offset?"); + + if (GCCTypeOverlapsWithPadding(TREE_TYPE(Field), + PadStartBits, PadSizeBits)) + return true; + } + + return false; + } + + case RECORD_TYPE: + for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) { + if (TREE_CODE(Field) != FIELD_DECL) continue; + + if (TREE_CODE(DECL_FIELD_OFFSET(Field)) != INTEGER_CST) + return true; + + unsigned FieldBitOffset = getFieldOffsetInBits(Field); + if (GCCTypeOverlapsWithPadding(TREE_TYPE(Field), + PadStartBits+FieldBitOffset, PadSizeBits)) + return true; + } + return false; + } +} + +bool TypeConverter::GCCTypeOverlapsWithLLVMTypePadding(tree type, + const Type *Ty) { + + // Start by finding all of the padding in the LLVM Type. + SmallVector, 16> StructPadding; + FindLLVMTypePadding(Ty, 0, StructPadding); + + for (unsigned i = 0, e = StructPadding.size(); i != e; ++i) + if (GCCTypeOverlapsWithPadding(type, StructPadding[i].first, + StructPadding[i].second)) + return true; + return false; +} + + //===----------------------------------------------------------------------===// // Main Type Conversion Routines //===----------------------------------------------------------------------===// @@ -628,10 +790,10 @@ if (!length) { // We get here if we have something that is globally declared as an // array with no dimension, this becomes just a zero size array of the - // element type so that: int X[] becomes *'%X = external global [0 x int]' + // element type so that: int X[] becomes '%X = external global [0x i32]' // - // Note that this also affects new expressions, which return a pointer to - // an unsized array of elements. + // Note that this also affects new expressions, which return a pointer + // to an unsized array of elements. NumElements = 0; } else if (!isInt64(length, true)) { // A variable length array where the element type has size zero. Turn @@ -945,7 +1107,8 @@ const Type *getLLVMType() const { // Use Packed type if Packed is set or all struct fields are bitfields. // Empty struct is not packed unless packed is set. - return StructType::get(Elements, Packed || (!Elements.empty() && AllBitFields)); + return StructType::get(Elements, + Packed || (!Elements.empty() && AllBitFields)); } /// getSizeAsLLVMStruct - Return the size of this struct if it were converted @@ -1182,7 +1345,8 @@ const Type *Pad = Type::Int8Ty; Pad = ArrayType::get(Pad, padding); ElementOffsetInBytes.insert(ElementOffsetInBytes.begin() + x, - ElementOffsetInBytes[x-1] + ElementSizeInBytes[x-1]); + ElementOffsetInBytes[x-1] + + ElementSizeInBytes[x-1]); ElementSizeInBytes.insert(ElementSizeInBytes.begin() + x, padding); Elements.insert(Elements.begin() + x, Pad); PaddingElement.insert(PaddingElement.begin() + x, true); @@ -1275,16 +1439,6 @@ } -/// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a -/// structure. -static unsigned getFieldOffsetInBits(tree Field) { - assert(DECL_FIELD_BIT_OFFSET(Field) != 0 && DECL_FIELD_OFFSET(Field) != 0); - unsigned Result = TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(Field)); - if (TREE_CODE(DECL_FIELD_OFFSET(Field)) == INTEGER_CST) - Result += TREE_INT_CST_LOW(DECL_FIELD_OFFSET(Field))*8; - return Result; -} - /// DecodeStructFields - This method decodes the specified field, if it is a /// FIELD_DECL, adding or updating the specified StructTypeConversionInfo to /// reflect it. From sabre at nondot.org Wed May 30 01:11:08 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 May 2007 01:11:08 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll Message-ID: <200705300611.l4U6B814017534@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/ScalarRepl: 2007-05-29-MemcpyPreserve.ll added (r1.1) --- Log message: Testcase for PR1421: http://llvm.org/PR1421 --- Diffs of the changes: (+23 -0) 2007-05-29-MemcpyPreserve.ll | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll diff -c /dev/null llvm/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll:1.1 *** /dev/null Wed May 30 01:10:56 2007 --- llvm/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll Wed May 30 01:10:46 2007 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep memcpy + ; PR1421 + + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" + target triple = "i686-apple-darwin8" + %struct.LongestMember = type { i8, i32 } + %struct.MyString = type { i32 } + %struct.UnionType = type { %struct.LongestMember } + + define void @_Z4testP9UnionTypePS0_(%struct.UnionType* %p, %struct.UnionType** %pointerToUnion) { + entry: + %tmp = alloca %struct.UnionType, align 8 ; <%struct.UnionType*> [#uses=2] + %tmp2 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 ; [#uses=1] + %tmp13 = getelementptr %struct.UnionType* %p, i32 0, i32 0, i32 0 ; [#uses=1] + call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 8, i32 0 ) + %tmp5 = load %struct.UnionType** %pointerToUnion ; <%struct.UnionType*> [#uses=1] + %tmp56 = getelementptr %struct.UnionType* %tmp5, i32 0, i32 0, i32 0 ; [#uses=1] + %tmp7 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 ; [#uses=1] + call void @llvm.memcpy.i32( i8* %tmp56, i8* %tmp7, i32 8, i32 0 ) + ret void + } + + declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) From sabre at nondot.org Wed May 30 01:11:45 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 May 2007 01:11:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200705300611.l4U6Bj7T017554@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.95 -> 1.96 --- Log message: Fix Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll and the second half of PR1421: http://llvm.org/PR1421 , by not decimating structs with holes that are the source and destination of a memcpy. --- Diffs of the changes: (+148 -48) ScalarReplAggregates.cpp | 196 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 148 insertions(+), 48 deletions(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.95 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.96 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.95 Thu May 24 13:43:04 2007 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed May 30 01:11:23 2007 @@ -65,11 +65,41 @@ } private: - int isSafeElementUse(Value *Ptr, bool isFirstElt, AllocationInst *AI); - int isSafeUseOfAllocation(Instruction *User, AllocationInst *AI); - bool isSafeMemIntrinsicOnAllocation(MemIntrinsic *MI, AllocationInst *AI); - bool isSafeUseOfBitCastedAllocation(BitCastInst *User, AllocationInst *AI); + /// AllocaInfo - When analyzing uses of an alloca instruction, this captures + /// information about the uses. All these fields are initialized to false + /// and set to true when something is learned. + struct AllocaInfo { + /// isUnsafe - This is set to true if the alloca cannot be SROA'd. + bool isUnsafe : 1; + + /// needsCanon - This is set to true if there is some use of the alloca + /// that requires canonicalization. + bool needsCanon : 1; + + /// isMemCpySrc - This is true if this aggregate is memcpy'd from. + bool isMemCpySrc : 1; + + /// isMemCpyDst - This is true if this aggregate is memcpy'd info. + bool isMemCpyDst : 1; + + AllocaInfo() + : isUnsafe(false), needsCanon(false), + isMemCpySrc(false), isMemCpyDst(false) {} + }; + + void MarkUnsafe(AllocaInfo &I) { I.isUnsafe = true; } + int isSafeAllocaToScalarRepl(AllocationInst *AI); + + void isSafeUseOfAllocation(Instruction *User, AllocationInst *AI, + AllocaInfo &Info); + void isSafeElementUse(Value *Ptr, bool isFirstElt, AllocationInst *AI, + AllocaInfo &Info); + void isSafeMemIntrinsicOnAllocation(MemIntrinsic *MI, AllocationInst *AI, + unsigned OpNo, AllocaInfo &Info); + void isSafeUseOfBitCastedAllocation(BitCastInst *User, AllocationInst *AI, + AllocaInfo &Info); + void DoScalarReplacement(AllocationInst *AI, std::vector &WorkList); void CanonicalizeAllocaUsers(AllocationInst *AI); @@ -320,7 +350,8 @@ /// getelementptr instruction of an array aggregate allocation. isFirstElt /// indicates whether Ptr is known to the start of the aggregate. /// -int SROA::isSafeElementUse(Value *Ptr, bool isFirstElt, AllocationInst *AI) { +void SROA::isSafeElementUse(Value *Ptr, bool isFirstElt, AllocationInst *AI, + AllocaInfo &Info) { for (Value::use_iterator I = Ptr->use_begin(), E = Ptr->use_end(); I != E; ++I) { Instruction *User = cast(*I); @@ -328,7 +359,7 @@ case Instruction::Load: break; case Instruction::Store: // Store is ok if storing INTO the pointer, not storing the pointer - if (User->getOperand(0) == Ptr) return 0; + if (User->getOperand(0) == Ptr) return MarkUnsafe(Info); break; case Instruction::GetElementPtr: { GetElementPtrInst *GEP = cast(User); @@ -336,7 +367,8 @@ if (GEP->getNumOperands() > 1) { if (!isa(GEP->getOperand(1)) || !cast(GEP->getOperand(1))->isZero()) - return 0; // Using pointer arithmetic to navigate the array. + // Using pointer arithmetic to navigate the array. + return MarkUnsafe(Info); if (AreAllZeroIndices) { for (unsigned i = 2, e = GEP->getNumOperands(); i != e; ++i) { @@ -348,28 +380,34 @@ } } } - if (!isSafeElementUse(GEP, AreAllZeroIndices, AI)) return 0; + isSafeElementUse(GEP, AreAllZeroIndices, AI, Info); + if (Info.isUnsafe) return; break; } case Instruction::BitCast: - if (isFirstElt && - isSafeUseOfBitCastedAllocation(cast(User), AI)) + if (isFirstElt) { + isSafeUseOfBitCastedAllocation(cast(User), AI, Info); + if (Info.isUnsafe) return; break; + } DOUT << " Transformation preventing inst: " << *User; - return 0; + return MarkUnsafe(Info); case Instruction::Call: if (MemIntrinsic *MI = dyn_cast(User)) { - if (isFirstElt && isSafeMemIntrinsicOnAllocation(MI, AI)) + if (isFirstElt) { + isSafeMemIntrinsicOnAllocation(MI, AI, I.getOperandNo(), Info); + if (Info.isUnsafe) return; break; + } } DOUT << " Transformation preventing inst: " << *User; - return 0; + return MarkUnsafe(Info); default: DOUT << " Transformation preventing inst: " << *User; - return 0; + return MarkUnsafe(Info); } } - return 3; // All users look ok :) + return; // All users look ok :) } /// AllUsersAreLoads - Return true if all users of this value are loads. @@ -384,21 +422,25 @@ /// isSafeUseOfAllocation - Check to see if this user is an allowed use for an /// aggregate allocation. /// -int SROA::isSafeUseOfAllocation(Instruction *User, AllocationInst *AI) { +void SROA::isSafeUseOfAllocation(Instruction *User, AllocationInst *AI, + AllocaInfo &Info) { if (BitCastInst *C = dyn_cast(User)) - return isSafeUseOfBitCastedAllocation(C, AI) ? 3 : 0; - if (!isa(User)) return 0; + return isSafeUseOfBitCastedAllocation(C, AI, Info); + + GetElementPtrInst *GEPI = dyn_cast(User); + if (GEPI == 0) + return MarkUnsafe(Info); - GetElementPtrInst *GEPI = cast(User); gep_type_iterator I = gep_type_begin(GEPI), E = gep_type_end(GEPI); // The GEP is not safe to transform if not of the form "GEP , 0, ". if (I == E || - I.getOperand() != Constant::getNullValue(I.getOperand()->getType())) - return 0; + I.getOperand() != Constant::getNullValue(I.getOperand()->getType())) { + return MarkUnsafe(Info); + } ++I; - if (I == E) return 0; // ran out of GEP indices?? + if (I == E) return MarkUnsafe(Info); // ran out of GEP indices?? bool IsAllZeroIndices = true; @@ -413,7 +455,7 @@ // something funny is going on, so we won't do the optimization. // if (Idx->getZExtValue() >= NumElements) - return 0; + return MarkUnsafe(Info); // We cannot scalar repl this level of the array unless any array // sub-indices are in-range constants. In particular, consider: @@ -430,9 +472,9 @@ NumElements = cast(*I)->getNumElements(); ConstantInt *IdxVal = dyn_cast(I.getOperand()); - if (!IdxVal) return 0; + if (!IdxVal) return MarkUnsafe(Info); if (IdxVal->getZExtValue() >= NumElements) - return 0; + return MarkUnsafe(Info); IsAllZeroIndices &= IdxVal->isZero(); } @@ -444,53 +486,62 @@ // it, in which case we CAN promote it, but we have to canonicalize this // out if this is the only problem. if ((NumElements == 1 || NumElements == 2) && - AllUsersAreLoads(GEPI)) - return 1; // Canonicalization required! - return 0; + AllUsersAreLoads(GEPI)) { + Info.needsCanon = true; + return; // Canonicalization required! + } + return MarkUnsafe(Info); } } // If there are any non-simple uses of this getelementptr, make sure to reject // them. - return isSafeElementUse(GEPI, IsAllZeroIndices, AI); + return isSafeElementUse(GEPI, IsAllZeroIndices, AI, Info); } /// isSafeMemIntrinsicOnAllocation - Return true if the specified memory /// intrinsic can be promoted by SROA. At this point, we know that the operand /// of the memintrinsic is a pointer to the beginning of the allocation. -bool SROA::isSafeMemIntrinsicOnAllocation(MemIntrinsic *MI, AllocationInst *AI){ +void SROA::isSafeMemIntrinsicOnAllocation(MemIntrinsic *MI, AllocationInst *AI, + unsigned OpNo, AllocaInfo &Info) { // If not constant length, give up. ConstantInt *Length = dyn_cast(MI->getLength()); - if (!Length) return false; + if (!Length) return MarkUnsafe(Info); // If not the whole aggregate, give up. const TargetData &TD = getAnalysis(); if (Length->getZExtValue() != TD.getTypeSize(AI->getType()->getElementType())) - return false; + return MarkUnsafe(Info); // We only know about memcpy/memset/memmove. if (!isa(MI) && !isa(MI) && !isa(MI)) - return false; - // Otherwise, we can transform it. - return true; + return MarkUnsafe(Info); + + // Otherwise, we can transform it. Determine whether this is a memcpy/set + // into or out of the aggregate. + if (OpNo == 1) + Info.isMemCpyDst = true; + else { + assert(OpNo == 2); + Info.isMemCpySrc = true; + } } /// isSafeUseOfBitCastedAllocation - Return true if all users of this bitcast /// are -bool SROA::isSafeUseOfBitCastedAllocation(BitCastInst *BC, AllocationInst *AI) { +void SROA::isSafeUseOfBitCastedAllocation(BitCastInst *BC, AllocationInst *AI, + AllocaInfo &Info) { for (Value::use_iterator UI = BC->use_begin(), E = BC->use_end(); UI != E; ++UI) { if (BitCastInst *BCU = dyn_cast(UI)) { - if (!isSafeUseOfBitCastedAllocation(BCU, AI)) - return false; + isSafeUseOfBitCastedAllocation(BCU, AI, Info); } else if (MemIntrinsic *MI = dyn_cast(UI)) { - if (!isSafeMemIntrinsicOnAllocation(MI, AI)) - return false; + isSafeMemIntrinsicOnAllocation(MI, AI, UI.getOperandNo(), Info); } else { - return false; + return MarkUnsafe(Info); } + if (Info.isUnsafe) return; } - return true; } /// RewriteBitCastUserOfAlloca - BCInst (transitively) bitcasts AI, or indexes @@ -668,6 +719,44 @@ } } +/// HasStructPadding - Return true if the specified type has any structure +/// padding, false otherwise. +static bool HasStructPadding(const Type *Ty, const TargetData &TD) { + if (const StructType *STy = dyn_cast(Ty)) { + const StructLayout *SL = TD.getStructLayout(STy); + unsigned PrevFieldBitOffset = 0; + for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { + unsigned FieldBitOffset = SL->getElementOffset(i)*8; + + // Padding in sub-elements? + if (HasStructPadding(STy->getElementType(i), TD)) + return true; + + // Check to see if there is any padding between this element and the + // previous one. + if (i) { + unsigned PrevFieldEnd = + PrevFieldBitOffset+TD.getTypeSizeInBits(STy->getElementType(i-1)); + if (PrevFieldEnd < FieldBitOffset) + return true; + } + + PrevFieldBitOffset = FieldBitOffset; + } + + // Check for tail padding. + if (unsigned EltCount = STy->getNumElements()) { + unsigned PrevFieldEnd = PrevFieldBitOffset + + TD.getTypeSizeInBits(STy->getElementType(EltCount-1)); + if (PrevFieldEnd < SL->getSizeInBytes()*8) + return true; + } + + } else if (const ArrayType *ATy = dyn_cast(Ty)) { + return HasStructPadding(ATy->getElementType(), TD); + } + return false; +} /// isSafeStructAllocaToScalarRepl - Check to see if the specified allocation of /// an aggregate can be broken down into elements. Return 0 if not, 3 if safe, @@ -676,18 +765,29 @@ int SROA::isSafeAllocaToScalarRepl(AllocationInst *AI) { // Loop over the use list of the alloca. We can only transform it if all of // the users are safe to transform. - // - int isSafe = 3; + AllocaInfo Info; + for (Value::use_iterator I = AI->use_begin(), E = AI->use_end(); I != E; ++I) { - isSafe &= isSafeUseOfAllocation(cast(*I), AI); - if (isSafe == 0) { + isSafeUseOfAllocation(cast(*I), AI, Info); + if (Info.isUnsafe) { DOUT << "Cannot transform: " << *AI << " due to user: " << **I; return 0; } } - // If we require cleanup, isSafe is now 1, otherwise it is 3. - return isSafe; + + // Okay, we know all the users are promotable. If the aggregate is a memcpy + // source and destination, we have to be careful. In particular, the memcpy + // could be moving around elements that live in structure padding of the LLVM + // types, but may actually be used. In these cases, we refuse to promote the + // struct. + if (Info.isMemCpySrc && Info.isMemCpyDst && + HasStructPadding(AI->getType()->getElementType(), + getAnalysis())) + return 0; + + // If we require cleanup, return 1, otherwise return 3. + return Info.needsCanon ? 1 : 3; } /// CanonicalizeAllocaUsers - If SROA reported that it can promote the specified From clattner at apple.com Wed May 30 01:23:42 2007 From: clattner at apple.com (clattner at apple.com) Date: Tue, 29 May 2007 23:23:42 -0700 (PDT) Subject: [llvm-commits] [127802] Fix thinko, fixing PR1421. Message-ID: <20070530062342.158D259C0170@src> Revision: 127802 Author: clattner Date: 2007-05-29 23:23:41 -0700 (Tue, 29 May 2007) Log Message: ----------- Fix thinko, fixing PR1421. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-30 05:38:39 UTC (rev 127801) +++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-30 06:23:41 UTC (rev 127802) @@ -587,7 +587,7 @@ unsigned FieldBitOffset = getFieldOffsetInBits(Field); if (GCCTypeOverlapsWithPadding(TREE_TYPE(Field), - PadStartBits+FieldBitOffset, PadSizeBits)) + PadStartBits-FieldBitOffset, PadSizeBits)) return true; } return false; From baldrick at free.fr Wed May 30 05:16:40 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 30 May 2007 05:16:40 -0500 Subject: [llvm-commits] CVS: llvm/test/C++Frontend/2007-05-23-TryFinally.cpp Message-ID: <200705301016.l4UAGetd031523@zion.cs.uiuc.edu> Changes in directory llvm/test/C++Frontend: 2007-05-23-TryFinally.cpp added (r1.1) --- Log message: Testcase for http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070528/050047.html --- Diffs of the changes: (+15 -0) 2007-05-23-TryFinally.cpp | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/test/C++Frontend/2007-05-23-TryFinally.cpp diff -c /dev/null llvm/test/C++Frontend/2007-05-23-TryFinally.cpp:1.1 *** /dev/null Wed May 30 05:16:29 2007 --- llvm/test/C++Frontend/2007-05-23-TryFinally.cpp Wed May 30 05:16:19 2007 *************** *** 0 **** --- 1,15 ---- + // RUN: %llvmgxx %s -S -emit-llvm -O2 -o - | grep _Unwind_Resume | wc -l | grep {\[03\]} + + struct One { }; + struct Two { }; + + void handle_unexpected () { + try + { + throw; + } + catch (One &) + { + throw Two (); + } + } From asl at math.spbu.ru Wed May 30 06:39:29 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 30 May 2007 06:39:29 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2007-05-31-Switch-Lowering.html 2007-05-31-Switch-Lowering.pdf index.html Message-ID: <200705301139.l4UBdTrJ000577@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2007-05-31-Switch-Lowering.html added (r1.1) 2007-05-31-Switch-Lowering.pdf added (r1.1) index.html updated: 1.49 -> 1.50 --- Log message: Add my paper --- Diffs of the changes: (+68 -1) 2007-05-31-Switch-Lowering.html | 62 ++++++++++++++++++++++++++++++++++++++++ 2007-05-31-Switch-Lowering.pdf | 0 index.html | 7 +++- 3 files changed, 68 insertions(+), 1 deletion(-) Index: llvm-www/pubs/2007-05-31-Switch-Lowering.html diff -c /dev/null llvm-www/pubs/2007-05-31-Switch-Lowering.html:1.1 *** /dev/null Wed May 30 06:39:10 2007 --- llvm-www/pubs/2007-05-31-Switch-Lowering.html Wed May 30 06:39:00 2007 *************** *** 0 **** --- 1,62 ---- + + + + + + Improving Switch Lowering for The LLVM Compiler System + + + +
    + Improving Switch Lowering for The LLVM Compiler System +
    + + +

    Abstract:

    +
    + Switch-case statements (or switches) provide a natural way to express multiway + branching control flow semantics. They are common in many applications including + compilers, parsers, text processing programs, virtual machines. Various + optimizations for switches has been studied for many years. This paper presents + the description of switch lowering refactoring recently made for the LLVM + Compiler System. +
    + +

    Published:

    +
    + "Improving Switch Lowering for The LLVM Compiler System"
    + Anton Korobeynikov
    + Proc. of the 2007 Spring Young Researchers Colloquium on Software + Engineering (SYRCoSE'2007), Moscow, Russia, May, 2007. +
    + +

    Download:

    +

    Paper:

    + + +

    BibTeX Entry:

    +
    +   @InProceedings{SYRCoSE:SwitchLowering,
    +     author    = {Anton Korobeynikov},
    +     title     = "{Improving Switch Lowering for The LLVM Compiler System}",
    +     booktitle = "{Proceedings of the 2007 Spring Young Researchers Colloquium on Software Engineering (SYRCoSE'2007)}",
    +     address   = {Moscow, Russia},
    +     month     = {May},
    +     year      = {2007}
    +   }
    + 
    + + +
    + Valid CSS! + Valid HTML 4.01! + + + Index: llvm-www/pubs/2007-05-31-Switch-Lowering.pdf Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.49 llvm-www/pubs/index.html:1.50 --- llvm-www/pubs/index.html:1.49 Fri Apr 27 01:45:08 2007 +++ llvm-www/pubs/index.html Wed May 30 06:39:00 2007 @@ -15,13 +15,18 @@ Proc. of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'07), San Diego, CA, Jun, 2007.
    +
  • "Improving Switch Lowering for + The LLVM Compiler System"
    + Anton Korobeynikov.
    + Proc. of the 2007 Spring Young Researchers Colloquium on Software + Engineering (SYRCoSE'2007), Moscow, Russia, May, 2007.
  • +
  • "A Change Framework based on the Low Level Virtual Machine Compiler Infrastructure"
    Jakob Praher
    Masters Thesis, Institute for System Software Johannes Kepler University Linz, April 2007.
  • -
  • "An Aspect for Idiom-based Exception Handling (using local continuation join points, join point properties, annotations and type parameters)"
    From dpatel at apple.com Wed May 30 10:30:08 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 30 May 2007 10:30:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp Message-ID: <200705301530.l4UFU8Hl006214@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LICM.cpp updated: 1.100 -> 1.101 --- Log message: Fix typo. --- Diffs of the changes: (+1 -1) LICM.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.100 llvm/lib/Transforms/Scalar/LICM.cpp:1.101 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.100 Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Scalar/LICM.cpp Wed May 30 10:29:37 2007 @@ -223,7 +223,7 @@ ET = &getAnalysis(); CurAST = new AliasSetTracker(*AA); - // Collect Alias info frmo subloops + // Collect Alias info from subloops for (Loop::iterator LoopItr = L->begin(), LoopItrE = L->end(); LoopItr != LoopItrE; ++LoopItr) { Loop *InnerL = *LoopItr; From sabre at nondot.org Wed May 30 11:29:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 May 2007 11:29:39 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll Message-ID: <200705301629.l4UGTd1Y008769@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/PowerPC: 2007-05-30-dagcombine-miscomp.ll added (r1.1) --- Log message: new testcase for PR1473: http://llvm.org/PR1473 --- Diffs of the changes: (+14 -0) 2007-05-30-dagcombine-miscomp.ll | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/test/CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll diff -c /dev/null llvm/test/CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll:1.1 *** /dev/null Wed May 30 11:29:30 2007 --- llvm/test/CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll Wed May 30 11:29:20 2007 *************** *** 0 **** --- 1,14 ---- + target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" + target triple = "powerpc-apple-darwin8.8.0" + + ; RUN: llvm-as < %s | llc -march=ppc32 | grep {rlwinm r3, r3, 23, 30, 30} + ; PR1473 + + define i8 @foo(i16 zext %a) zext { + %tmp2 = lshr i16 %a, 10 ; [#uses=1] + %tmp23 = trunc i16 %tmp2 to i8 ; [#uses=1] + %tmp4 = shl i8 %tmp23, 1 ; [#uses=1] + %tmp5 = and i8 %tmp4, 2 ; [#uses=1] + ret i8 %tmp5 + } + From sabre at nondot.org Wed May 30 11:30:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 May 2007 11:30:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Message-ID: <200705301630.l4UGUPqO008852@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.118 -> 1.119 --- Log message: Fix CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll, and PR1473: http://llvm.org/PR1473 . --- Diffs of the changes: (+1 -1) TargetLowering.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.118 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.119 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.118 Fri May 18 19:46:51 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed May 30 11:30:06 2007 @@ -587,7 +587,7 @@ } SDOperand NewSA = - TLO.DAG.getConstant(ShAmt-C1, Op.getOperand(1).getValueType()); + TLO.DAG.getConstant(Diff, Op.getOperand(1).getValueType()); MVT::ValueType VT = Op.getValueType(); return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, VT, InOp.getOperand(0), NewSA)); From evan.cheng at apple.com Wed May 30 12:44:33 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 30 May 2007 12:44:33 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp Message-ID: <200705301744.l4UHiXrk011535@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C++/life: life.cpp updated: 1.2 -> 1.3 --- Log message: Add SMALL_PROBLEM_SIZE support. --- Diffs of the changes: (+4 -0) life.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp:1.2 llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp:1.3 --- llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp:1.2 Mon Oct 4 21:44:05 2004 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp Wed May 30 12:44:14 2007 @@ -4,7 +4,11 @@ const int N=40, STATES=4; // size of square board const int DRAB=3; const int DFOX=8; +#ifdef SMALL_PROBLEM_SIZE +const int CYCLES=1000 +#else const int CYCLES=10000; +#endif enum state { EMPTY, GRASS, RABBIT, FOX }; class living; // forward decl From evan.cheng at apple.com Wed May 30 12:50:12 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 30 May 2007 12:50:12 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200705301750.l4UHoCS5011956@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.267 -> 1.268 --- Log message: Change llcbeta for various targets now that tail merging is on by default for all targets except for ppc. --- Diffs of the changes: (+3 -4) Makefile.programs | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.267 llvm-test/Makefile.programs:1.268 --- llvm-test/Makefile.programs:1.267 Thu May 10 17:28:56 2007 +++ llvm-test/Makefile.programs Wed May 30 12:49:53 2007 @@ -235,18 +235,17 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-tail-merge -#-regalloc=local -fast +LLCBETAOPTION := -regalloc=local -fast endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts endif ifeq ($(ARCH),ARM) -LLCBETAOPTION := --enable-tail-merge +LLCBETAOPTION := -enable-arm-if-conversion #-march=thumb endif ifeq ($(ARCH),THUMB) -LLCBETAOPTION := --enable-tail-merge +LLCBETAOPTION := --enable-thumb-reg-scavenging endif print-llcbeta-option: From dpatel at apple.com Wed May 30 13:12:11 2007 From: dpatel at apple.com (dpatel at apple.com) Date: Wed, 30 May 2007 11:12:11 -0700 (PDT) Subject: [llvm-commits] [127823] Set __APPLE_CC__ value to base gcc build number Message-ID: <20070530181211.0FC445B427EE@src> Revision: 127823 Author: dpatel Date: 2007-05-30 11:12:10 -0700 (Wed, 30 May 2007) Log Message: ----------- Set __APPLE_CC__ value to base gcc build number instead of llvm build number. Modified Paths: -------------- apple-local/branches/llvm/gcc/c-cppbuiltin.c apple-local/branches/llvm/gcc/version.c Modified: apple-local/branches/llvm/gcc/c-cppbuiltin.c =================================================================== --- apple-local/branches/llvm/gcc/c-cppbuiltin.c 2007-05-30 15:40:29 UTC (rev 127822) +++ apple-local/branches/llvm/gcc/c-cppbuiltin.c 2007-05-30 18:12:10 UTC (rev 127823) @@ -329,24 +329,37 @@ /* APPLE LOCAL begin LLVM version number */ #else #ifdef CONFIG_DARWIN_H + /* This chunk of code defines __APPLE_CC__ from the version + string. It expects to see a substring of the version string of + the form "build NNNN)", where each N is a digit, and the first + N is nonzero (there can be 4 or 5 digits). It will abort() if + these conditions are not met, since that usually means that + someone's broken the version string. */ + /* LLVM builds multiple different ways. For example, for official releases, the version number is something like "1.8". We don't want to disable __APPLE_CC__ entirely, as this breaks system headers. If the build number - is not a 4-digit code, just define __APPLE_CC__ to 1. + is not a 4-digit code, just define __APPLE_CC__ to 1 instead of abort()ing + as per above comment. */ { - char Version[] = LLVM_VERSION_INFO; - if (! ISDIGIT (Version[0]) - || ! ISDIGIT (Version[1]) - || ! ISDIGIT (Version[2]) - || ! ISDIGIT (Version[3]) - || Version[4] != 0) { - Version[0] = '1'; - Version[1] = '\0'; - builtin_define_with_value_n ("__APPLE_CC__", Version, 1); - } else { - builtin_define_with_value_n ("__APPLE_CC__", Version, 4); - } + const char *vt; + + vt = strstr (version_string, "build "); + if (vt == NULL) + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + + vt += strlen ("build "); + if (! ISDIGIT (*vt)) + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + for (q = vt; *q != 0 && ISDIGIT (*q); q++) + ; + if (q == vt || *q != ')') + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + + if ((q - vt != 4 && q - vt != 5) || *vt == '0') + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt); } #endif /*CONFIG_DARWIN_H*/ #endif /*LLVM_VERSION_INFO*/ Modified: apple-local/branches/llvm/gcc/version.c =================================================================== --- apple-local/branches/llvm/gcc/version.c 2007-05-30 15:40:29 UTC (rev 127822) +++ apple-local/branches/llvm/gcc/version.c 2007-05-30 18:12:10 UTC (rev 127823) @@ -16,17 +16,15 @@ to get version number string. Do not use new line. */ -const char version_string[] = "4.0.1 " +const char version_string[] = "4.0.1 (Apple Computer, Inc. build 5449)" #ifdef ENABLE_LLVM - "LLVM " -#endif - "(Apple Computer, Inc. build " + "(LLVM build " #ifdef LLVM_VERSION_INFO LLVM_VERSION_INFO -#else - "5449" #endif - ")"; + ")" +#endif + ; /* APPLE LOCAL end Apple version */ /* This is the location of the online document giving instructions for From dpatel at apple.com Wed May 30 13:47:22 2007 From: dpatel at apple.com (dpatel at apple.com) Date: Wed, 30 May 2007 11:47:22 -0700 (PDT) Subject: [llvm-commits] [127825] Fix previous patch. Message-ID: <20070530184722.1B7AB5B55912@src> Revision: 127825 Author: dpatel Date: 2007-05-30 11:47:21 -0700 (Wed, 30 May 2007) Log Message: ----------- Fix previous patch. Make it safer. Return after defining APPLE_CC. Modified Paths: -------------- apple-local/branches/llvm/gcc/c-cppbuiltin.c Modified: apple-local/branches/llvm/gcc/c-cppbuiltin.c =================================================================== --- apple-local/branches/llvm/gcc/c-cppbuiltin.c 2007-05-30 18:17:46 UTC (rev 127824) +++ apple-local/branches/llvm/gcc/c-cppbuiltin.c 2007-05-30 18:47:21 UTC (rev 127825) @@ -346,20 +346,27 @@ const char *vt; vt = strstr (version_string, "build "); - if (vt == NULL) - builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + if (vt == NULL) { + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + return; + } vt += strlen ("build "); - if (! ISDIGIT (*vt)) - builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + if (! ISDIGIT (*vt)) { + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + return; + } for (q = vt; *q != 0 && ISDIGIT (*q); q++) ; - if (q == vt || *q != ')') - builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + if (q == vt || *q != ')') { + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + return; + } if ((q - vt != 4 && q - vt != 5) || *vt == '0') - builtin_define_with_value_n ("__APPLE_CC__", "1", 1); - builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt); + builtin_define_with_value_n ("__APPLE_CC__", "1", 1); + else + builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt); } #endif /*CONFIG_DARWIN_H*/ #endif /*LLVM_VERSION_INFO*/ From evan.cheng at apple.com Wed May 30 14:49:37 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 30 May 2007 14:49:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200705301949.l4UJnb43018948@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.15 -> 1.16 --- Log message: Change traversal order to bottom up in preparation for more aggressive if-conversion. --- Diffs of the changes: (+69 -23) IfConversion.cpp | 92 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 69 insertions(+), 23 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.15 llvm/lib/CodeGen/IfConversion.cpp:1.16 --- llvm/lib/CodeGen/IfConversion.cpp:1.15 Tue May 29 18:37:20 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Wed May 30 14:49:19 2007 @@ -72,6 +72,10 @@ BB(0), TrueBB(0), FalseBB(0), TailBB(0) {} }; + /// Roots - Basic blocks that do not have successors. These are the starting + /// points of Graph traversal. + std::vector Roots; + /// BBAnalysis - Results of if-conversion feasibility analysis indexed by /// basic block number. std::vector BBAnalysis; @@ -90,9 +94,10 @@ void StructuralAnalysis(MachineBasicBlock *BB); void FeasibilityAnalysis(BBInfo &BBI, std::vector &Cond); - void AnalyzeBlocks(MachineFunction &MF, + bool AttemptRestructuring(BBInfo &BBI); + bool AnalyzeBlocks(MachineFunction &MF, std::vector &Candidates); - void InvalidatePreds(MachineBasicBlock *BB); + void ReTryPreds(MachineBasicBlock *BB); bool IfConvertEarlyExit(BBInfo &BBI); bool IfConvertTriangle(BBInfo &BBI); bool IfConvertDiamond(BBInfo &BBI); @@ -115,6 +120,11 @@ unsigned NumBBs = MF.getNumBlockIDs(); BBAnalysis.resize(NumBBs); + // Look for root nodes, i.e. blocks without successors. + for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) + if (I->succ_size() == 0) + Roots.push_back(I); + std::vector Candidates; MadeChange = false; while (true) { @@ -122,7 +132,7 @@ // Do an intial analysis for each basic block and finding all the potential // candidates to perform if-convesion. - AnalyzeBlocks(MF, Candidates); + Change |= AnalyzeBlocks(MF, Candidates); while (!Candidates.empty()) { BBInfo &BBI = *Candidates.back(); Candidates.pop_back(); @@ -146,6 +156,7 @@ break; } + Roots.clear(); BBAnalysis.clear(); return MadeChange; @@ -274,26 +285,60 @@ BBI.isPredicable = true; } -/// AnalyzeBlocks - Analyze all blocks and find entries for all -/// if-conversion candidates. -void IfConverter::AnalyzeBlocks(MachineFunction &MF, +/// AttemptRestructuring - Restructure the sub-CFG rooted in the given block to +/// expose more if-conversion opportunities. e.g. +/// +/// cmp +/// b le BB1 +/// / \____ +/// / | +/// cmp | +/// b eq BB1 | +/// / \____ | +/// / \ | +/// BB1 +/// ==> +/// +/// cmp +/// b eq BB1 +/// / \____ +/// / | +/// cmp | +/// b le BB1 | +/// / \____ | +/// / \ | +/// BB1 +bool IfConverter::AttemptRestructuring(BBInfo &BBI) { + return false; +} + +/// AnalyzeBlocks - Analyze all blocks and find entries for all if-conversion +/// candidates. It returns true if any CFG restructuring is done to expose more +/// if-conversion opportunities. +bool IfConverter::AnalyzeBlocks(MachineFunction &MF, std::vector &Candidates) { + bool Change = false; std::set Visited; - MachineBasicBlock *Entry = MF.begin(); - for (df_ext_iterator DFI = df_ext_begin(Entry, Visited), - E = df_ext_end(Entry, Visited); DFI != E; ++DFI) { - MachineBasicBlock *BB = *DFI; - StructuralAnalysis(BB); - BBInfo &BBI = BBAnalysis[BB->getNumber()]; - switch (BBI.Kind) { - default: break; - case ICEarlyExit: - case ICTriangle: - case ICDiamond: - Candidates.push_back(&BBI); - break; + for (unsigned i = 0, e = Roots.size(); i != e; ++i) { + for (idf_ext_iterator I=idf_ext_begin(Roots[i],Visited), + E = idf_ext_end(Roots[i], Visited); I != E; ++I) { + MachineBasicBlock *BB = *I; + StructuralAnalysis(BB); + BBInfo &BBI = BBAnalysis[BB->getNumber()]; + switch (BBI.Kind) { + case ICEarlyExit: + case ICTriangle: + case ICDiamond: + Candidates.push_back(&BBI); + break; + default: + Change |= AttemptRestructuring(BBI); + break; + } } } + + return Change; } /// TransferPreds - Transfer all the predecessors of FromBB to ToBB. @@ -329,9 +374,9 @@ return MachineFunction::iterator(ToBB) == ++Fallthrough; } -/// InvalidatePreds - Invalidate predecessor BB info so it would be re-analyzed +/// ReTryPreds - Invalidate predecessor BB info so it would be re-analyzed /// to determine if it can be if-converted. -void IfConverter::InvalidatePreds(MachineBasicBlock *BB) { +void IfConverter::ReTryPreds(MachineBasicBlock *BB) { for (MachineBasicBlock::pred_iterator PI = BB->pred_begin(), E = BB->pred_end(); PI != E; ++PI) { BBInfo &PBBI = BBAnalysis[(*PI)->getNumber()]; @@ -386,7 +431,7 @@ BBI.TrueBB = BBI.FalseBB = NULL; BBI.BrCond.clear(); TII->AnalyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); - InvalidatePreds(BBI.BB); + ReTryPreds(BBI.BB); CvtBBI->Kind = ICDead; // FIXME: Must maintain LiveIns. @@ -424,6 +469,7 @@ BBI.TrueBB = BBI.FalseBB = NULL; BBI.BrCond.clear(); TII->AnalyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); + ReTryPreds(BBI.BB); TrueBBI.Kind = ICDead; // FIXME: Must maintain LiveIns. @@ -572,7 +618,7 @@ BBI.TrueBB = BBI.FalseBB = NULL; BBI.BrCond.clear(); TII->AnalyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); - InvalidatePreds(BBI.BB); + ReTryPreds(BBI.BB); } TrueBBI.Kind = ICDead; FalseBBI.Kind = ICDead; From sabre at nondot.org Wed May 30 15:25:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 30 May 2007 15:25:06 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/index.html Message-ID: <200705302025.l4UKP6Zq020089@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: index.html updated: 1.6 -> 1.7 --- Log message: add link to youtube videos --- Diffs of the changes: (+5 -1) index.html | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.6 llvm-www/devmtg/2007-05/index.html:1.7 --- llvm-www/devmtg/2007-05/index.html:1.6 Tue May 29 22:03:34 2007 +++ llvm-www/devmtg/2007-05/index.html Wed May 30 15:24:48 2007 @@ -11,6 +11,10 @@

    Someone write a blurb here. ~60 people attended.

    + +

    These videos are also viewable on youtube.

    +
    @@ -239,6 +243,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/30 03:03:34 $ +
    Last modified: $Date: 2007/05/30 20:24:48 $ From baldrick at free.fr Wed May 30 16:51:44 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 30 May 2007 23:51:44 +0200 Subject: [llvm-commits] EH cleanup Message-ID: <200705302351.44763.baldrick@free.fr> TypeInfos are passed around as pointers (i8*), yet when a null value is needed it is passed as an i32 value of 0, rather than an i8* null. The attached patches change to using an i8* null in LLVM and llvm-gcc. At the same time I eliminated some uses of std::vector as a way of holding a single Value* in the llvm-gcc EH stuff. Ciao, Duncan. -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm_eh_cleanups.diff Type: text/x-diff Size: 1255 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070530/4dca5178/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_eh_cleanups.diff Type: text/x-diff Size: 2063 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070530/4dca5178/attachment-0001.bin From resistor at mac.com Wed May 30 19:42:33 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 30 May 2007 19:42:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705310042.l4V0gXd0028352@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.6 -> 1.7 --- Log message: Attempt to fix up phi_translate. --- Diffs of the changes: (+61 -11) GVNPRE.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 61 insertions(+), 11 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.6 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.7 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.6 Tue May 29 18:34:14 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Wed May 30 19:42:15 2007 @@ -90,9 +90,9 @@ return true; } }; - + typedef std::map ValueTable; - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); AU.addRequired(); @@ -109,7 +109,7 @@ std::set::iterator find_leader(ValueTable VN, std::set& vals, uint32_t v); - void phi_translate(ValueTable& VN, + void phi_translate(ValueTable& VN, std::set& MS, std::set& anticIn, BasicBlock* B, std::set& out); @@ -232,7 +232,8 @@ return vals.end(); } -void GVNPRE::phi_translate(GVNPRE::ValueTable& VN, +void GVNPRE::phi_translate(GVNPRE::ValueTable& VN, + std::set& MS, std::set& anticIn, BasicBlock* B, std::set& out) { BasicBlock* succ = B->getTerminator()->getSuccessor(0); @@ -241,13 +242,57 @@ I != E; ++I) { if (I->opcode == 0) { Value *v = I->value; - if (PHINode* p = dyn_cast(v)) - if (p->getParent() == succ) { + if (PHINode* p = dyn_cast(v)) { + if (p->getParent() == succ) out.insert(buildExpression(VN, p->getIncomingValueForBlock(B))); - continue; - } + } else { + out.insert(*I); + } + } else { + std::set::iterator lhs_it = find_leader(VN, anticIn, I->lhs); + if (lhs_it == anticIn.end()) + continue; + + Expression lhs = *lhs_it; + if (lhs.value != 0) + if (PHINode* p = dyn_cast(lhs.value)) + if (p->getParent() == succ) { + Expression t = buildExpression(VN, p->getIncomingValueForBlock(B)); + lhs.opcode = t.opcode; + lhs.value = t.value; + lhs.lhs = t.lhs; + lhs.rhs = t.rhs; + + out.insert(t); + } + + std::set::iterator rhs_it = find_leader(VN, anticIn, I->rhs); + if (rhs_it == anticIn.end()) + continue; + + Expression rhs = *rhs_it; + if (rhs.value != 0) + if (PHINode* p = dyn_cast(rhs.value)) + if (p->getParent() == succ) { + Expression t = buildExpression(VN, p->getIncomingValueForBlock(B)); + rhs.opcode = t.opcode; + rhs.value = t.value; + rhs.lhs = t.lhs; + rhs.rhs = t.rhs; + + out.insert(t); + } + + Expression e; + e.opcode = I->opcode; + e.value = 0; + e.lhs = VN[lhs]; + e.rhs = VN[rhs]; + + if (VN.insert(std::make_pair(e, nextValueNumber)).second) + nextValueNumber++; + MS.insert(e); } - //out.insert(*I); } } @@ -290,7 +335,9 @@ void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { DOUT << "{ "; for (std::set::iterator I = s.begin(), E = s.end(); I != E; ++I) { - DOUT << "( " << I->opcode << ", " + DOUT << "( "; + DOUT << I->opcode+48; + DOUT << ", " << (I->value == 0 ? "0" : I->value->getName().c_str()) << ", value." << I->lhs << ", value." << I->rhs << " ) "; } @@ -396,7 +443,10 @@ std::set old (anticIn.begin(), anticIn.end()); if (BB->getTerminator()->getNumSuccessors() == 1) { - phi_translate(VN, maximalSet, BB, anticOut); + if (visited.find(BB) == visited.end()) + phi_translate(VN, maximalSet, anticIn, BB, anticOut); + else + phi_translate(VN, anticIn, anticIn, BB, anticOut); } else if (BB->getTerminator()->getNumSuccessors() > 1) { for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); From bruno.cardoso at gmail.com Wed May 30 22:25:29 2007 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Wed, 30 May 2007 22:25:29 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200705310325.l4V3PTWG002057@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.81 -> 1.82 --- Log message: New contributor added! --- Diffs of the changes: (+5 -0) CREDITS.TXT | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.81 llvm/CREDITS.TXT:1.82 --- llvm/CREDITS.TXT:1.81 Sun May 20 14:56:24 2007 +++ llvm/CREDITS.TXT Wed May 30 22:25:10 2007 @@ -221,3 +221,8 @@ W: http://web.mac.com/bwendling/ D: MMX & SSSE3 instructions D: SPEC2006 support + +N: Bruno Cardoso Lopes +E: bruno.cardoso at gmail.com +W: http://www.brunocardoso.org +D: The Mips backend From isanbard at gmail.com Wed May 30 23:14:46 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 30 May 2007 23:14:46 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200705310414.l4V4EkUX003304@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.82 -> 1.83 --- Log message: Alphabetize Bruno's entry. --- Diffs of the changes: (+5 -5) CREDITS.TXT | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.82 llvm/CREDITS.TXT:1.83 --- llvm/CREDITS.TXT:1.82 Wed May 30 22:25:10 2007 +++ llvm/CREDITS.TXT Wed May 30 23:14:28 2007 @@ -158,6 +158,11 @@ E: nicholas at mxc.ca D: PredicateSimplifier pass +N: Bruno Cardoso Lopes +E: bruno.cardoso at gmail.com +W: http://www.brunocardoso.org +D: The Mips backend + N: Duraid Madina E: duraid at octopus.com.au W: http://kinoko.c.u-tokyo.ac.jp/~duraid/ @@ -221,8 +226,3 @@ W: http://web.mac.com/bwendling/ D: MMX & SSSE3 instructions D: SPEC2006 support - -N: Bruno Cardoso Lopes -E: bruno.cardoso at gmail.com -W: http://www.brunocardoso.org -D: The Mips backend From zhousheng00 at gmail.com Thu May 31 05:25:22 2007 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Thu, 31 May 2007 05:25:22 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/reduce_xor.c reduce_xor.reference_output Message-ID: <200705311025.l4VAPMZi020025@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/Integer: reduce_xor.c added (r1.1) reduce_xor.reference_output added (r1.1) --- Log message: Add a new test case for reduce_xor --- Diffs of the changes: (+121 -0) reduce_xor.c | 41 ++++++++++++++++++++++ reduce_xor.reference_output | 80 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) Index: llvm-test/SingleSource/UnitTests/Integer/reduce_xor.c diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/reduce_xor.c:1.1 *** /dev/null Thu May 31 05:25:14 2007 --- llvm-test/SingleSource/UnitTests/Integer/reduce_xor.c Thu May 31 05:25:04 2007 *************** *** 0 **** --- 1,41 ---- + #include "bits.h" + #include + + int test_reduce_xor47(uint47 x) + { + unsigned result = reduce(xor, x) != 0; + printf("reduce_xor47(x) = %d\n", result); + return result; + } + + int test_reduce_xor68(uint68 x) + { + unsigned result = reduce(xor, x) != 0; + printf("reduce_xor68(x) = %d\n", result); + return result; + } + + int test_reduce_xor250(uint250 x) + { + unsigned result = reduce(xor, x) != 0; + printf("reduce_xor250(x) = %d\n", result); + return result; + } + + int main(int argc, char** argv) { + uint250 x = 0xF0F0F0F0F0F0F0F0ULL; + int result = 0; + int i; + srand(128); + for (i = 0; i < 16; ++i) { + x *= rand(); + printf("x = 0b0"); + printBits(x); + printf("\n"); + result = + test_reduce_xor47(x) + test_reduce_xor68(x) + + test_reduce_xor250(x); + printf("Xor reductions of x = %d\n", result); + } + return 0; + } Index: llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output:1.1 *** /dev/null Thu May 31 05:25:22 2007 --- llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output Thu May 31 05:25:04 2007 *************** *** 0 **** --- 1,80 ---- + x = 0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100110100001001000110010100101101001011010010110100101101000101111111100100001000110010000 + reduce_xor47(x) = 0 + reduce_xor68(x) = 0 + reduce_xor250(x) = 0 + Xor reductions of x = 0 + x = 0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011101111110111000000111110110010001010011100001010001011001111000101101101101111001110111001100100100001100010001100000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 1 + Xor reductions of x = 3 + x = 0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011001101010100101011110011101100111101010011000111010111110101010110101001110110110110011010100110100001011001001011111011000000010111101100110100000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 0 + reduce_xor250(x) = 0 + Xor reductions of x = 1 + x = 0b00000000000000000000000000000000000000000000000000000000000000000000110000101110001001101110011101100110100011011110101100011011111000111000110100011101101111001110000111010001101100010010000001001100100000001111011110010111111100111101110010100000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 1 + Xor reductions of x = 3 + x = 0b00000000000000000000000000000000000000110011101010001011011101001100101011010000011010111101100000010110101010011010000111101001101100010001100010111110001101000111101011101111111000111001001001110101000001111100011011100100010111000001110011100000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 0 + reduce_xor250(x) = 0 + Xor reductions of x = 1 + x = 0b00000000011000011101111010101010001011011001011001010011110001110010110001010101110100001000110001111110111001101101011001000100101011111100010110101111111110010111000011111110101000010011111101101110110011011110110000011011001011011100111110000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 0 + Xor reductions of x = 2 + x = 0b00100111111110001100001110011100111001111010111100100011100111001011100010111010010010100000111110010001001000000100001101000000111100100001001111001001111100011100110010001001101101010000101110100101101100011010000011011010001100110001011010000000000 + reduce_xor47(x) = 0 + reduce_xor68(x) = 1 + reduce_xor250(x) = 1 + Xor reductions of x = 2 + x = 0b01111000101110101010011000110100110000000011111011010010010011111000110001101001001100101011011000011001111001000001010000011101110000101110100110110100101110011110101011100010011011010001011100001010110000100000011000010010010101110110111110000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 0 + reduce_xor250(x) = 0 + Xor reductions of x = 1 + x = 0b00011000111011111001011110010010101001100011001100101001111101101101100110011000001011000010010100000010111100000100111100010101010010100111011101101001010101101001000000010010100000000001000001110110101000011110100001010100010011110100100000000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 0 + Xor reductions of x = 2 + x = 0b00010101101001000010010000001101101011011110010101010111100101001000101100101011000001110010101010000110101101000001101110101100011001011001001010111011000000010100111101001111111101110110000101001100011010111101011011001001110001011100000000000000000 + reduce_xor47(x) = 0 + reduce_xor68(x) = 1 + reduce_xor250(x) = 1 + Xor reductions of x = 2 + x = 0b00011101100110101100100010101101100001100001010000001011010100100110111010111101001110000101011111011100100001011010010111001110000110110111100100010010001010000010000001110001111011110001010010000001100001000011110010110000111110111100000000000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 0 + Xor reductions of x = 2 + x = 0b00011111011001000110001011111001001110011101000000010100001100110010110110001101111000000110101101100000001010000110001101010110001001101010001001001010001100010101100000111111001100100101010001101000100101011101000111101000001101001100000000000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 1 + Xor reductions of x = 3 + x = 0b01100110000010001101010100010101000001111111111001001010100011011001110000010010110001110100000111110111101001110011001011111010100111101100010110101110110101110100111111111010110110111000111100011111111100101011000101111010101000000100000000000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 0 + reduce_xor250(x) = 0 + Xor reductions of x = 1 + x = 0b01010110011101010010101001111001011010001100110110100010011110101110010111001001011100010010011001110010100110000000110001101101000111000000000000101111010100010001100111111110100010101000010110000100110111100101100010101100111010101100000000000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 0 + Xor reductions of x = 2 + x = 0b00011110111101010011100101111011000000010001000000011000110100100101000001100110000011001000100101100111101000101000000101110111111111111111100011111110001011001011110011011111111101000100101000010000011011111001110100100101000100010100000000000000000 + reduce_xor47(x) = 1 + reduce_xor68(x) = 1 + reduce_xor250(x) = 0 + Xor reductions of x = 2 + x = 0b00011000111011001110001100111100101100100111011111001110110001010110000111110010100100001001101101000101000100001010010110000101011001100111101011100101100000010100011001001111111001111100111000111100011100110101110111010110000100000100000000000000000 + reduce_xor47(x) = 0 + reduce_xor68(x) = 1 + reduce_xor250(x) = 1 + Xor reductions of x = 2 From baldrick at free.fr Thu May 31 08:18:15 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 31 May 2007 15:18:15 +0200 Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of In-Reply-To: <20070530053840.5113259B05AC@src> References: <20070530053840.5113259B05AC@src> Message-ID: <200705311518.16204.baldrick@free.fr> Hi Chris, this breaks the Ada build since the TYPE_SIZE may not be a constant: > + if (TYPE_SIZE(type) == 0 || > + PadStartBits >= int(TREE_INT_CST_LOW(TYPE_SIZE(type))) || I've attached a fix, which includes some other tweaks for arrays (not very important) plus whitespace cleanup. Ciao, Duncan. -------------- next part -------------- A non-text attachment was scrubbed... Name: union_fix.diff Type: text/x-diff Size: 2450 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070531/ea47889c/attachment.bin From clattner at apple.com Thu May 31 11:42:09 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 31 May 2007 09:42:09 -0700 Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of In-Reply-To: <200705311518.16204.baldrick@free.fr> References: <20070530053840.5113259B05AC@src> <200705311518.16204.baldrick@free.fr> Message-ID: On May 31, 2007, at 6:18 AM, Duncan Sands wrote: > Hi Chris, this breaks the Ada build since the TYPE_SIZE may not be > a constant: > >> + if (TYPE_SIZE(type) == 0 || >> + PadStartBits >= int(TREE_INT_CST_LOW(TYPE_SIZE(type))) || > > I've attached a fix, which includes some other tweaks for arrays > (not very important) plus whitespace cleanup. Does this actually cause a problem? This function is only called if the outer struct has constant size. TreeToLLVM::EmitAggregateCopy checks that TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST is true before calling into this code. -Chris From dpatel at apple.com Thu May 31 12:39:08 2007 From: dpatel at apple.com (dpatel at apple.com) Date: Thu, 31 May 2007 10:39:08 -0700 (PDT) Subject: [llvm-commits] [127872] Fix objective-c runtime data alignment. Message-ID: <20070531173908.B53395EF2019@src> Revision: 127872 Author: dpatel Date: 2007-05-31 10:39:08 -0700 (Thu, 31 May 2007) Log Message: ----------- Fix objective-c runtime data alignment. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-backend.cpp Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-31 11:13:57 UTC (rev 127871) +++ apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-31 17:39:08 UTC (rev 127872) @@ -68,6 +68,8 @@ #include "langhooks.h" } +extern int flag_next_runtime; + // Non-zero if bytecode from PCH is successfully read. int flag_llvm_pch_read; @@ -733,6 +735,9 @@ } else if (const char *Section = LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) { GV->setSection(Section); + // Next runtime expects 4 byte alignment for Objective-C data. + if (flag_next_runtime) + GV->setAlignment(4); #endif } From evan.cheng at apple.com Thu May 31 12:59:01 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 12:59:01 -0500 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp Message-ID: <200705311759.l4VHx10C030222@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C++/life: life.cpp updated: 1.3 -> 1.4 --- Log message: Doh. --- Diffs of the changes: (+1 -1) life.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp:1.3 llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp:1.4 --- llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp:1.3 Wed May 30 12:44:14 2007 +++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/life/life.cpp Thu May 31 12:58:31 2007 @@ -5,7 +5,7 @@ const int DRAB=3; const int DFOX=8; #ifdef SMALL_PROBLEM_SIZE -const int CYCLES=1000 +const int CYCLES=1000; #else const int CYCLES=10000; #endif From clattner at apple.com Thu May 31 13:12:35 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 31 May 2007 11:12:35 -0700 Subject: [llvm-commits] [127872] Fix objective-c runtime data alignment. In-Reply-To: <20070531173908.B53395EF2019@src> References: <20070531173908.B53395EF2019@src> Message-ID: <60166804-EB2D-4870-9BB8-44760A5F093F@apple.com> Hi Devang, > +extern int flag_next_runtime; > + Is this around in non-objc compilers? > // Non-zero if bytecode from PCH is successfully read. > int flag_llvm_pch_read; > > @@ -733,6 +735,9 @@ > } else if (const char *Section = > LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) { > GV->setSection(Section); > + // Next runtime expects 4 byte alignment for Objective-C data. > + if (flag_next_runtime) > + GV->setAlignment(4); > #endif Please move this to objc-act.c. It should be sufficient to set DECL_ALIGN on the protocol objects when the objc front-end is making them. Is there a problem with that? -Chris From dpatel at apple.com Thu May 31 13:14:40 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 31 May 2007 11:14:40 -0700 Subject: [llvm-commits] [127872] Fix objective-c runtime data alignment. In-Reply-To: <60166804-EB2D-4870-9BB8-44760A5F093F@apple.com> References: <20070531173908.B53395EF2019@src> <60166804-EB2D-4870-9BB8-44760A5F093F@apple.com> Message-ID: <79CA4FFE-9193-4E69-9B6D-853C43ED69EE@apple.com> On May 31, 2007, at 11:12 AM, Chris Lattner wrote: > > Hi Devang, > >> +extern int flag_next_runtime; >> + > > Is this around in non-objc compilers? yes. > > >> // Non-zero if bytecode from PCH is successfully read. >> int flag_llvm_pch_read; >> >> @@ -733,6 +735,9 @@ >> } else if (const char *Section = >> LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) { >> GV->setSection(Section); >> + // Next runtime expects 4 byte alignment for Objective-C data. >> + if (flag_next_runtime) >> + GV->setAlignment(4); >> #endif > > Please move this to objc-act.c. It should be sufficient to set > DECL_ALIGN on the protocol objects when the objc front-end is making > them. OK. - Devang > Is there a problem with that? > > -Chris > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu May 31 13:18:57 2007 From: clattner at apple.com (clattner at apple.com) Date: Thu, 31 May 2007 11:18:57 -0700 (PDT) Subject: [llvm-commits] [127873] From Duncan: Message-ID: <20070531181857.E938C5F3B34E@src> Revision: 127873 Author: clattner Date: 2007-05-31 11:18:57 -0700 (Thu, 31 May 2007) Log Message: ----------- >From Duncan: "TypeInfos are passed around as pointers (i8*), yet when a null value is needed it is passed as an i32 value of 0, rather than an i8* null. The attached patches change to using an i8* null in LLVM and llvm-gcc. At the same time I eliminated some uses of std::vector as a way of holding a single Value* in the llvm-gcc EH stuff." Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-31 17:39:08 UTC (rev 127872) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-31 18:18:57 UTC (rev 127873) @@ -703,9 +703,8 @@ #ifdef ITANIUM_STYLE_EXCEPTIONS if (ExceptionValue) { // Fetch and store exception handler. - std::vector Args; - Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr")); - Builder.CreateCall(FuncUnwindResume, &Args[0], Args.size()); + Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr"); + Builder.CreateCall(FuncUnwindResume, &Arg, 1); Builder.CreateUnreachable(); } else { new UnwindInst(UnwindBB); @@ -1899,7 +1898,9 @@ if (!Types) { // Catch all. - TypeInfos.push_back(Constant::getNullValue(Type::Int32Ty)); + TypeInfos.push_back( + Constant::getNullValue(PointerType::get(Type::Int8Ty)) + ); } else if (TREE_CODE(Types) != TREE_LIST) { // Construct typeinfo object. Each call will produce a new expression // even if duplicate. @@ -2206,9 +2207,7 @@ Value *TypeInfo = Emit(TypeInfoNopExpr, 0); // Call get eh type id. - std::vector Args; - Args.push_back(TypeInfo); - Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &Args[0], Args.size(), + Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &TypeInfo, 1, "eh_typeid"); Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp"); @@ -2233,9 +2232,7 @@ TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty)); // Call get eh type id. - std::vector Args; - Args.push_back(TypeInfo); - Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &Args[0], Args.size(), + Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, &TypeInfo, 1, "eh_typeid"); Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp"); From clattner at apple.com Thu May 31 13:19:44 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 31 May 2007 11:19:44 -0700 Subject: [llvm-commits] EH cleanup In-Reply-To: <200705302351.44763.baldrick@free.fr> References: <200705302351.44763.baldrick@free.fr> Message-ID: On May 30, 2007, at 2:51 PM, Duncan Sands wrote: > TypeInfos are passed around as pointers (i8*), yet when > a null value is needed it is passed as an i32 value of 0, > rather than an i8* null. The attached patches change to > using an i8* null in LLVM and llvm-gcc. At the same time > I eliminated some uses of std::vector as a way of > holding a single Value* in the llvm-gcc EH stuff. Makes sense, applied! Please apply the llvm piece, -Chris From clattner at apple.com Thu May 31 13:27:46 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 31 May 2007 11:27:46 -0700 Subject: [llvm-commits] [llvm-gcc] Intrinsics.patch (please apply) In-Reply-To: References: <1179862391.3604.3.camel@bashful.x10sys.com> <63D859FA-9732-43DC-BDEE-7E7F3B543179@apple.com> Message-ID: <51FFAE20-4D9A-42F7-BB47-9E1E19FD2E5A@apple.com> On May 22, 2007, at 10:41 PM, Reid Spencer wrote: > On Tue, 22 May 2007 22:12:17 -0700 > Chris Lattner wrote: >> >> On May 22, 2007, at 12:33 PM, Reid Spencer wrote: >> >>> The attached patch contains a small modification to get the index >>> of the >>> iAny types correct for overloaded intrinsics. It has been tested and >>> passes DejaGnu and MultiSource. Please apply. >> >> Can you please explain what bad case this (and the previous patch) >> fixes? Is this a .ll/.bc syntax change? > > No, its not a .ll/.bc syntax change, but it is a slight API > correction. The issue has to do with the Intrinsic::getDeclaration > method and the interpretation of the (often defaulted) 3rd and 4th > parameters that specify the actual types to "fill" in for the iAny > parameters (or result). The third argument is an array of Type* > and the fourth is the number of elements. Previously you had to > specify an entry in the array for every parameter and the result > type, regardless of whether they were iAny or not. This is > inconsistent with uses of Intrinsic::getDeclaration when there are > no iAny parameters in which case it is permissable to pass 0 for > both the 3rd and 4th arguments (and those happen to the be the > default values). Makes sense, thanks for the clarification reid! -Chris > For example, cttz and friends take an iAny parameter but return > i32. Consequently they require only one type in the "Tys" argument > to getDeclaration (for the parameter). Previously tblgen was > indexing into "Tys" using the parameter index (or 0 for the result > type) but this leads to "holes" (zero valued Type*) in the array. > The interface was changed to eliminate these holes so that the only > things passed in Tys is the actual types for the iAny arguments. > > Consider this, from LangRef.html: > > declare i32 @llvm.ctpop.i8 (i8 ) > > The single suffix (.i8) that qualifies the argument type indicates > that you should be able to call getDeclaration with: > > Type *Tys[] = { Type::Int8Ty }; > Function *F = Intrinsics::getDeclaration(Mod, Intrinsics::ctpop, > Tys, 1); > > However, such a call previously caused an assertion (or worse). The > problem is that the code generated by tblgen was indexing into Tys > with a subscript of 1 (to match the first argument) but the array > was only 1 item long. Consequently, you'd read junk from the stack > and assert (or worse). > > Previously one would have had to pass, to getDeclaration, something > like: > > Type *Tys[] = { 0, Type::Int8Ty }; > Function *F = Intrinsics::getDeclaration(Mod, Intrinsics::ctpop, > Tys, 2); > > which is counter-intuitive since you don't have to use the 3rd and > 4th parameters at all (defaulting them to 0) if there are no iAny > arguments. The function changed in the llvm-gcc patch was doing > exactly this (an array of 2 with a 0 first element) and I changed > it to use the former example (single element array). > > This was noticed by AutoESL when they tried to call getDeclaration > directly themselves and ended up getting assertions and verifier > failures. This wasn't noticed before in LLVM because the only use > of an overloaded intrinsic in LLVM is bswap and that one is a > degenerate case. Both its argument and its result are iAny so you > end up needing an array that has two elements anyway - one for the > result, one for the argument. However, in cases like part_select, > part_set, cttz, ctlz and ctpop, that is not the case. > >> >> -Chris >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From lauro.venancio at gmail.com Thu May 31 13:28:18 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Thu, 31 May 2007 13:28:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200705311828.l4VISItm030970@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.87 -> 1.88 --- Log message: Fix PR1424: http://llvm.org/PR1424 . When a function has FP, the register scavenging spill slot offset already was calculated. --- Diffs of the changes: (+1 -1) PrologEpilogInserter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.88 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 Wed May 2 20:11:53 2007 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu May 31 13:27:58 2007 @@ -428,7 +428,7 @@ // Make sure the special register scavenging spill slot is closest to the // stack pointer. - if (RS) { + if (RS && !RegInfo->hasFP(Fn)) { int SFI = RS->getScavengingFrameIndex(); if (SFI >= 0) { // If stack grows down, we need to add size of find the lowest From lauro.venancio at gmail.com Thu May 31 13:36:26 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Thu, 31 May 2007 13:36:26 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-05-31-RegScavengerInfiniteLoop.ll Message-ID: <200705311836.l4VIaQRA031240@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: 2007-05-31-RegScavengerInfiniteLoop.ll added (r1.1) --- Log message: Add a test for PR1424: http://llvm.org/PR1424 . --- Diffs of the changes: (+237 -0) 2007-05-31-RegScavengerInfiniteLoop.ll | 237 +++++++++++++++++++++++++++++++++ 1 files changed, 237 insertions(+) Index: llvm/test/CodeGen/ARM/2007-05-31-RegScavengerInfiniteLoop.ll diff -c /dev/null llvm/test/CodeGen/ARM/2007-05-31-RegScavengerInfiniteLoop.ll:1.1 *** /dev/null Thu May 31 13:36:17 2007 --- llvm/test/CodeGen/ARM/2007-05-31-RegScavengerInfiniteLoop.ll Thu May 31 13:36:07 2007 *************** *** 0 **** --- 1,237 ---- + ; RUN: llvm-as < %s | llc + ; PR1424 + + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" + target triple = "arm-linux-gnueabi" + %struct.AVClass = type { i8*, i8* (i8*)*, %struct.AVOption* } + %struct.AVCodec = type { i8*, i32, i32, i32, i32 (%struct.AVCodecContext*)*, i32 (%struct.AVCodecContext*, i8*, i32, i8*)*, i32 (%struct.AVCodecContext*)*, i32 (%struct.AVCodecContext*, i8*, i32*, i8*, i32)*, i32, %struct.AVCodec*, void (%struct.AVCodecContext*)*, %struct.AVRational*, i32* } + %struct.AVCodecContext = type { %struct.AVClass*, i32, i32, i32, i32, i32, i8*, i32, %struct.AVRational, i32, i32, i32, i32, i32, void (%struct.AVCodecContext*, %struct.AVFrame*, i32*, i32, i32, i32)*, i32, i32, i32, i32, i32, i32, i32, float, float, i32, i32, i32, i32, float, i32, i32, i32, %struct.AVCodec*, i8*, i32, i32, void (%struct.AVCodecContext*, i8*, i32, i32)*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, [32 x i8], i32, i32, i32, i32, i32, i32, i32, float, i32, i32 (%struct.AVCodecContext*, %struct.AVFrame*)*, void (%struct.AVCodecContext*, %struct.AVFrame*)*, i32, i32, i32, i32, i8*, i8*, float, float, i32, %struct.RcOverride*, i32, i8*, i32, i32, i32, float, float, float, float, i32, float, float, float, float, float, i32, i32, i32, i32*, i32, i32, i32, i32, %struct.AVRational, %struct.AVFrame*, i32, i32, [4 x i64], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 (%struct.AVCodecContext*, i32*)*, i32, i32, i32, i32, i32, i32, i8*, i32, i3! 2, i32, i32, i32, i32, i16*, i16*, i32, i32, i32, i32, %struct.AVPaletteControl*, i32, i32 (%struct.AVCodecContext*, %struct.AVFrame*)*, i32, i32, i32, i32, i32, i32, i32, i32 (%struct.AVCodecContext*, i32 (%struct.AVCodecContext*, i8*)*, i8**, i32*, i32)*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64 } + %struct.AVEvalExpr = type opaque + %struct.AVFrame = type { [4 x i8*], [4 x i32], [4 x i8*], i32, i32, i64, i32, i32, i32, i32, i32, i8*, i32, i8*, [2 x [2 x i16]*], i32*, i8, i8*, [4 x i64], i32, i32, i32, i32, i32, %struct.AVPanScan*, i32, i32, i16*, [2 x i8*] } + %struct.AVOption = type opaque + %struct.AVPaletteControl = type { i32, [256 x i32] } + %struct.AVPanScan = type { i32, i32, i32, [3 x [2 x i16]] } + %struct.AVRational = type { i32, i32 } + %struct.BlockNode = type { i16, i16, i8, [3 x i8], i8, i8 } + %struct.DSPContext = type { void (i16*, i8*, i32)*, void (i16*, i8*, i8*, i32)*, void (i16*, i8*, i32)*, void (i16*, i8*, i32)*, void (i16*, i8*, i32)*, void (i8*, i16*, i32)*, void (i8*, i16*, i32)*, i32 (i16*)*, void (i8*, i8*, i32, i32, i32, i32, i32)*, void (i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)*, void (i16*)*, i32 (i8*, i32)*, i32 (i8*, i32)*, [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32! )*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], [5 x i32 (i8*, i8*, i8*, i32, i32)*], i32 (i8*, i16*, i32)*, [4 x [4 x void (i8*, i8*, i32, i32)*]], [4 x [4 x void (i8*, i8*, i32, i32)*]], [4 x [4 x void (i8*, i8*, i32, i32)*]], [4 x [4 x void (i8*, i8*, i32, i32)*]], [2 x void (i8*, i8*, i8*, i32, i32)*], [11 x void (i8*, i8*, i32, i32, i32)*], [11 x void (i8*, i8*, i32, i32, i32)*], [2 x [16 x void (i8*, i8*, i32)*]], [2 x [16 x void (i8*, i8*, i32)*]], [2 x [16 x void (i8*, i8*, i32)*]], [2 x [16 x void (i8*, i8*, i32)*]], [8 x void (i8*, i8*, i32)*], [3 x void (i8*, i8*, i32, i32, i32, i32)*], [3 x void (i8*, i8*, i32, i32, i32, i32)*], [3 x void (i8*, i8*, i32, i32, i32, i32)*], [4 x [16 x void (i8*, i8*, i32)*]], [4 x [16 x void (i8*, i8*, i32)*]], [4 x [16 x void (i8*, i8*, i32)*]], [4 x [16 x void (i8*, i8*, i32)*]], [10 x void (i8*, i32, i32, i32, i32)*], [10 x void (i8*, i8*, i32, i32, i32, i32! , i32)*], [2 x [16 x void (i8*, i8*, i32)*]], [2 x [16 x void ! (i8*, i8 *, i32)*]], void (i8*, i32, i32, i32, i32, i32, i32)*, void (i8*, i32, i32, i32, i32, i32, i32)*, void (i8*, i32, i32, i32, i32, i32, i32)*, void (i8*, i32, i32, i32, i32, i32, i32)*, void (i8*, i16*, i32)*, [2 x [4 x i32 (i8*, i8*, i8*, i32, i32)*]], void (i8*, i8*, i32)*, void (i8*, i8*, i8*, i32)*, void (i8*, i8*, i8*, i32, i32*, i32*)*, void (i32*, i32*, i32)*, void (i8*, i32, i32, i32, i8*)*, void (i8*, i32, i32, i32, i8*)*, void (i8*, i32, i32, i32, i8*)*, void (i8*, i32, i32, i32, i8*)*, void (i8*, i32, i32, i32)*, void (i8*, i32, i32, i32)*, void ([4 x [4 x i16]]*, i8*, [40 x i8]*, [40 x [2 x i16]]*, i32, i32, i32, i32, i32)*, void (i8*, i32, i32)*, void (i8*, i32, i32)*, void (i8*, i32)*, void (float*, float*, i32)*, void (float*, float*, i32)*, void (float*, float*, float*, i32)*, void (float*, float*, float*, float*, i32, i32, i32)*, void (i16*, float*, i32)*, void (i16*)*, void (i16*)*, void (i16*)*, void (i8*, i32, i16*)*, void (i8*, i32, i16*)*, [64 x i8], i32,! i32 (i16*, i16*, i16*, i32)*, void (i16*, i16*, i32)*, void (i8*, i16*, i32)*, void (i8*, i16*, i32)*, void (i8*, i16*, i32)*, void (i8*, i16*, i32)*, void ([4 x i16]*)*, void (i32*, i32*, i32*, i32*, i32*, i32*, i32)*, void (i32*, i32)*, void (i8*, i32, i8**, i32, i32, i32, i32, i32, %struct.slice_buffer*, i32, i8*)*, void (i8*, i32, i32)*, [4 x void (i8*, i32, i8*, i32, i32, i32)*], void (i16*)*, void (i16*, i32)*, void (i16*, i32)*, void (i16*, i32)*, void (i8*, i32)*, void (i8*, i32)*, [16 x void (i8*, i8*, i32, i32)*] } + %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] } + %struct.GetBitContext = type { i8*, i8*, i32*, i32, i32, i32, i32 } + %struct.MJpegContext = type opaque + %struct.MotionEstContext = type { %struct.AVCodecContext*, i32, [4 x [2 x i32]], [4 x [2 x i32]], i8*, i8*, [2 x i8*], i8*, i32, i32*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x [4 x i8*]], [4 x [4 x i8*]], i32, i32, i32, i32, i32, [4 x void (i8*, i8*, i32, i32)*]*, [4 x void (i8*, i8*, i32, i32)*]*, [16 x void (i8*, i8*, i32)*]*, [16 x void (i8*, i8*, i32)*]*, [4097 x i8]*, i8*, i32 (%struct.MpegEncContext*, i32*, i32*, i32, i32, i32, i32, i32)* } + %struct.MpegEncContext = type { %struct.AVCodecContext*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.PutBitContext, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.Picture*, %struct.Picture**, %struct.Picture**, i32, i32, [8 x %struct.MpegEncContext*], %struct.Picture, %struct.Picture, %struct.Picture, %struct.Picture, %struct.Picture*, %struct.Picture*, %struct.Picture*, [3 x i8*], [3 x i32], i16*, [3 x i16*], [20 x i16], i32, i32, i8*, i8*, i8*, i8*, i8*, [16 x i16]*, [3 x [16 x i16]*], i32, i8*, i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i32, i32, i32, i32, i32*, i32, i32, i32, i32, i32, i32, i32, [5 x i32], i32, i32, i32, i32, %struct.DSPContext, i32, i32, [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x [2 x [2 x i16]*]], [2 x [2 x [2 x [2 x i16]*]]], [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x i16]*, [2 x ! i16]*, [2 x [2 x [2 x i16]*]], [2 x [2 x [2 x [2 x i16]*]]], [2 x i8*], [2 x [2 x i8*]], i32, i32, i32, [2 x [4 x [2 x i32]]], [2 x [2 x i32]], [2 x [2 x [2 x i32]]], i8*, [2 x [64 x i16]], %struct.MotionEstContext, i32, i32, i32, i32, i32, i32, i16*, [6 x i32], [6 x i32], [3 x i8*], i32*, [64 x i16], [64 x i16], [64 x i16], [64 x i16], i32, i32, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, [8 x i32], [64 x i32]*, [64 x i32]*, [2 x [64 x i16]]*, [2 x [64 x i16]]*, [12 x i32], %struct.ScanTable, %struct.ScanTable, %struct.ScanTable, %struct.ScanTable, [64 x i32]*, [2 x i32], [64 x i16]*, i8*, i64, i64, i32, i32, %struct.RateControlContext, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i32, i32, %struct.GetBitContext, i32, i32, i32, %struct.ParseContext, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i16, i16, i16, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x [2 x i32]], [2 x [2 x i32]], [2 x i32], i32, i32, i32, i32, i32, i! 32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32! , i32, i 32, %struct.PutBitContext, %struct.PutBitContext, i32, i32, i32, i32, i32, i32, i8*, i32, i32, i32, i32, i32, [3 x i32], %struct.MJpegContext*, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x [65 x [65 x [2 x i32]]]]*, i32, i32, %struct.GetBitContext, i32, i32, i32, i8*, i32, [2 x [2 x i32]], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i32], i32, i32, i32, i32, i8*, i32, [12 x i16*], [64 x i16]*, [8 x [64 x i16]]*, i32 (%struct.MpegEncContext*, [64 x i16]*)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.MpegEncContext*, i16*, i32, i32)*, void (%struct.! MpegEncContext*, i16*, i32, i32)*, i32 (%struct.MpegEncContext*, i16*, i32, i32, i32*)*, i32 (%struct.MpegEncContext*, i16*, i32, i32, i32*)*, void (%struct.MpegEncContext*, i16*)* } + %struct.ParseContext = type { i8*, i32, i32, i32, i32, i32, i32, i32 } + %struct.Picture = type { [4 x i8*], [4 x i32], [4 x i8*], i32, i32, i64, i32, i32, i32, i32, i32, i8*, i32, i8*, [2 x [2 x i16]*], i32*, i8, i8*, [4 x i64], i32, i32, i32, i32, i32, %struct.AVPanScan*, i32, i32, i16*, [2 x i8*], [3 x i8*], [2 x [2 x i16]*], i32*, [2 x i32], i32, i32, i32, i32, [2 x [16 x i32]], [2 x i32], i32, i32, i16*, i16*, i8*, i32*, i32 } + %struct.Plane = type { i32, i32, [8 x [4 x %struct.SubBand]] } + %struct.Predictor = type { double, double, double } + %struct.PutBitContext = type { i32, i32, i8*, i8*, i8* } + %struct.RangeCoder = type { i32, i32, i32, i32, [256 x i8], [256 x i8], i8*, i8*, i8* } + %struct.RateControlContext = type { %struct.FILE*, i32, %struct.RateControlEntry*, double, [5 x %struct.Predictor], double, double, double, double, double, [5 x double], i32, i32, [5 x i64], [5 x i64], [5 x i64], [5 x i64], [5 x i32], i32, i8*, float, i32, %struct.AVEvalExpr* } + %struct.RateControlEntry = type { i32, float, i32, i32, i32, i32, i32, i64, i32, float, i32, i32, i32, i32, i32, i32 } + %struct.RcOverride = type { i32, i32, i32, float } + %struct.ScanTable = type { i8*, [64 x i8], [64 x i8] } + %struct.SnowContext = type { %struct.AVCodecContext*, %struct.RangeCoder, %struct.DSPContext, %struct.AVFrame, %struct.AVFrame, %struct.AVFrame, [8 x %struct.AVFrame], %struct.AVFrame, [32 x i8], [4224 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [8 x [2 x i16]*], [8 x i32*], i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x %struct.Plane], %struct.BlockNode*, [1024 x i32], i32, %struct.slice_buffer, %struct.MpegEncContext } + %struct.SubBand = type { i32, i32, i32, i32, i32, i32*, i32, i32, i32, %struct.x_and_coeff*, %struct.SubBand*, [519 x [32 x i8]] } + %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 } + %struct.slice_buffer = type { i32**, i32**, i32, i32, i32, i32, i32* } + %struct.x_and_coeff = type { i16, i16 } + + define fastcc void @iterative_me(%struct.SnowContext* %s) { + entry: + %state = alloca [4224 x i8], align 8 ; <[4224 x i8]*> [#uses=0] + %best_rd4233 = alloca i32, align 4 ; [#uses=0] + %tmp21 = getelementptr %struct.SnowContext* %s, i32 0, i32 36 ; [#uses=2] + br label %bb4198 + + bb79: ; preds = %bb4189.preheader + br i1 false, label %cond_next239, label %cond_true + + cond_true: ; preds = %bb79 + ret void + + cond_next239: ; preds = %bb79 + %tmp286 = alloca i8, i32 0 ; [#uses=0] + ret void + + bb4198: ; preds = %bb4189.preheader, %entry + br i1 false, label %bb4189.preheader, label %bb4204 + + bb4189.preheader: ; preds = %bb4198 + br i1 false, label %bb79, label %bb4198 + + bb4204: ; preds = %bb4198 + br i1 false, label %bb4221, label %cond_next4213 + + cond_next4213: ; preds = %bb4204 + ret void + + bb4221: ; preds = %bb4204 + br i1 false, label %bb5242.preheader, label %UnifiedReturnBlock + + bb5242.preheader: ; preds = %bb4221 + br label %bb5242 + + bb4231: ; preds = %bb5233 + %tmp4254.sum = add i32 0, 1 ; [#uses=2] + br i1 false, label %bb4559, label %cond_next4622 + + bb4559: ; preds = %bb4231 + ret void + + cond_next4622: ; preds = %bb4231 + %tmp4637 = load i16* null ; [#uses=1] + %tmp46374638 = sext i16 %tmp4637 to i32 ; [#uses=1] + %tmp4642 = load i16* null ; [#uses=1] + %tmp46424643 = sext i16 %tmp4642 to i32 ; [#uses=1] + %tmp4648 = load i16* null ; [#uses=1] + %tmp46484649 = sext i16 %tmp4648 to i32 ; [#uses=1] + %tmp4653 = getelementptr %struct.BlockNode* null, i32 %tmp4254.sum, i32 0 ; [#uses=1] + %tmp4654 = load i16* %tmp4653 ; [#uses=1] + %tmp46544655 = sext i16 %tmp4654 to i32 ; [#uses=1] + %tmp4644 = add i32 %tmp46374638, 2 ; [#uses=1] + %tmp4650 = add i32 %tmp4644, %tmp46424643 ; [#uses=1] + %tmp4656 = add i32 %tmp4650, %tmp46484649 ; [#uses=1] + %tmp4657 = add i32 %tmp4656, %tmp46544655 ; [#uses=2] + %tmp4658 = ashr i32 %tmp4657, 2 ; [#uses=1] + %tmp4662 = load i16* null ; [#uses=1] + %tmp46624663 = sext i16 %tmp4662 to i32 ; [#uses=1] + %tmp4672 = getelementptr %struct.BlockNode* null, i32 0, i32 1 ; [#uses=1] + %tmp4673 = load i16* %tmp4672 ; [#uses=1] + %tmp46734674 = sext i16 %tmp4673 to i32 ; [#uses=1] + %tmp4678 = getelementptr %struct.BlockNode* null, i32 %tmp4254.sum, i32 1 ; [#uses=1] + %tmp4679 = load i16* %tmp4678 ; [#uses=1] + %tmp46794680 = sext i16 %tmp4679 to i32 ; [#uses=1] + %tmp4669 = add i32 %tmp46624663, 2 ; [#uses=1] + %tmp4675 = add i32 %tmp4669, 0 ; [#uses=1] + %tmp4681 = add i32 %tmp4675, %tmp46734674 ; [#uses=1] + %tmp4682 = add i32 %tmp4681, %tmp46794680 ; [#uses=2] + %tmp4683 = ashr i32 %tmp4682, 2 ; [#uses=1] + %tmp4703 = load i32* %tmp21 ; [#uses=1] + %tmp4707 = shl i32 %tmp4703, 0 ; [#uses=4] + %tmp4710 = load %struct.BlockNode** null ; <%struct.BlockNode*> [#uses=6] + %tmp4713 = mul i32 %tmp4707, %mb_y.4 ; [#uses=1] + %tmp4715 = add i32 %tmp4713, %mb_x.7 ; [#uses=7] + store i8 0, i8* null + store i8 0, i8* null + %tmp47594761 = bitcast %struct.BlockNode* null to i8* ; [#uses=2] + call void @llvm.memcpy.i32( i8* null, i8* %tmp47594761, i32 10, i32 0 ) + %tmp4716.sum5775 = add i32 %tmp4715, 1 ; [#uses=1] + %tmp4764 = getelementptr %struct.BlockNode* %tmp4710, i32 %tmp4716.sum5775 ; <%struct.BlockNode*> [#uses=1] + %tmp47644766 = bitcast %struct.BlockNode* %tmp4764 to i8* ; [#uses=1] + %tmp4716.sum5774 = add i32 %tmp4715, %tmp4707 ; [#uses=0] + %tmp47704772 = bitcast %struct.BlockNode* null to i8* ; [#uses=1] + %tmp4774 = add i32 %tmp4707, 1 ; [#uses=1] + %tmp4716.sum5773 = add i32 %tmp4774, %tmp4715 ; [#uses=1] + %tmp4777 = getelementptr %struct.BlockNode* %tmp4710, i32 %tmp4716.sum5773 ; <%struct.BlockNode*> [#uses=1] + %tmp47774779 = bitcast %struct.BlockNode* %tmp4777 to i8* ; [#uses=1] + %tmp4781 = icmp slt i32 %mb_x.7, 0 ; [#uses=1] + %tmp4788 = or i1 %tmp4781, %tmp4784 ; [#uses=2] + br i1 %tmp4788, label %cond_true4791, label %cond_next4794 + + cond_true4791: ; preds = %cond_next4622 + unreachable + + cond_next4794: ; preds = %cond_next4622 + %tmp4797 = icmp slt i32 %mb_x.7, %tmp4707 ; [#uses=1] + br i1 %tmp4797, label %cond_next4803, label %cond_true4800 + + cond_true4800: ; preds = %cond_next4794 + unreachable + + cond_next4803: ; preds = %cond_next4794 + %tmp4825 = ashr i32 %tmp4657, 12 ; [#uses=1] + shl i32 %tmp4682, 4 ; :0 [#uses=1] + %tmp4828 = and i32 %0, -64 ; [#uses=1] + %tmp4831 = getelementptr %struct.BlockNode* %tmp4710, i32 %tmp4715, i32 2 ; [#uses=0] + %tmp4826 = add i32 %tmp4828, %tmp4825 ; [#uses=1] + %tmp4829 = add i32 %tmp4826, 0 ; [#uses=1] + %tmp4835 = add i32 %tmp4829, 0 ; [#uses=1] + store i32 %tmp4835, i32* null + %tmp48534854 = trunc i32 %tmp4658 to i16 ; [#uses=1] + %tmp4856 = getelementptr %struct.BlockNode* %tmp4710, i32 %tmp4715, i32 0 ; [#uses=1] + store i16 %tmp48534854, i16* %tmp4856 + %tmp48574858 = trunc i32 %tmp4683 to i16 ; [#uses=1] + %tmp4860 = getelementptr %struct.BlockNode* %tmp4710, i32 %tmp4715, i32 1 ; [#uses=1] + store i16 %tmp48574858, i16* %tmp4860 + %tmp4866 = getelementptr %struct.BlockNode* %tmp4710, i32 %tmp4715, i32 4 ; [#uses=0] + br i1 false, label %bb4933, label %cond_false4906 + + cond_false4906: ; preds = %cond_next4803 + call void @llvm.memcpy.i32( i8* %tmp47594761, i8* null, i32 10, i32 0 ) + call void @llvm.memcpy.i32( i8* %tmp47644766, i8* null, i32 10, i32 0 ) + call void @llvm.memcpy.i32( i8* %tmp47704772, i8* null, i32 10, i32 0 ) + call void @llvm.memcpy.i32( i8* %tmp47774779, i8* null, i32 10, i32 0 ) + br label %bb5215 + + bb4933: ; preds = %bb5215, %cond_next4803 + br i1 false, label %cond_true4944, label %bb5215 + + cond_true4944: ; preds = %bb4933 + %tmp4982 = load i32* %tmp21 ; [#uses=1] + %tmp4986 = shl i32 %tmp4982, 0 ; [#uses=2] + %tmp4992 = mul i32 %tmp4986, %mb_y.4 ; [#uses=1] + %tmp4994 = add i32 %tmp4992, %mb_x.7 ; [#uses=5] + %tmp4995.sum5765 = add i32 %tmp4994, 1 ; [#uses=1] + %tmp5043 = getelementptr %struct.BlockNode* null, i32 %tmp4995.sum5765 ; <%struct.BlockNode*> [#uses=1] + %tmp50435045 = bitcast %struct.BlockNode* %tmp5043 to i8* ; [#uses=2] + call void @llvm.memcpy.i32( i8* null, i8* %tmp50435045, i32 10, i32 0 ) + %tmp4995.sum5764 = add i32 %tmp4994, %tmp4986 ; [#uses=1] + %tmp5049 = getelementptr %struct.BlockNode* null, i32 %tmp4995.sum5764 ; <%struct.BlockNode*> [#uses=1] + %tmp50495051 = bitcast %struct.BlockNode* %tmp5049 to i8* ; [#uses=2] + call void @llvm.memcpy.i32( i8* null, i8* %tmp50495051, i32 10, i32 0 ) + %tmp4995.sum5763 = add i32 0, %tmp4994 ; [#uses=1] + %tmp5056 = getelementptr %struct.BlockNode* null, i32 %tmp4995.sum5763 ; <%struct.BlockNode*> [#uses=1] + %tmp50565058 = bitcast %struct.BlockNode* %tmp5056 to i8* ; [#uses=1] + br i1 %tmp4788, label %cond_true5070, label %cond_next5073 + + cond_true5070: ; preds = %cond_true4944 + unreachable + + cond_next5073: ; preds = %cond_true4944 + %tmp5139 = getelementptr %struct.BlockNode* null, i32 %tmp4994, i32 1 ; [#uses=0] + %tmp5145 = getelementptr %struct.BlockNode* null, i32 %tmp4994, i32 4 ; [#uses=0] + call void @llvm.memcpy.i32( i8* %tmp50435045, i8* null, i32 10, i32 0 ) + call void @llvm.memcpy.i32( i8* %tmp50495051, i8* null, i32 10, i32 0 ) + call void @llvm.memcpy.i32( i8* %tmp50565058, i8* null, i32 10, i32 0 ) + br label %bb5215 + + bb5215: ; preds = %cond_next5073, %bb4933, %cond_false4906 + %i4232.3 = phi i32 [ 0, %cond_false4906 ], [ 0, %cond_next5073 ], [ 0, %bb4933 ] ; [#uses=1] + %tmp5217 = icmp slt i32 %i4232.3, 4 ; [#uses=1] + br i1 %tmp5217, label %bb4933, label %bb5220 + + bb5220: ; preds = %bb5215 + br i1 false, label %bb5230, label %cond_true5226 + + cond_true5226: ; preds = %bb5220 + ret void + + bb5230: ; preds = %bb5220 + %indvar.next = add i32 %indvar, 1 ; [#uses=1] + br label %bb5233 + + bb5233: ; preds = %bb5233.preheader, %bb5230 + %indvar = phi i32 [ 0, %bb5233.preheader ], [ %indvar.next, %bb5230 ] ; [#uses=2] + %mb_x.7 = shl i32 %indvar, 1 ; [#uses=4] + br i1 false, label %bb4231, label %bb5239 + + bb5239: ; preds = %bb5233 + %indvar.next37882 = add i32 %indvar37881, 1 ; [#uses=1] + br label %bb5242 + + bb5242: ; preds = %bb5239, %bb5242.preheader + %indvar37881 = phi i32 [ 0, %bb5242.preheader ], [ %indvar.next37882, %bb5239 ] ; [#uses=2] + %mb_y.4 = shl i32 %indvar37881, 1 ; [#uses=3] + br i1 false, label %bb5233.preheader, label %bb5248 + + bb5233.preheader: ; preds = %bb5242 + %tmp4784 = icmp slt i32 %mb_y.4, 0 ; [#uses=1] + br label %bb5233 + + bb5248: ; preds = %bb5242 + ret void + + UnifiedReturnBlock: ; preds = %bb4221 + ret void + } + + declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) From sabre at nondot.org Thu May 31 13:58:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 31 May 2007 13:58:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200705311858.l4VIw7X0031907@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.163 -> 1.164 --- Log message: Fix the asmprinter so that a globalvalue can specify an explicit alignment smaller than the preferred alignment, but so that the target can actually specify a minimum alignment if needed. This fixes some objc protocol failures Devang tracked down. --- Diffs of the changes: (+18 -5) AsmPrinter.cpp | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.163 llvm/lib/CodeGen/AsmPrinter.cpp:1.164 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.163 Wed May 2 20:11:53 2007 +++ llvm/lib/CodeGen/AsmPrinter.cpp Thu May 31 13:57:45 2007 @@ -605,12 +605,25 @@ //===----------------------------------------------------------------------===// -// EmitAlignment - Emit an alignment directive to the specified power of two. -// Use the maximum of the specified alignment and the alignment from the -// specified GlobalValue (if any). -void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const { +// EmitAlignment - Emit an alignment directive to the specified power of +// two boundary. For example, if you pass in 3 here, you will get an 8 +// byte alignment. If a global value is specified, and if that global has +// an explicit alignment requested, it will unconditionally override the +// alignment request. However, if ForcedAlignBits is specified, this value +// has final say: the ultimate alignment will be the max of ForcedAlignBits +// and the alignment computed with NumBits and the global. +// +// The algorithm is: +// Align = NumBits; +// if (GV && GV->hasalignment) Align = GV->getalignment(); +// Align = std::max(Align, ForcedAlignBits); +// +void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV, + unsigned ForcedAlignBits) const { if (GV && GV->getAlignment()) - NumBits = std::max(NumBits, Log2_32(GV->getAlignment())); + NumBits = Log2_32(GV->getAlignment()); + NumBits = std::max(NumBits, ForcedAlignBits); + if (NumBits == 0) return; // No need to emit alignment. if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits; O << TAI->getAlignDirective() << NumBits << "\n"; From sabre at nondot.org Thu May 31 13:58:09 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 31 May 2007 13:58:09 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200705311858.l4VIw9tn031912@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.66 -> 1.67 --- Log message: Fix the asmprinter so that a globalvalue can specify an explicit alignment smaller than the preferred alignment, but so that the target can actually specify a minimum alignment if needed. This fixes some objc protocol failures Devang tracked down. --- Diffs of the changes: (+12 -2) AsmPrinter.h | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.66 llvm/include/llvm/CodeGen/AsmPrinter.h:1.67 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.66 Wed May 2 20:11:53 2007 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Thu May 31 13:57:45 2007 @@ -248,8 +248,18 @@ /// EmitAlignment - Emit an alignment directive to the specified power of /// two boundary. For example, if you pass in 3 here, you will get an 8 /// byte alignment. If a global value is specified, and if that global has - /// an explicit alignment requested, it will override the alignment request. - void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const; + /// an explicit alignment requested, it will unconditionally override the + /// alignment request. However, if ForcedAlignBits is specified, this value + /// has final say: the ultimate alignment will be the max of ForcedAlignBits + /// and the alignment computed with NumBits and the global. + /// + /// The algorithm is: + /// Align = NumBits; + /// if (GV && GV->hasalignment) Align = GV->getalignment(); + /// Align = std::max(Align, ForcedAlignBits); + /// + void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0, + unsigned ForcedAlignBits = 0) const; protected: /// EmitZeros - Emit a block of zeros. From sabre at nondot.org Thu May 31 13:58:09 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 31 May 2007 13:58:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp Message-ID: <200705311858.l4VIw92l031914@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.74 -> 1.75 --- Log message: Fix the asmprinter so that a globalvalue can specify an explicit alignment smaller than the preferred alignment, but so that the target can actually specify a minimum alignment if needed. This fixes some objc protocol failures Devang tracked down. --- Diffs of the changes: (+1 -1) ARMAsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.74 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.75 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.74 Mon May 14 20:29:07 2007 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Thu May 31 13:57:45 2007 @@ -218,7 +218,7 @@ O << VisibilityDirective << CurrentFnName << "\n"; if (AFI->isThumbFunction()) { - EmitAlignment(AFI->getAlign(), F); + EmitAlignment(1, F, AFI->getAlign()); O << "\t.code\t16\n"; O << "\t.thumb_func"; if (Subtarget->isTargetDarwin()) From evan.cheng at apple.com Thu May 31 15:53:52 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 15:53:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200705312053.l4VKrqmY002509@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.16 -> 1.17 --- Log message: Fix a typo. --- Diffs of the changes: (+1 -1) IfConversion.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.16 llvm/lib/CodeGen/IfConversion.cpp:1.17 --- llvm/lib/CodeGen/IfConversion.cpp:1.16 Wed May 30 14:49:19 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Thu May 31 15:53:33 2007 @@ -605,7 +605,7 @@ // tail block, and the tail block does not have other predecessors, then // fold the tail block in as well. if (BBI.TailBB && - BBI.TailBB->succ_size() == 1 && CvtBBI->BB->succ_size() == 1) { + BBI.TailBB->pred_size() == 1 && CvtBBI->BB->succ_size() == 1) { CvtBBI->NonPredSize -= TII->RemoveBranch(*CvtBBI->BB); BBInfo TailBBI = BBAnalysis[BBI.TailBB->getNumber()]; MergeBlocks(*CvtBBI, TailBBI); From evan.cheng at apple.com Thu May 31 16:21:41 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 14:21:41 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp In-Reply-To: <200705311828.l4VISItm030970@zion.cs.uiuc.edu> References: <200705311828.l4VISItm030970@zion.cs.uiuc.edu> Message-ID: Hi Lauro, This is the wrong fix. Even if disabling the use of RS when FP is used is correct, that's up to the target to not instantiate RS when it detects that. PEI shouldn't do this check. Please revert this fix. I'm going to reopen the bug because we need a proper fix. Evan On May 31, 2007, at 11:28 AM, Lauro Ramos Venancio wrote: > > > Changes in directory llvm/lib/CodeGen: > > PrologEpilogInserter.cpp updated: 1.87 -> 1.88 > --- > Log message: > > Fix PR1424: http://llvm.org/PR1424 . > When a function has FP, the register scavenging spill slot offset > already > was calculated. > > > --- > Diffs of the changes: (+1 -1) > > PrologEpilogInserter.cpp | 2 +- > 1 files changed, 1 insertion(+), 1 deletion(-) > > > Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp > diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 llvm/lib/ > CodeGen/PrologEpilogInserter.cpp:1.88 > --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 Wed May 2 > 20:11:53 2007 > +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu May 31 13:27:58 2007 > @@ -428,7 +428,7 @@ > > // Make sure the special register scavenging spill slot is > closest to the > // stack pointer. > - if (RS) { > + if (RS && !RegInfo->hasFP(Fn)) { > int SFI = RS->getScavengingFrameIndex(); > if (SFI >= 0) { > // If stack grows down, we need to add size of find the lowest > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Thu May 31 16:54:20 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 31 May 2007 16:54:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.60 -> 1.61 --- Log message: Arrange for only 1 of multiple branches to landing pad to be kept. Do not remove empty landing pads (EH table needs to be updated) --- Diffs of the changes: (+13 -4) BranchFolding.cpp | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.60 llvm/lib/CodeGen/BranchFolding.cpp:1.61 --- llvm/lib/CodeGen/BranchFolding.cpp:1.60 Tue May 29 19:32:01 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Thu May 31 16:54:00 2007 @@ -684,18 +684,26 @@ } } - MachineBasicBlock::pred_iterator SI = MBB.succ_begin(); + MachineBasicBlock::succ_iterator SI = MBB.succ_begin(); + bool foundPad = false; while (SI != MBB.succ_end()) { if (*SI == DestA && DestA == DestB) { DestA = DestB = 0; + if ((*SI)->isLandingPad()) + foundPad = true; ++SI; } else if (*SI == DestA) { DestA = 0; + if ((*SI)->isLandingPad()) + foundPad = true; ++SI; } else if (*SI == DestB) { DestB = 0; + if ((*SI)->isLandingPad()) + foundPad = true; ++SI; - } else if ((*SI)->isLandingPad()) { + } else if ((*SI)->isLandingPad() && !foundPad) { + foundPad = true; ++SI; } else { // Otherwise, this is a superfluous edge, remove it. @@ -832,8 +840,9 @@ ++FallThrough; // If this block is empty, make everyone use its fall-through, not the block - // explicitly. - if (MBB->empty()) { + // explicitly. Landing pads should not do this since the landing-pad table + // points to this block. + if (MBB->empty() && !MBB->isLandingPad()) { // Dead block? Leave for cleanup later. if (MBB->pred_empty()) return; From dpatel at apple.com Thu May 31 16:56:53 2007 From: dpatel at apple.com (dpatel at apple.com) Date: Thu, 31 May 2007 14:56:53 -0700 (PDT) Subject: [llvm-commits] [127876] Explicitly set alignment for Objective-C protocols. Message-ID: <20070531215653.66D106085DD7@src> Revision: 127876 Author: dpatel Date: 2007-05-31 14:56:52 -0700 (Thu, 31 May 2007) Log Message: ----------- Explicitly set alignment for Objective-C protocols. Set Global Value alignment if it is specified by User. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-backend.cpp apple-local/branches/llvm/gcc/objc/objc-act.c Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-31 20:27:28 UTC (rev 127875) +++ apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-31 21:56:52 UTC (rev 127876) @@ -68,8 +68,6 @@ #include "langhooks.h" } -extern int flag_next_runtime; - // Non-zero if bytecode from PCH is successfully read. int flag_llvm_pch_read; @@ -735,17 +733,17 @@ } else if (const char *Section = LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) { GV->setSection(Section); - // Next runtime expects 4 byte alignment for Objective-C data. - if (flag_next_runtime) - GV->setAlignment(4); #endif } - // Set the alignment for the global. - if (DECL_ALIGN_UNIT(decl) && - getTargetData().getABITypeAlignment(GV->getType()->getElementType()) != - DECL_ALIGN_UNIT(decl)) - GV->setAlignment(DECL_ALIGN_UNIT(decl)); + // Set the alignment for the global if one of the following condition is met + // 1) DECL_ALIGN_UNIT does not match alignment as per ABI specification + // 2) DECL_ALIGN is set by user. + if (DECL_ALIGN_UNIT(decl)) { + unsigned TargetAlign = getTargetData().getABITypeAlignment(GV->getType()->getElementType()); + if (DECL_USER_ALIGN(decl) || TargetAlign != DECL_ALIGN_UNIT(decl)) + GV->setAlignment(DECL_ALIGN_UNIT(decl)); + } // Handle used decls if (DECL_PRESERVE_P (decl)) Modified: apple-local/branches/llvm/gcc/objc/objc-act.c =================================================================== --- apple-local/branches/llvm/gcc/objc/objc-act.c 2007-05-31 20:27:28 UTC (rev 127875) +++ apple-local/branches/llvm/gcc/objc/objc-act.c 2007-05-31 21:56:52 UTC (rev 127876) @@ -9270,6 +9270,11 @@ /* APPLE LOCAL radar 4695109 */ UOBJC_PROTOCOL_EXT_decl, NULL_TREE); /* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */ + /* APPLE LOCAL begin LLVM */ + /* Force 4 byte alignment for protocols */ + DECL_ALIGN(decl) = 32; + DECL_USER_ALIGN(decl) = 1; + /* APPLE LOCAL end LLVM */ finish_var_decl (decl, initlist); } } From reid at x10sys.com Thu May 31 17:20:50 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 31 May 2007 17:20:50 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/06-Spencer-HLVM.pdf Message-ID: <200705312220.l4VMKoxg004625@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: 06-Spencer-HLVM.pdf added (r1.1) --- Log message: Add Reid's Slides. --- Diffs of the changes: (+0 -0) 06-Spencer-HLVM.pdf | 0 1 files changed Index: llvm-www/devmtg/2007-05/06-Spencer-HLVM.pdf From reid at x10sys.com Thu May 31 17:23:26 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 31 May 2007 17:23:26 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/index.html Message-ID: <200705312223.l4VMNQCv004825@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: index.html updated: 1.7 -> 1.8 --- Log message: Add link to Reid's slides. --- Diffs of the changes: (+5 -3) index.html | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm-www/devmtg/2007-05/index.html diff -u llvm-www/devmtg/2007-05/index.html:1.7 llvm-www/devmtg/2007-05/index.html:1.8 --- llvm-www/devmtg/2007-05/index.html:1.7 Wed May 30 15:24:48 2007 +++ llvm-www/devmtg/2007-05/index.html Thu May 31 17:23:04 2007 @@ -77,8 +77,10 @@ as VRP (Value Range Propagation). - video - Reid Spencer + + video
    + slides + Reid Spencer HLVM - An overview of HLVM, its current status and its goals after integration with LLVM. @@ -243,6 +245,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/05/30 20:24:48 $ +
    Last modified: $Date: 2007/05/31 22:23:04 $ From clattner at apple.com Thu May 31 17:33:29 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 31 May 2007 15:33:29 -0700 Subject: [llvm-commits] [127876] Explicitly set alignment for Objective-C protocols. In-Reply-To: <20070531215653.66D106085DD7@src> References: <20070531215653.66D106085DD7@src> Message-ID: <055F1A64-2E39-4A1D-97B7-46B01ADCBDEE@apple.com> Nice! Thanks Devang, -Chris On May 31, 2007, at 2:56 PM, dpatel at apple.com wrote: > Revision: 127876 > Author: dpatel > Date: 2007-05-31 14:56:52 -0700 (Thu, 31 May 2007) > > Log Message: > ----------- > Explicitly set alignment for Objective-C protocols. > Set Global Value alignment if it is specified by User. > > Modified Paths: > -------------- > apple-local/branches/llvm/gcc/llvm-backend.cpp > apple-local/branches/llvm/gcc/objc/objc-act.c > > Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp > =================================================================== > --- apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-31 > 20:27:28 UTC (rev 127875) > +++ apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-31 > 21:56:52 UTC (rev 127876) > @@ -68,8 +68,6 @@ > #include "langhooks.h" > } > > -extern int flag_next_runtime; > - > // Non-zero if bytecode from PCH is successfully read. > int flag_llvm_pch_read; > > @@ -735,17 +733,17 @@ > } else if (const char *Section = > LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) { > GV->setSection(Section); > - // Next runtime expects 4 byte alignment for Objective-C data. > - if (flag_next_runtime) > - GV->setAlignment(4); > #endif > } > > - // Set the alignment for the global. > - if (DECL_ALIGN_UNIT(decl) && > - getTargetData().getABITypeAlignment(GV->getType()- > >getElementType()) != > - DECL_ALIGN_UNIT(decl)) > - GV->setAlignment(DECL_ALIGN_UNIT(decl)); > + // Set the alignment for the global if one of the following > condition is met > + // 1) DECL_ALIGN_UNIT does not match alignment as per ABI > specification > + // 2) DECL_ALIGN is set by user. > + if (DECL_ALIGN_UNIT(decl)) { > + unsigned TargetAlign = getTargetData().getABITypeAlignment > (GV->getType()->getElementType()); > + if (DECL_USER_ALIGN(decl) || TargetAlign != DECL_ALIGN_UNIT > (decl)) > + GV->setAlignment(DECL_ALIGN_UNIT(decl)); > + } > > // Handle used decls > if (DECL_PRESERVE_P (decl)) > > Modified: apple-local/branches/llvm/gcc/objc/objc-act.c > =================================================================== > --- apple-local/branches/llvm/gcc/objc/objc-act.c 2007-05-31 > 20:27:28 UTC (rev 127875) > +++ apple-local/branches/llvm/gcc/objc/objc-act.c 2007-05-31 > 21:56:52 UTC (rev 127876) > @@ -9270,6 +9270,11 @@ > /* APPLE LOCAL radar 4695109 */ > UOBJC_PROTOCOL_EXT_decl, NULL_TREE); > /* APPLE LOCAL end radar 4585769 - Objective-C 1.0 > extensions */ > + /* APPLE LOCAL begin LLVM */ > + /* Force 4 byte alignment for protocols */ > + DECL_ALIGN(decl) = 32; > + DECL_USER_ALIGN(decl) = 1; > + /* APPLE LOCAL end LLVM */ > finish_var_decl (decl, initlist); > } > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From lauro.venancio at gmail.com Thu May 31 17:34:21 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Thu, 31 May 2007 19:34:21 -0300 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp In-Reply-To: References: <200705311828.l4VISItm030970@zion.cs.uiuc.edu> Message-ID: <9c10c9f0705311534s61c1201wb755ea830c6aae7@mail.gmail.com> I'm not disabling the use of RS when FP is used. About 30 lines before my change, there is this code: if (RS && RegInfo->hasFP(Fn)) { int SFI = RS->getScavengingFrameIndex(); if (SFI >= 0) { ... The bug was: the PrologEpilogInserter has two chunks of code to define the ScavengingFrameIndex offset (one for when fp is used and other for when sp is used). The sp chunk of code was overwriting the calculation made by fp chunk of code. Lauro 2007/5/31, Evan Cheng : > Hi Lauro, > > This is the wrong fix. > > Even if disabling the use of RS when FP is used is correct, that's up > to the target to not instantiate RS when it detects that. PEI > shouldn't do this check. Please revert this fix. I'm going to reopen > the bug because we need a proper fix. > > Evan > > On May 31, 2007, at 11:28 AM, Lauro Ramos Venancio wrote: > > > > > > > Changes in directory llvm/lib/CodeGen: > > > > PrologEpilogInserter.cpp updated: 1.87 -> 1.88 > > --- > > Log message: > > > > Fix PR1424: http://llvm.org/PR1424 . > > When a function has FP, the register scavenging spill slot offset > > already > > was calculated. > > > > > > --- > > Diffs of the changes: (+1 -1) > > > > PrologEpilogInserter.cpp | 2 +- > > 1 files changed, 1 insertion(+), 1 deletion(-) > > > > > > Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp > > diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 llvm/lib/ > > CodeGen/PrologEpilogInserter.cpp:1.88 > > --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 Wed May 2 > > 20:11:53 2007 > > +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu May 31 13:27:58 2007 > > @@ -428,7 +428,7 @@ > > > > // Make sure the special register scavenging spill slot is > > closest to the > > // stack pointer. > > - if (RS) { > > + if (RS && !RegInfo->hasFP(Fn)) { > > int SFI = RS->getScavengingFrameIndex(); > > if (SFI >= 0) { > > // If stack grows down, we need to add size of find the lowest > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From resistor at mac.com Thu May 31 17:44:33 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 31 May 2007 17:44:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200705312244.l4VMiX3Y005348@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.7 -> 1.8 --- Log message: Add a topological sort function. --- Diffs of the changes: (+56 -2) GVNPRE.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 56 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.7 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.8 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.7 Wed May 30 19:42:15 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Thu May 31 17:44:11 2007 @@ -30,7 +30,9 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include +#include #include +#include #include using namespace llvm; @@ -113,6 +115,9 @@ std::set& anticIn, BasicBlock* B, std::set& out); + void topo_sort(ValueTable& VN, std::set& set, + std::vector& vec); + // For a given block, calculate the generated expressions, temporaries, // and the AVAIL_OUT set void CalculateAvailOut(ValueTable& VN, std::set& MS, @@ -332,11 +337,60 @@ } } +void GVNPRE::topo_sort(GVNPRE::ValueTable& VN, + std::set& set, + std::vector& vec) { + std::set toErase; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) { + for (std::set::iterator SI = set.begin(); SI != E; ++SI) { + if (I->lhs == VN[*SI] || I->rhs == VN[*SI]) { + toErase.insert(*SI); + } + } + } + + std::vector Q; + std::insert_iterator > q_ins(Q, Q.begin()); + std::set_difference(set.begin(), set.end(), + toErase.begin(), toErase.end(), + q_ins); + + std::set visited; + while (!Q.empty()) { + Expression e = Q.back(); + + if (e.opcode == 0) { + visited.insert(e); + vec.push_back(e); + Q.pop_back(); + continue; + } + + std::set::iterator l = find_leader(VN, set, e.lhs); + std::set::iterator r = find_leader(VN, set, e.rhs); + + if (l != set.end() && visited.find(*l) == visited.end()) + Q.push_back(*l); + else if (r != set.end() && visited.find(*r) == visited.end()) + Q.push_back(*r); + else { + vec.push_back(e); + visited.insert(e); + Q.pop_back(); + } + } +} + void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { + std::vector sorted; + topo_sort(VN, s, sorted); DOUT << "{ "; - for (std::set::iterator I = s.begin(), E = s.end(); I != E; ++I) { + for (std::vector::iterator I = sorted.begin(), E = sorted.end(); + I != E; ++I) { + DOUT << VN[*I] << ": "; DOUT << "( "; - DOUT << I->opcode+48; + DOUT << (char)(I->opcode+48); DOUT << ", " << (I->value == 0 ? "0" : I->value->getName().c_str()) << ", value." << I->lhs << ", value." << I->rhs << " ) "; From reid at x10sys.com Thu May 31 17:45:11 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 31 May 2007 17:45:11 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2007-05/06-Spencer-HLVM.pdf Message-ID: <200705312245.l4VMjB87005424@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2007-05: 06-Spencer-HLVM.pdf updated: 1.1 -> 1.2 --- Log message: Remove "Confidential & Proprietary" notice from slides.` --- Diffs of the changes: (+0 -0) 06-Spencer-HLVM.pdf | 0 1 files changed Index: llvm-www/devmtg/2007-05/06-Spencer-HLVM.pdf From evan.cheng at apple.com Thu May 31 17:45:29 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 15:45:29 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp In-Reply-To: <9c10c9f0705311534s61c1201wb755ea830c6aae7@mail.gmail.com> References: <200705311828.l4VISItm030970@zion.cs.uiuc.edu> <9c10c9f0705311534s61c1201wb755ea830c6aae7@mail.gmail.com> Message-ID: On May 31, 2007, at 3:34 PM, Lauro Ramos Venancio wrote: > I'm not disabling the use of RS when FP is used. About 30 lines > before my > change, there is this code: > > if (RS && RegInfo->hasFP(Fn)) { > int SFI = RS->getScavengingFrameIndex(); > if (SFI >= 0) { > ... > > The bug was: the PrologEpilogInserter has two chunks of code to > define the > ScavengingFrameIndex offset (one for when fp is used and other for > when sp is > used). The sp chunk of code was overwriting the calculation made by > fp chunk of > code. Ahhhh... Now that it makes sense. Please add a line of comment so an idiot like me can read my own code. :-) Evan > > Lauro > > > 2007/5/31, Evan Cheng : >> Hi Lauro, >> >> This is the wrong fix. >> >> Even if disabling the use of RS when FP is used is correct, that's up >> to the target to not instantiate RS when it detects that. PEI >> shouldn't do this check. Please revert this fix. I'm going to reopen >> the bug because we need a proper fix. >> >> Evan >> >> On May 31, 2007, at 11:28 AM, Lauro Ramos Venancio wrote: >> >> > >> > >> > Changes in directory llvm/lib/CodeGen: >> > >> > PrologEpilogInserter.cpp updated: 1.87 -> 1.88 >> > --- >> > Log message: >> > >> > Fix PR1424: http://llvm.org/PR1424 . >> > When a function has FP, the register scavenging spill slot offset >> > already >> > was calculated. >> > >> > >> > --- >> > Diffs of the changes: (+1 -1) >> > >> > PrologEpilogInserter.cpp | 2 +- >> > 1 files changed, 1 insertion(+), 1 deletion(-) >> > >> > >> > Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp >> > diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 llvm/lib/ >> > CodeGen/PrologEpilogInserter.cpp:1.88 >> > --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.87 Wed May 2 >> > 20:11:53 2007 >> > +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu May 31 >> 13:27:58 2007 >> > @@ -428,7 +428,7 @@ >> > >> > // Make sure the special register scavenging spill slot is >> > closest to the >> > // stack pointer. >> > - if (RS) { >> > + if (RS && !RegInfo->hasFP(Fn)) { >> > int SFI = RS->getScavengingFrameIndex(); >> > if (SFI >= 0) { >> > // If stack grows down, we need to add size of find the >> lowest >> > >> > >> > >> > _______________________________________________ >> > llvm-commits mailing list >> > llvm-commits at cs.uiuc.edu >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> From lauro.venancio at gmail.com Thu May 31 17:55:31 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Thu, 31 May 2007 17:55:31 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/Benchmarks/Misc-C++/stepanov_v1p2.cpp Message-ID: <200705312255.l4VMtV16005706@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/Benchmarks/Misc-C++: stepanov_v1p2.cpp updated: 1.2 -> 1.3 --- Log message: Add SMALL_PROBLEM_SIZE support. --- Diffs of the changes: (+4 -0) stepanov_v1p2.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm-test/SingleSource/Benchmarks/Misc-C++/stepanov_v1p2.cpp diff -u llvm-test/SingleSource/Benchmarks/Misc-C++/stepanov_v1p2.cpp:1.2 llvm-test/SingleSource/Benchmarks/Misc-C++/stepanov_v1p2.cpp:1.3 --- llvm-test/SingleSource/Benchmarks/Misc-C++/stepanov_v1p2.cpp:1.2 Wed May 16 17:28:47 2007 +++ llvm-test/SingleSource/Benchmarks/Misc-C++/stepanov_v1p2.cpp Thu May 31 17:55:09 2007 @@ -192,7 +192,11 @@ return result; } +#ifdef SMALL_PROBLEM_SIZE +int iterations = 10000; +#else int iterations = 250000; +#endif #define SIZE 2000 int current_test = 0; From lauro.venancio at gmail.com Thu May 31 18:44:19 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Thu, 31 May 2007 18:44:19 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/Benchmarks/Misc/flops.c Message-ID: <200705312344.l4VNiJYf006879@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/Benchmarks/Misc: flops.c updated: 1.3 -> 1.4 --- Log message: Add SMALL_PROBLEM_SIZE support. --- Diffs of the changes: (+4 -1) flops.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/Benchmarks/Misc/flops.c diff -u llvm-test/SingleSource/Benchmarks/Misc/flops.c:1.3 llvm-test/SingleSource/Benchmarks/Misc/flops.c:1.4 --- llvm-test/SingleSource/Benchmarks/Misc/flops.c:1.3 Sat May 19 12:54:47 2007 +++ llvm-test/SingleSource/Benchmarks/Misc/flops.c Thu May 31 18:43:57 2007 @@ -258,8 +258,11 @@ if ( n == NLimit ) break; /* printf(" %10ld %12.5lf\n",n,sa); */ } - +#ifdef SMALL_PROBLEM_SIZE + scale = 1; +#else scale = 0.015895; +#endif T[1] = scale; /****************************************/ From evan.cheng at apple.com Thu May 31 19:12:35 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 19:12:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200706010012.l510CYr2007532@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.17 -> 1.18 --- Log message: Allow multiple ifcvt candidates to share children blocks; add some debugging code. --- Diffs of the changes: (+20 -7) IfConversion.cpp | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.17 llvm/lib/CodeGen/IfConversion.cpp:1.18 --- llvm/lib/CodeGen/IfConversion.cpp:1.17 Thu May 31 15:53:33 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Thu May 31 19:12:12 2007 @@ -11,7 +11,8 @@ // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "ifconversion" +#define DEBUG_TYPE "ifcvt" +#include "llvm/Function.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -105,6 +106,12 @@ std::vector &Cond, bool IgnoreTerm = false); void MergeBlocks(BBInfo &TrueBBI, BBInfo &FalseBBI); + + // IfcvtCandidateCmp - Used to sort if-conversion candidates. + static bool IfcvtCandidateCmp(BBInfo* C1, BBInfo* C2){ + // Favor diamond over triangle, etc. + return (unsigned)C1->Kind < (unsigned)C2->Kind; + } }; char IfConverter::ID = 0; } @@ -116,9 +123,10 @@ TII = MF.getTarget().getInstrInfo(); if (!TII) return false; + DOUT << "\nIfcvt: function \'" << MF.getFunction()->getName() << "\'\n"; + MF.RenumberBlocks(); - unsigned NumBBs = MF.getNumBlockIDs(); - BBAnalysis.resize(NumBBs); + BBAnalysis.resize(MF.getNumBlockIDs()); // Look for root nodes, i.e. blocks without successors. for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) @@ -139,13 +147,19 @@ switch (BBI.Kind) { default: assert(false && "Unexpected!"); break; + case ICReAnalyze: + // One or more of 'childrean' have been modified, abort! + break; case ICEarlyExit: + DOUT << "Ifcvt (Early exit): BB#" << BBI.BB->getNumber() << "\n"; Change |= IfConvertEarlyExit(BBI); break; case ICTriangle: + DOUT << "Ifcvt (Triangle): BB#" << BBI.BB->getNumber() << "\n"; Change |= IfConvertTriangle(BBI); break; case ICDiamond: + DOUT << "Ifcvt (Diamond): BB#" << BBI.BB->getNumber() << "\n"; Change |= IfConvertDiamond(BBI); break; } @@ -198,8 +212,6 @@ // Not a candidate if 'true' block is going to be if-converted. StructuralAnalysis(BBI.TrueBB); BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; - if (TrueBBI.Kind != ICNotClassfied) - return; // TODO: Only handle very simple cases for now. if (TrueBBI.FalseBB || TrueBBI.BrCond.size()) @@ -214,8 +226,6 @@ // Not a candidate if 'false' block is going to be if-converted. StructuralAnalysis(BBI.FalseBB); BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; - if (FalseBBI.Kind != ICNotClassfied) - return; // TODO: Only handle very simple cases for now. if (FalseBBI.FalseBB || FalseBBI.BrCond.size()) @@ -338,6 +348,9 @@ } } + // Sort to favor more complex ifcvt scheme. + std::stable_sort(Candidates.begin(), Candidates.end(), IfcvtCandidateCmp); + return Change; } From evan.cheng at apple.com Thu May 31 19:55:48 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 19:55:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200706010055.l510tmQo008494@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.18 -> 1.19 --- Log message: Remove a bogus check. Even terminators in a ifcvt need to be predicated. Unconditional branches can usually be converted to conditional ones. --- Diffs of the changes: (+1 -3) IfConversion.cpp | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.18 llvm/lib/CodeGen/IfConversion.cpp:1.19 --- llvm/lib/CodeGen/IfConversion.cpp:1.18 Thu May 31 19:12:12 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Thu May 31 19:55:26 2007 @@ -283,8 +283,6 @@ for (MachineBasicBlock::iterator I = BBI.BB->begin(), E = BBI.BB->end(); I != E; ++I) { // TODO: check if instruction clobbers predicate. - if (TII->isTerminatorInstr(I->getOpcode())) - break; if (!I->isPredicable()) return; } @@ -654,7 +652,7 @@ if (TII->isPredicated(MI)) continue; if (!TII->PredicateInstruction(MI, Cond)) { - cerr << "Unable to predication " << *I << "!\n"; + cerr << "Unable to predicate " << *I << "!\n"; abort(); } } From evan.cheng at apple.com Thu May 31 19:56:37 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 31 May 2007 19:56:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200706010056.l510ubhO008529@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.107 -> 1.108 --- Log message: Make jumptable non-predicable for now. --- Diffs of the changes: (+10 -11) ARMInstrInfo.td | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.107 llvm/lib/Target/ARM/ARMInstrInfo.td:1.108 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.107 Tue May 29 18:32:06 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Thu May 31 19:56:15 2007 @@ -400,14 +400,6 @@ class AI3po pattern> : I; -// BR_JT instructions -class JTI pattern> - : I; -class JTI1 pattern> - : I; -class JTI2 pattern> - : I; - class BinOpFrag : PatFrag<(ops node:$LHS, node:$RHS), res>; class UnOpFrag : PatFrag<(ops node:$Src), res>; @@ -516,6 +508,13 @@ class AXIx2 pattern> : XI; +// BR_JT instructions +class JTI pattern> + : XI; +class JTI1 pattern> + : XI; +class JTI2 pattern> + : XI; //===----------------------------------------------------------------------===// // Instructions @@ -639,14 +638,14 @@ [(br bb:$dst)]>; def BR_JTr : JTI<(ops GPR:$dst, jtblock_operand:$jt, i32imm:$id), - "mov", " pc, $dst \n$jt", + "mov pc, $dst \n$jt", [(ARMbrjt GPR:$dst, tjumptable:$jt, imm:$id)]>; def BR_JTm : JTI2<(ops addrmode2:$dst, jtblock_operand:$jt, i32imm:$id), - "ldr", " pc, $dst \n$jt", + "ldr pc, $dst \n$jt", [(ARMbrjt (i32 (load addrmode2:$dst)), tjumptable:$jt, imm:$id)]>; def BR_JTadd : JTI1<(ops GPR:$dst, GPR:$idx, jtblock_operand:$jt, i32imm:$id), - "add", " pc, $dst, $idx \n$jt", + "add pc, $dst, $idx \n$jt", [(ARMbrjt (add GPR:$dst, GPR:$idx), tjumptable:$jt, imm:$id)]>; } From evan.cheng at apple.com Fri Jun 1 02:42:38 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Jun 2007 02:42:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200706010742.l517gcCv026423@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.19 -> 1.20 --- Log message: Ifcvt triangle: don't ifcvt 'true' BB if it has other predecessors; don't merge 'false' BB if it has other predecessors. --- Diffs of the changes: (+18 -3) IfConversion.cpp | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.19 llvm/lib/CodeGen/IfConversion.cpp:1.20 --- llvm/lib/CodeGen/IfConversion.cpp:1.19 Thu May 31 19:55:26 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Fri Jun 1 02:41:07 2007 @@ -460,14 +460,29 @@ if (!TrueBBI.isPredicable) return false; + // FIXME: Consider duplicating if BB is small. + if (BBI.TrueBB->pred_size() > 1) + return false; + // Predicate the 'true' block after removing its branch. TrueBBI.NonPredSize -= TII->RemoveBranch(*BBI.TrueBB); PredicateBlock(TrueBBI, BBI.BrCond); - // Join the 'true' and 'false' blocks by copying the instructions - // from the 'false' block to the 'true' block. + // If 'true' block has a 'false' successor, add a early exit branch to it. + if (TrueBBI.FalseBB) { + std::vector RevCond(TrueBBI.BrCond); + if (TII->ReverseBranchCondition(RevCond)) + assert(false && "Unable to reverse branch condition!"); + TII->InsertBranch(*BBI.TrueBB, TrueBBI.FalseBB, NULL, RevCond); + } + + // Join the 'true' and 'false' blocks if the 'false' block has no other + // predecessors. Otherwise, add a unconditional branch from 'true' to 'false'. BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; - MergeBlocks(TrueBBI, FalseBBI); + if (FalseBBI.BB->pred_size() == 2) + MergeBlocks(TrueBBI, FalseBBI); + else + InsertUncondBranch(TrueBBI.BB, FalseBBI.BB, TII); // Now merge the entry of the triangle with the true block. BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); From baldrick at free.fr Fri Jun 1 03:18:52 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 03:18:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200706010818.l518Iqcg027254@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.454 -> 1.455 --- Log message: Since TypeInfos are passed as i8 pointers, a NULL TypeInfo should be passed as a null i8 pointer not as a 0 i32. --- Diffs of the changes: (+2 -4) SelectionDAGISel.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.454 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.455 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.454 Thu May 24 09:36:04 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jun 1 03:18:30 2007 @@ -2620,8 +2620,7 @@ for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) { Constant *C = cast(I.getOperand(i)); GlobalVariable *GV = ExtractGlobalVariable(C); - assert (GV || (isa(C) && - cast(C)->isNullValue()) && + assert (GV || isa(C) && "TypeInfo must be a global variable or NULL"); TyInfo.push_back(GV); } @@ -2653,8 +2652,7 @@ // Find the type id for the given typeinfo. Constant *C = cast(I.getOperand(1)); GlobalVariable *GV = ExtractGlobalVariable(C); - assert (GV || (isa(C) && - cast(C)->isNullValue()) && + assert (GV || isa(C) && "TypeInfo must be a global variable or NULL"); unsigned TypeID = MMI->getTypeIDFor(GV); From evan.cheng at apple.com Fri Jun 1 03:25:46 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Jun 2007 03:25:46 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200706010825.l518Pklu027492@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.126 -> 1.127 --- Log message: Target specific ifcvt code duplication limit. --- Diffs of the changes: (+21 -3) TargetLowering.h | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.126 llvm/include/llvm/Target/TargetLowering.h:1.127 --- llvm/include/llvm/Target/TargetLowering.h:1.126 Thu May 17 19:00:30 2007 +++ llvm/include/llvm/Target/TargetLowering.h Fri Jun 1 03:25:24 2007 @@ -440,6 +440,13 @@ return IfCvtBlockSizeLimit; } + /// getIfCvtDupBlockLimit - returns the target specific size limit for a + /// block to be considered for duplication. Any block whose size is greater + /// should not be duplicated to facilitate its predication. + virtual unsigned getIfCvtDupBlockSizeLimit() const { + return IfCvtDupBlockSizeLimit; + } + /// getPreIndexedAddressParts - returns true by value, base pointer and /// offset pointer and addressing mode by reference if the node's address /// can be legally represented as pre-indexed load / store address. @@ -758,11 +765,18 @@ } /// setIfCvtBlockSizeLimit - Set the target's if-conversion block size - /// (in number of instructions); default is 2. + /// limit (in number of instructions); default is 2. void setIfCvtBlockSizeLimit(unsigned Limit) { IfCvtBlockSizeLimit = Limit; } + /// setIfCvtDupBlockSizeLimit - Set the target's block size limit (in number + /// of instructions) to be considered for code duplication during + /// if-conversion; default is 2. + void setIfCvtDupBlockSizeLimit(unsigned Limit) { + IfCvtDupBlockSizeLimit = Limit; + } + public: //===--------------------------------------------------------------------===// @@ -995,10 +1009,14 @@ /// buffers unsigned JumpBufAlignment; - /// IfCvtBlockSizeLimit - The maximum allowed block size for if-conversion. - /// + /// IfCvtBlockSizeLimit - The maximum allowed size for a block to be + /// if-converted. unsigned IfCvtBlockSizeLimit; + /// IfCvtDupBlockSizeLimit - The maximum allowed size for a block to be + /// duplicated during if-conversion. + unsigned IfCvtDupBlockSizeLimit; + /// StackPointerRegisterToSaveRestore - If set to a physical register, this /// specifies the register that llvm.savestack/llvm.restorestack should save /// and restore. From evan.cheng at apple.com Fri Jun 1 03:29:21 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Jun 2007 03:29:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200706010829.l518TLGI027641@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.55 -> 1.56 --- Log message: Set ARM ifcvt duplication limit to 3 for now. --- Diffs of the changes: (+1 -0) ARMISelLowering.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.55 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.56 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.55 Thu May 17 20:19:57 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Jun 1 03:28:59 2007 @@ -255,6 +255,7 @@ setStackPointerRegisterToSaveRestore(ARM::SP); setSchedulingPreference(SchedulingForRegPressure); setIfCvtBlockSizeLimit(Subtarget->isThumb() ? 0 : 10); + setIfCvtDupBlockSizeLimit(Subtarget->isThumb() ? 0 : 3); maxStoresPerMemcpy = 1; //// temporary - rewrite interface to use type } From baldrick at free.fr Fri Jun 1 06:58:03 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 13:58:03 +0200 Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of In-Reply-To: References: <20070530053840.5113259B05AC@src> <200705311518.16204.baldrick@free.fr> Message-ID: <200706011358.04003.baldrick@free.fr> > > Hi Chris, this breaks the Ada build since the TYPE_SIZE may not be > > a constant: > > > >> + if (TYPE_SIZE(type) == 0 || > >> + PadStartBits >= int(TREE_INT_CST_LOW(TYPE_SIZE(type))) || > > > > I've attached a fix, which includes some other tweaks for arrays > > (not very important) plus whitespace cleanup. > > Does this actually cause a problem? This function is only called if > the outer struct has constant size. TreeToLLVM::EmitAggregateCopy > checks that TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST is true before > calling into this code. Yes, it crashes the compiler. Remember that the function is recursive. The problem is that a type of fixed size can have a field of variable size. For example, a record field which is a variable sized array, where the length is given by another field L in the record. In this case the size of the record type may be a constant equal to the maximum size obtained over all possible values of L. In the case in question, a record R contains a field F, which is also a record type. The fields present in F depend on the value of field E (of an enumeration type) in R. Yes this is possible! The size of F is thus an expression: it is calculated in terms of the value of E. The size of R is a constant: the maximum possible size, the maximum being taken over all values of E. Ciao, Duncan. From baldrick at free.fr Fri Jun 1 07:43:20 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 14:43:20 +0200 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp In-Reply-To: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> References: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> Message-ID: <200706011443.20827.baldrick@free.fr> Hi Dale, > Arrange for only 1 of multiple branches to landing pad to be kept. you seem to assume that there is at most one landing pad block for a given MBB, i.e. that all invokes in the MBB unwind to the same landing pad. Are you sure that's true? Ciao, Duncan. From sabre at nondot.org Fri Jun 1 11:16:22 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 1 Jun 2007 11:16:22 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200706011616.l51GGMw9008093@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.142 -> 1.143 --- Log message: actually link to the dev mtg slides :) --- Diffs of the changes: (+4 -4) www-index.html | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.142 llvm-www/www-index.html:1.143 --- llvm-www/www-index.html:1.142 Wed May 23 13:42:43 2007 +++ llvm-www/www-index.html Fri Jun 1 11:15:46 2007 @@ -116,10 +116,10 @@
    Developers Meeting
    May 25, 2007
    -

    Mark your calendars, the - Developers Meeting is on! - Please let us know if you - would like to attend.

    +

    The + May 2007 Developer Meeting meeting was + a great success. Videos and slides are now + available.


    From sabre at nondot.org Fri Jun 1 11:19:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 1 Jun 2007 11:19:38 -0500 Subject: [llvm-commits] CVS: llvm-www/OldNews.html Message-ID: <200706011619.l51GJcfK008552@zion.cs.uiuc.edu> Changes in directory llvm-www: OldNews.html updated: 1.4 -> 1.5 --- Log message: rotate some news --- Diffs of the changes: (+18 -0) OldNews.html | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm-www/OldNews.html diff -u llvm-www/OldNews.html:1.4 llvm-www/OldNews.html:1.5 --- llvm-www/OldNews.html:1.4 Wed Jul 19 12:52:31 2006 +++ llvm-www/OldNews.html Fri Jun 1 11:19:16 2007 @@ -1,6 +1,24 @@ +
    +Older Status Updates +
    + + Jun 9, 2004 Status Update
    + May 6, 2004 Status Update
    + Mar 19, 2004 Status Update
    + Feb 6, 2004 Status Update
    + Dec 17, 2003 Status Update
    + Nov 18, 2003 Status Update
    + Oct 7, 2003 Status Update
    + Sep 10, 2003 Status Update
    + Aug 15, 2003 Status Update
    + Jun 26, 2003 Status Update
    + + + + Older News From sabre at nondot.org Fri Jun 1 11:21:03 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 1 Jun 2007 11:21:03 -0500 Subject: [llvm-commits] CVS: llvm-www/OldNews.html Message-ID: <200706011621.l51GL3rn008845@zion.cs.uiuc.edu> Changes in directory llvm-www: OldNews.html updated: 1.5 -> 1.6 --- Log message: various updates --- Diffs of the changes: (+5 -3) OldNews.html | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm-www/OldNews.html diff -u llvm-www/OldNews.html:1.5 llvm-www/OldNews.html:1.6 --- llvm-www/OldNews.html:1.5 Fri Jun 1 11:19:16 2007 +++ llvm-www/OldNews.html Fri Jun 1 11:20:41 2007 @@ -4,19 +4,21 @@ Older Status Updates +
    Jun 9, 2004 Status Update
    May 6, 2004 Status Update
    - Mar 19, 2004 Status Update
    + Mar 19, 2004 Status Update - LLVM 1.2
    Feb 6, 2004 Status Update
    - Dec 17, 2003 Status Update
    - Nov 18, 2003 Status Update
    + Dec 17, 2003 Status Update - LLVM 1.1
    + Nov 18, 2003 Status Update - LLVM 1.0
    Oct 7, 2003 Status Update
    Sep 10, 2003 Status Update
    Aug 15, 2003 Status Update
    Jun 26, 2003 Status Update
    +
    Older News From sabre at nondot.org Fri Jun 1 11:22:24 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 1 Jun 2007 11:22:24 -0500 Subject: [llvm-commits] CVS: llvm-www/header.incl OldNews.html Message-ID: <200706011622.l51GMOCN008951@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.58 -> 1.59 OldNews.html updated: 1.6 -> 1.7 --- Log message: rotate news off sidebar --- Diffs of the changes: (+1 -10) OldNews.html | 1 + header.incl | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.58 llvm-www/header.incl:1.59 --- llvm-www/header.incl:1.58 Wed May 23 13:44:37 2007 +++ llvm-www/header.incl Fri Jun 1 11:22:00 2007 @@ -81,16 +81,6 @@ Oct 11, 2004
    Aug 13, 2004
    Jul 12, 2004
    - Jun 9, 2004
    - May 6, 2004
    - Mar 19, 2004
    - Feb 6, 2004
    - Dec 17, 2003
    - Nov 18, 2003
    - Oct 7, 2003
    - Sep 10, 2003
    - Aug 15, 2003
    - Jun 26, 2003
    Older News
    Index: llvm-www/OldNews.html diff -u llvm-www/OldNews.html:1.6 llvm-www/OldNews.html:1.7 --- llvm-www/OldNews.html:1.6 Fri Jun 1 11:20:41 2007 +++ llvm-www/OldNews.html Fri Jun 1 11:22:00 2007 @@ -17,6 +17,7 @@ Aug 15, 2003 Status Update
    Jun 26, 2003 Status Update
    +
    From sabre at nondot.org Fri Jun 1 11:24:20 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 1 Jun 2007 11:24:20 -0500 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200706011624.l51GOKdg009081@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.59 -> 1.60 --- Log message: add dev mtg to sidebar --- Diffs of the changes: (+9 -0) header.incl | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.59 llvm-www/header.incl:1.60 --- llvm-www/header.incl:1.59 Fri Jun 1 11:22:00 2007 +++ llvm-www/header.incl Fri Jun 1 11:23:59 2007 @@ -87,6 +87,15 @@
    +Developer Mtgs +
    + + May 25, 2007
    +
    +
    + +
    + Useful Links
    Mailing Lists:
    From resistor at mac.com Fri Jun 1 12:35:08 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 1 Jun 2007 12:35:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200706011735.l51HZ83c011234@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.8 -> 1.9 --- Log message: Fix Expression comparison, which in turn fixes a value numbering error. --- Diffs of the changes: (+11 -12) GVNPRE.cpp | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.8 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.9 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.8 Thu May 31 17:44:11 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Fri Jun 1 12:34:47 2007 @@ -60,19 +60,14 @@ return false; if (opcode == 0) { - if (value < other.value) - return true; - else - return false; + return value < other.value; } else { if (lhs < other.lhs) return true; else if (other.lhs < lhs) - return true; - else if (rhs < other.rhs) - return true; - else return false; + else + return rhs < other.rhs; } } @@ -214,7 +209,8 @@ GVNPRE::Expression GVNPRE::add(ValueTable& VN, std::set& MS, Instruction* V) { Expression e = buildExpression(VN, V); - if (VN.insert(std::make_pair(e, nextValueNumber)).second) + std::pair ret = VN.insert(std::make_pair(e, nextValueNumber)); + if (ret.second) nextValueNumber++; if (e.opcode != 0 || (e.opcode == 0 && isa(e.value))) MS.insert(e); @@ -391,9 +387,12 @@ DOUT << VN[*I] << ": "; DOUT << "( "; DOUT << (char)(I->opcode+48); - DOUT << ", " - << (I->value == 0 ? "0" : I->value->getName().c_str()) - << ", value." << I->lhs << ", value." << I->rhs << " ) "; + DOUT << ", "; + if (I->value == 0) + DOUT << "0"; + else + DEBUG(I->value->dump()); + DOUT << ", value." << I->lhs << ", value." << I->rhs << " ) "; } DOUT << "}\n\n"; } From clattner at apple.com Fri Jun 1 12:48:03 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 1 Jun 2007 10:48:03 -0700 Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of In-Reply-To: <200706011358.04003.baldrick@free.fr> References: <20070530053840.5113259B05AC@src> <200705311518.16204.baldrick@free.fr> <200706011358.04003.baldrick@free.fr> Message-ID: >> Does this actually cause a problem? This function is only called if >> the outer struct has constant size. TreeToLLVM::EmitAggregateCopy >> checks that TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST is true before >> calling into this code. > > Yes, it crashes the compiler. Remember that the function is > recursive. > The problem is that a type of fixed size can have a field of > variable size. > For example, a record field which is a variable sized array, where > the length > is given by another field L in the record. In this case the size > of the record > type may be a constant equal to the maximum size obtained over all > possible > values of L. > > In the case in question, a record R contains a field F, which is also > a record type. The fields present in F depend on the value of field E > (of an enumeration type) in R. Yes this is possible! The size of F > is thus an expression: it is calculated in terms of the value of E. > The size of R is a constant: the maximum possible size, the maximum > being taken over all values of E. Okay, do you have a testcase that demonstrates this? Also, the code for handling "large arrays" isn't needed. This code is only called for fixed size structures that are small. -Chris From baldrick at free.fr Fri Jun 1 14:56:23 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 21:56:23 +0200 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp In-Reply-To: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> References: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> Message-ID: <200706012156.24470.baldrick@free.fr> Hi Dale, > Arrange for only 1 of multiple branches to landing pad to be kept. it struck me that this patch seems to assume that if a successor is a landing pad then it is necessarily a landing pad for the current MBB. But couldn't it be the landing pad for some other MBB, and simply a normal successor for the current one? Ciao, Duncan. From baldrick at free.fr Fri Jun 1 15:03:12 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 22:03:12 +0200 Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of In-Reply-To: References: <20070530053840.5113259B05AC@src> <200706011358.04003.baldrick@free.fr> Message-ID: <200706012203.12998.baldrick@free.fr> Hi Chris, > Okay, do you have a testcase that demonstrates this? I will synthesize one for you. > Also, the code for handling "large arrays" isn't needed. This code > is only called for fixed size structures that are small. Hey, you are the one who used getInt64 to get the array length! :) Another point to consider is that this call could barf: unsigned EltSizeBits = TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(type))); This can happen if the array is a zero length array with an element type of variable size (meaning the array has length zero). I reckon the best thing to do is to bail out early if the type has zero size. I've attached a new patch. Ciao, Duncan. -------------- next part -------------- A non-text attachment was scrubbed... Name: union_fix.diff Type: text/x-diff Size: 1866 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070601/2ccd7d5d/attachment.bin From dalej at apple.com Fri Jun 1 15:10:01 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 13:10:01 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp In-Reply-To: <200706012156.24470.baldrick@free.fr> References: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> <200706012156.24470.baldrick@free.fr> Message-ID: <31747D10-B9D9-4EE8-942C-920F687C5634@apple.com> On Jun 1, 2007, at 12:56 PM, Duncan Sands wrote: > Hi Dale, > >> Arrange for only 1 of multiple branches to landing pad to be kept. That should be "successors", not "branches", but you've gotten past that.... > it struck me that this patch seems to assume that if a successor > is a landing pad then it is necessarily a landing pad for the > current MBB. I wasn't intending to assume that; how so? > But couldn't it be the landing pad for some other > MBB, and simply a normal successor for the current one? It could; there is no way to tell from the CFG information. From baldrick at free.fr Fri Jun 1 15:24:05 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 22:24:05 +0200 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp In-Reply-To: <31747D10-B9D9-4EE8-942C-920F687C5634@apple.com> References: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> <200706012156.24470.baldrick@free.fr> <31747D10-B9D9-4EE8-942C-920F687C5634@apple.com> Message-ID: <200706012224.06767.baldrick@free.fr> Hi Dale, > > it struck me that this patch seems to assume that if a successor > > is a landing pad then it is necessarily a landing pad for the > > current MBB. > > I wasn't intending to assume that; how so? > > > But couldn't it be the landing pad for some other > > MBB, and simply a normal successor for the current one? > > It could; there is no way to tell from the CFG information. consider the code: MachineBasicBlock::succ_iterator SI = MBB.succ_begin(); bool foundPad = false; while (SI != MBB.succ_end()) { if (*SI == DestA && DestA == DestB) { DestA = DestB = 0; if ((*SI)->isLandingPad()) foundPad = true; ++SI; } else if (*SI == DestA) { DestA = 0; if ((*SI)->isLandingPad()) foundPad = true; ++SI; } else if (*SI == DestB) { DestB = 0; if ((*SI)->isLandingPad()) foundPad = true; ++SI; } else if ((*SI)->isLandingPad() && !foundPad) { foundPad = true; ++SI; } else { // Otherwise, this is a superfluous edge, remove it. MBB.removeSuccessor(SI); MadeChange = true; } } Here is the worrying bit: } else if ((*SI)->isLandingPad() && !foundPad) { foundPad = true; ++SI; } else { Suppose a successor S1 has isLandingPad true because it is a landing pad for some other MBB, and some later successor (S2) has isLandingPad true because it is the landing pad for this MBB. What will happen? When we get to S1 foundPad is set to true and S1 is not deleted. Later we get to S2 and, because foundPad is true, fall through to } else { // Otherwise, this is a superfluous edge, remove it. MBB.removeSuccessor(SI); MadeChange = true; } and wrongly delete S2. Ciao, Duncan. From dalej at apple.com Fri Jun 1 15:28:00 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 13:28:00 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp In-Reply-To: <200706012224.06767.baldrick@free.fr> References: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> <200706012156.24470.baldrick@free.fr> <31747D10-B9D9-4EE8-942C-920F687C5634@apple.com> <200706012224.06767.baldrick@free.fr> Message-ID: <51D6272E-C2B6-4C85-8672-AB88361D55F5@apple.com> On Jun 1, 2007, at 1:24 PM, Duncan Sands wrote: > Suppose a successor S1 has isLandingPad true because it is > a landing pad for some other MBB, and some later successor (S2) > has isLandingPad true because it is the landing pad for this > MBB. What will happen? When we get to S1 foundPad is set to > true and S1 is not deleted. Later we get to S2 and, because > foundPad is true, fall through to > } else { > // Otherwise, this is a superfluous edge, remove it. > MBB.removeSuccessor(SI); > MadeChange = true; > } > and wrongly delete S2. Good catch, thanks. I'll fix that. From evan.cheng at apple.com Fri Jun 1 15:29:48 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Jun 2007 15:29:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IfConversion.cpp Message-ID: <200706012029.l51KTmqC016516@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IfConversion.cpp updated: 1.20 -> 1.21 --- Log message: Correctly mark early-exit on the false path. --- Diffs of the changes: (+9 -8) IfConversion.cpp | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) Index: llvm/lib/CodeGen/IfConversion.cpp diff -u llvm/lib/CodeGen/IfConversion.cpp:1.20 llvm/lib/CodeGen/IfConversion.cpp:1.21 --- llvm/lib/CodeGen/IfConversion.cpp:1.20 Fri Jun 1 02:41:07 2007 +++ llvm/lib/CodeGen/IfConversion.cpp Fri Jun 1 15:29:21 2007 @@ -33,6 +33,7 @@ ICReAnalyze, // BB must be re-analyzed. ICNotClassfied, // BB data valid, but not classified. ICEarlyExit, // BB is entry of an early-exit sub-CFG. + ICEarlyExitFalse,// Same as ICEarlyExit, but on the false path. ICTriangle, // BB is entry of a triangle sub-CFG. ICDiamond, // BB is entry of a diamond sub-CFG. ICChild, // BB is part of the sub-CFG that'll be predicated. @@ -151,6 +152,7 @@ // One or more of 'childrean' have been modified, abort! break; case ICEarlyExit: + case ICEarlyExitFalse: DOUT << "Ifcvt (Early exit): BB#" << BBI.BB->getNumber() << "\n"; Change |= IfConvertEarlyExit(BBI); break; @@ -239,7 +241,7 @@ TrueBBI.Kind = ICChild; } else if (!(TrueBBI.hasEarlyExit && TrueNumPreds <= 1) && (FalseBBI.hasEarlyExit && FalseNumPreds <=1)) { - BBI.Kind = ICEarlyExit; + BBI.Kind = ICEarlyExitFalse; FalseBBI.Kind = ICChild; } else if (TrueBBI.TrueBB && TrueBBI.TrueBB == BBI.FalseBB) { // Triangle: @@ -335,6 +337,7 @@ BBInfo &BBI = BBAnalysis[BB->getNumber()]; switch (BBI.Kind) { case ICEarlyExit: + case ICEarlyExitFalse: case ICTriangle: case ICDiamond: Candidates.push_back(&BBI); @@ -406,6 +409,8 @@ /// IfConvertEarlyExit - If convert a early exit sub-CFG. /// bool IfConverter::IfConvertEarlyExit(BBInfo &BBI) { + bool ReverseCond = BBI.Kind == ICEarlyExitFalse; + BBI.Kind = ICNotClassfied; BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; @@ -413,15 +418,11 @@ BBInfo *CvtBBI = &TrueBBI; BBInfo *NextBBI = &FalseBBI; - bool ReserveCond = false; - if (TrueBBI.Kind != ICChild) { - std::swap(CvtBBI, NextBBI); - ReserveCond = true; - } - std::vector NewCond(BBI.BrCond); - if (ReserveCond) + if (ReverseCond) { + std::swap(CvtBBI, NextBBI); TII->ReverseBranchCondition(NewCond); + } FeasibilityAnalysis(*CvtBBI, NewCond); if (!CvtBBI->isPredicable) return false; From baldrick at free.fr Fri Jun 1 15:32:08 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 1 Jun 2007 22:32:08 +0200 Subject: [llvm-commits] [127801] When an LLVM type has struct padding that overlaps with important fields of In-Reply-To: <200706012203.12998.baldrick@free.fr> References: <20070530053840.5113259B05AC@src> <200706012203.12998.baldrick@free.fr> Message-ID: <200706012232.25510.baldrick@free.fr> > > Okay, do you have a testcase that demonstrates this? > > I will synthesize one for you. Actually a testcase would be pointless, since the compiler crashes during the (Ada) compiler build. It wouldn't be pointless if I could make a C or C++ testcase, but I don't think it can be done except in Ada. Ciao, Duncan. From clattner at apple.com Fri Jun 1 15:42:56 2007 From: clattner at apple.com (clattner at apple.com) Date: Fri, 1 Jun 2007 13:42:56 -0700 (PDT) Subject: [llvm-commits] [127931] Fix union comparison code when handling hard ada cases :) Message-ID: <20070601204256.41BEE641E32D@src> Revision: 127931 Author: clattner Date: 2007-06-01 13:42:56 -0700 (Fri, 01 Jun 2007) Log Message: ----------- Fix union comparison code when handling hard ada cases :) Patch by Duncan Sands. Thanks for beating this into me Duncan. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-06-01 20:39:30 UTC (rev 127930) +++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-06-01 20:42:56 UTC (rev 127931) @@ -516,12 +516,20 @@ type = TYPE_MAIN_VARIANT(type); // If the type does not overlap, don't bother checking below. - if (TYPE_SIZE(type) == 0 || - PadStartBits >= int(TREE_INT_CST_LOW(TYPE_SIZE(type))) || + + if (!TYPE_SIZE(type)) + return false; + + if (!isInt64(TYPE_SIZE(type), false)) + // Variable sized or huge - be conservative. + return true; + + if (!getInt64(TYPE_SIZE(type), false) || + PadStartBits >= (int64_t)getInt64(TYPE_SIZE(type), false) || PadStartBits+PadSizeBits <= 0) return false; - + switch (TREE_CODE(type)) { default: fprintf(stderr, "Unknown type to compare:\n"); @@ -564,7 +572,7 @@ return GCCTypeOverlapsWithPadding(TREE_TYPE(Field), PadStartBits, PadSizeBits); } - + // See if any elements overlap. for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) { if (TREE_CODE(Field) != FIELD_DECL) continue; @@ -577,16 +585,16 @@ return false; } - - case RECORD_TYPE: + + case RECORD_TYPE: for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) { if (TREE_CODE(Field) != FIELD_DECL) continue; - + if (TREE_CODE(DECL_FIELD_OFFSET(Field)) != INTEGER_CST) return true; - + unsigned FieldBitOffset = getFieldOffsetInBits(Field); - if (GCCTypeOverlapsWithPadding(TREE_TYPE(Field), + if (GCCTypeOverlapsWithPadding(TREE_TYPE(Field), PadStartBits-FieldBitOffset, PadSizeBits)) return true; } From evan.cheng at apple.com Fri Jun 1 15:51:51 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 1 Jun 2007 15:51:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200706012051.l51KppAp017201@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.108 -> 1.109 --- Log message: Opcode modifier s comes after condition code. e.g. addlts, not addslt. --- Diffs of the changes: (+20 -20) ARMInstrInfo.td | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.108 llvm/lib/Target/ARM/ARMInstrInfo.td:1.109 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.108 Thu May 31 19:56:15 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Fri Jun 1 15:51:29 2007 @@ -407,15 +407,15 @@ /// AI1_bin_irs - Defines a set of (op r, {so_imm|r|so_reg}) patterns for a /// binop that produces a value. -multiclass AI1_bin_irs { +multiclass AI1_bin_irs { def ri : AI1<(ops GPR:$dst, GPR:$a, so_imm:$b), - opc, " $dst, $a, $b", + opc, !strconcat(mod, " $dst, $a, $b"), [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>; def rr : AI1<(ops GPR:$dst, GPR:$a, GPR:$b), - opc, " $dst, $a, $b", + opc, !strconcat(mod, " $dst, $a, $b"), [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>; def rs : AI1<(ops GPR:$dst, GPR:$a, so_reg:$b), - opc, " $dst, $a, $b", + opc, !strconcat(mod, " $dst, $a, $b"), [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>; } @@ -434,12 +434,12 @@ } /// AI1_bin_is - Defines a set of (op r, {so_imm|so_reg}) patterns for a binop. -multiclass AI1_bin_is { +multiclass AI1_bin_is { def ri : AI1<(ops GPR:$dst, GPR:$a, so_imm:$b), - opc, " $dst, $a, $b", + opc, !strconcat(mod, " $dst, $a, $b"), [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>; def rs : AI1<(ops GPR:$dst, GPR:$a, so_reg:$b), - opc, " $dst, $a, $b", + opc, !strconcat(mod, " $dst, $a, $b"), [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>; } @@ -859,17 +859,17 @@ // Arithmetic Instructions. // -defm ADD : AI1_bin_irs<"add" , BinOpFrag<(add node:$LHS, node:$RHS)>>; -defm ADDS : AI1_bin_irs<"adds", BinOpFrag<(addc node:$LHS, node:$RHS)>>; -defm ADC : AI1_bin_irs<"adc" , BinOpFrag<(adde node:$LHS, node:$RHS)>>; -defm SUB : AI1_bin_irs<"sub" , BinOpFrag<(sub node:$LHS, node:$RHS)>>; -defm SUBS : AI1_bin_irs<"subs", BinOpFrag<(subc node:$LHS, node:$RHS)>>; -defm SBC : AI1_bin_irs<"sbc" , BinOpFrag<(sube node:$LHS, node:$RHS)>>; +defm ADD : AI1_bin_irs<"add", "" , BinOpFrag<(add node:$LHS, node:$RHS)>>; +defm ADDS : AI1_bin_irs<"add", "s", BinOpFrag<(addc node:$LHS, node:$RHS)>>; +defm ADC : AI1_bin_irs<"adc", "" , BinOpFrag<(adde node:$LHS, node:$RHS)>>; +defm SUB : AI1_bin_irs<"sub", "" , BinOpFrag<(sub node:$LHS, node:$RHS)>>; +defm SUBS : AI1_bin_irs<"sub", "s", BinOpFrag<(subc node:$LHS, node:$RHS)>>; +defm SBC : AI1_bin_irs<"sbc", "" , BinOpFrag<(sube node:$LHS, node:$RHS)>>; // These don't define reg/reg forms, because they are handled above. -defm RSB : AI1_bin_is <"rsb" , BinOpFrag<(sub node:$RHS, node:$LHS)>>; -defm RSBS : AI1_bin_is <"rsbs", BinOpFrag<(subc node:$RHS, node:$LHS)>>; -defm RSC : AI1_bin_is <"rsc" , BinOpFrag<(sube node:$RHS, node:$LHS)>>; +defm RSB : AI1_bin_is <"rsb", "" , BinOpFrag<(sub node:$RHS, node:$LHS)>>; +defm RSBS : AI1_bin_is <"rsb", "s", BinOpFrag<(subc node:$RHS, node:$LHS)>>; +defm RSC : AI1_bin_is <"rsc", "" , BinOpFrag<(sube node:$RHS, node:$LHS)>>; // (sub X, imm) gets canonicalized to (add X, -imm). Match this form. def : ARMPat<(add GPR:$src, so_imm_neg:$imm), @@ -891,10 +891,10 @@ // Bitwise Instructions. // -defm AND : AI1_bin_irs<"and", BinOpFrag<(and node:$LHS, node:$RHS)>>; -defm ORR : AI1_bin_irs<"orr", BinOpFrag<(or node:$LHS, node:$RHS)>>; -defm EOR : AI1_bin_irs<"eor", BinOpFrag<(xor node:$LHS, node:$RHS)>>; -defm BIC : AI1_bin_irs<"bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>; +defm AND : AI1_bin_irs<"and", "", BinOpFrag<(and node:$LHS, node:$RHS)>>; +defm ORR : AI1_bin_irs<"orr", "", BinOpFrag<(or node:$LHS, node:$RHS)>>; +defm EOR : AI1_bin_irs<"eor", "", BinOpFrag<(xor node:$LHS, node:$RHS)>>; +defm BIC : AI1_bin_irs<"bic", "", BinOpFrag<(and node:$LHS, (not node:$RHS))>>; def MVNr : AI<(ops GPR:$dst, GPR:$src), "mvn", " $dst, $src", [(set GPR:$dst, (not GPR:$src))]>; From resistor at mac.com Fri Jun 1 17:00:56 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 1 Jun 2007 17:00:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200706012200.l51M0uhd018718@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.9 -> 1.10 --- Log message: clean() needs to process things in topological order. --- Diffs of the changes: (+21 -28) GVNPRE.cpp | 49 +++++++++++++++++++++---------------------------- 1 files changed, 21 insertions(+), 28 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.9 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.10 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.9 Fri Jun 1 12:34:47 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Fri Jun 1 17:00:37 2007 @@ -299,37 +299,30 @@ // Remove all expressions whose operands are not themselves in the set void GVNPRE::clean(GVNPRE::ValueTable VN, std::set& set) { - unsigned size = set.size(); - unsigned old = 0; + std::vector worklist; + topo_sort(VN, set, worklist); - while (size != old) { - old = size; - - std::vector worklist(set.begin(), set.end()); - while (!worklist.empty()) { - Expression e = worklist.back(); - worklist.pop_back(); - - if (e.opcode == 0) // OPAQUE - continue; - - bool lhsValid = false; - for (std::set::iterator I = set.begin(), E = set.end(); - I != E; ++I) - if (VN[*I] == e.lhs); - lhsValid = true; + while (!worklist.empty()) { + Expression e = worklist.back(); + worklist.pop_back(); + + if (e.opcode == 0) // OPAQUE + continue; + + bool lhsValid = false; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) + if (VN[*I] == e.lhs); + lhsValid = true; - bool rhsValid = false; - for (std::set::iterator I = set.begin(), E = set.end(); - I != E; ++I) - if (VN[*I] == e.rhs); - rhsValid = true; + bool rhsValid = false; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) + if (VN[*I] == e.rhs); + rhsValid = true; - if (!lhsValid || !rhsValid) - set.erase(e); - } - - size = set.size(); + if (!lhsValid || !rhsValid) + set.erase(e); } } From dpatel at apple.com Fri Jun 1 17:15:53 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 1 Jun 2007 17:15:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp Message-ID: <200706012215.l51MFrPG019168@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LICM.cpp updated: 1.101 -> 1.102 --- Log message: Insert new instructions in AliasSet. --- Diffs of the changes: (+5 -1) LICM.cpp | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.101 llvm/lib/Transforms/Scalar/LICM.cpp:1.102 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.101 Wed May 30 10:29:37 2007 +++ llvm/lib/Transforms/Scalar/LICM.cpp Fri Jun 1 17:15:31 2007 @@ -476,9 +476,11 @@ // Firstly, we create a stack object to hold the value... AllocaInst *AI = 0; - if (I.getType() != Type::VoidTy) + if (I.getType() != Type::VoidTy) { AI = new AllocaInst(I.getType(), 0, I.getName(), I.getParent()->getParent()->getEntryBlock().begin()); + CurAST->add(AI); + } // Secondly, insert load instructions for each use of the instruction // outside of the loop. @@ -499,6 +501,7 @@ // Insert a new load instruction right before the terminator in // the predecessor block. PredVal = new LoadInst(AI, "", Pred->getTerminator()); + CurAST->add(cast(PredVal)); } UPN->setIncomingValue(i, PredVal); @@ -507,6 +510,7 @@ } else { LoadInst *L = new LoadInst(AI, "", U); U->replaceUsesOfWith(&I, L); + CurAST->add(L); } } From reid at x10sys.com Fri Jun 1 17:23:51 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 1 Jun 2007 17:23:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Interpreter.cpp Message-ID: <200706012223.l51MNpf3019497@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.184 -> 1.185 Interpreter.cpp updated: 1.39 -> 1.40 --- Log message: For PR1486: http://llvm.org/PR1486 : Avoid overwriting the APInt instance with 0 bytes which causes the bitwidth to be set to 0 (illegal) producing a subsequent assert. --- Diffs of the changes: (+2 -2) Execution.cpp | 2 +- Interpreter.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.184 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.185 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.184 Thu May 17 01:47:54 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Fri Jun 1 17:23:29 2007 @@ -610,7 +610,7 @@ if (RetTy && RetTy->isInteger()) { // Nonvoid return type? ExitValue = Result; // Capture the exit value of the program } else { - memset(&ExitValue, 0, sizeof(ExitValue)); + memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped)); } } else { // If we have a previous stack frame, and we have a previous call, Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.39 llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.40 --- llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.39 Mon Mar 5 21:05:57 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp Fri Jun 1 17:23:29 2007 @@ -54,7 +54,7 @@ // Interpreter::Interpreter(Module *M) : ExecutionEngine(M), TD(M) { - memset(&ExitValue, 0, sizeof(ExitValue)); + memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped)); setTargetData(&TD); // Initialize the "backend" initializeExecutionEngine(); From dalej at apple.com Fri Jun 1 18:03:07 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 18:03:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200706012303.l51N37eD020294@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.61 -> 1.62 --- Log message: Implement smarter algorithm for choosing which blocks to tail-merge. See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well; shaves another 10K off our favorite benchmark. I was hesitant about this because of compile speed, but seems to do OK on a bootstrap. --- Diffs of the changes: (+45 -30) BranchFolding.cpp | 75 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 45 insertions(+), 30 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.61 llvm/lib/CodeGen/BranchFolding.cpp:1.62 --- llvm/lib/CodeGen/BranchFolding.cpp:1.61 Thu May 31 16:54:00 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Fri Jun 1 18:02:45 2007 @@ -466,43 +466,58 @@ continue; } - // Look through all the blocks that have the same hash as this one, and - // find the one that has the largest number of instructions in common. - // Since instructions may get combined later (e.g. single stores into + // Look through all the pairs of blocks that have the same hash as this + // one, and find the pair that has the largest number of instructions in + // common. + // Since instructions may get combined later (e.g. single stores into // store multiple) this measure is not particularly accurate. - MachineBasicBlock::iterator BBI1, BBI2; + MachineBasicBlock::iterator BBI1, BBI2; - unsigned FoundMatch = ~0U; + unsigned FoundI = ~0U, FoundJ = ~0U; unsigned maxCommonTailLength = 0U; - for (int i = MergePotentials.size()-2; + for (int i = MergePotentials.size()-1; i != -1 && MergePotentials[i].first == CurHash; --i) { - MachineBasicBlock::iterator TrialBBI1, TrialBBI2; - unsigned CommonTailLen = ComputeCommonTailLength(CurMBB, - MergePotentials[i].second, - TrialBBI1, TrialBBI2); - if (CommonTailLen >= minCommonTailLength && - CommonTailLen >= maxCommonTailLength) { - FoundMatch = i; - maxCommonTailLength = CommonTailLen; - BBI1 = TrialBBI1; - BBI2 = TrialBBI2; - } - } - - // If we didn't find anything that has at least minCommonTailLength - // instructions matching this one, bail out. - if (FoundMatch == ~0U) { - // Put the unconditional branch back, if we need one. - if (SuccBB && CurMBB != PredBB) - FixTail(CurMBB, SuccBB, TII); - MergePotentials.pop_back(); + for (int j = i-1; + j != -1 && MergePotentials[j].first == CurHash; --j) { + MachineBasicBlock::iterator TrialBBI1, TrialBBI2; + unsigned CommonTailLen = ComputeCommonTailLength( + MergePotentials[i].second, + MergePotentials[j].second, + TrialBBI1, TrialBBI2); + if (CommonTailLen >= minCommonTailLength && + CommonTailLen > maxCommonTailLength) { + FoundI = i; + FoundJ = j; + maxCommonTailLength = CommonTailLen; + BBI1 = TrialBBI1; + BBI2 = TrialBBI2; + } + } + } + + // If we didn't find any pair that has at least minCommonTailLength + // instructions in common, bail out. All entries with this + // hash code can go away now. + if (FoundI == ~0U) { + for (int i = MergePotentials.size()-1; + i != -1 && MergePotentials[i].first == CurHash; --i) { + // Put the unconditional branch back, if we need one. + CurMBB = MergePotentials[i].second; + if (SuccBB && CurMBB != PredBB) + FixTail(CurMBB, SuccBB, TII); + MergePotentials.pop_back(); + } continue; } - - // Otherwise, move the matching block to the right position. - if (FoundMatch != MergePotentials.size()-2) - std::swap(MergePotentials[FoundMatch], *(MergePotentials.end()-2)); + // Otherwise, move the block(s) to the right position(s). So that + // BBI1/2 will be valid, the last must be I and the next-to-last J. + if (FoundI != MergePotentials.size()-1) + std::swap(MergePotentials[FoundI], *(MergePotentials.end()-1)); + if (FoundJ != MergePotentials.size()-2) + std::swap(MergePotentials[FoundJ], *(MergePotentials.end()-2)); + + CurMBB = (MergePotentials.end()-1)->second; MachineBasicBlock *MBB2 = (MergePotentials.end()-2)->second; // If neither block is the entire common tail, split the tail of one block From dalej at apple.com Fri Jun 1 18:03:07 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 18:03:07 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/X86/test-pic-jtbl.ll Message-ID: <200706012303.l51N37o3020299@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/X86: test-pic-jtbl.ll updated: 1.4 -> 1.5 --- Log message: Implement smarter algorithm for choosing which blocks to tail-merge. See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well; shaves another 10K off our favorite benchmark. I was hesitant about this because of compile speed, but seems to do OK on a bootstrap. --- Diffs of the changes: (+2 -3) test-pic-jtbl.ll | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/test/CodeGen/X86/test-pic-jtbl.ll diff -u llvm/test/CodeGen/X86/test-pic-jtbl.ll:1.4 llvm/test/CodeGen/X86/test-pic-jtbl.ll:1.5 --- llvm/test/CodeGen/X86/test-pic-jtbl.ll:1.4 Wed May 23 16:09:26 2007 +++ llvm/test/CodeGen/X86/test-pic-jtbl.ll Fri Jun 1 18:02:45 2007 @@ -2,10 +2,9 @@ ; RUN: -o %t -f ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | wc -l | grep 3 -; RUN: grep PLT %t | wc -l | grep 11 +; RUN: grep PLT %t | wc -l | grep 6 ; RUN: grep GOTOFF %t | wc -l | grep 1 -; RUN: grep JTI %t | wc -l | grep 13 -; Improved tail merging could reduce the number of PLT's and JTI's further. +; RUN: grep JTI %t | wc -l | grep 8 define void @bar(i32 %n.u) { entry: From dalej at apple.com Fri Jun 1 18:04:51 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 18:04:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/README.txt Message-ID: <200706012304.l51N4piw020355@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: README.txt updated: 1.6 -> 1.7 --- Log message: Fancier algorithm in tail-merge comment implemented, so remove comment. --- Diffs of the changes: (+0 -18) README.txt | 18 ------------------ 1 files changed, 18 deletions(-) Index: llvm/lib/CodeGen/README.txt diff -u llvm/lib/CodeGen/README.txt:1.6 llvm/lib/CodeGen/README.txt:1.7 --- llvm/lib/CodeGen/README.txt:1.6 Fri May 18 13:46:40 2007 +++ llvm/lib/CodeGen/README.txt Fri Jun 1 18:04:28 2007 @@ -143,21 +143,3 @@ ... load [T + 15] //===---------------------------------------------------------------------===// -Tail merging issue: -When we're trying to merge the tails of predecessors of a block I, and there -are more than 2 predecessors, we don't do it optimally. Suppose predecessors -are A,B,C where B and C have 5 instructions in common, and A has 2 in common -with B or C. We want to get: -A: - jmp C3 -B: - jmp C2 -C: -C2: 3 common to B and C but not A -C3: 2 common to all 3 -You get this if B and C are merged first, but currently it might randomly decide -to merge A and B first, which results in not sharing the C2 instructions. We -could look at all N*(N-1) combinations of predecessors and merge the ones with -the most instructions in common first. Usually that will be fast, but it -could get slow on big graphs (e.g. large switches tend to have blocks with many -predecessors). From dalej at apple.com Fri Jun 1 19:08:37 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 19:08:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200706020008.l5208blY021657@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.62 -> 1.63 --- Log message: Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets. --- Diffs of the changes: (+6 -9) BranchFolding.cpp | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.62 llvm/lib/CodeGen/BranchFolding.cpp:1.63 --- llvm/lib/CodeGen/BranchFolding.cpp:1.62 Fri Jun 1 18:02:45 2007 +++ llvm/lib/CodeGen/BranchFolding.cpp Fri Jun 1 19:08:15 2007 @@ -675,6 +675,9 @@ /// CFG to be inserted. If we have proven that MBB can only branch to DestA and /// DestB, remove any other MBB successors from the CFG. DestA and DestB can /// be null. +/// Besides DestA and DestB, retain other edges leading to LandingPads (currently +/// there can be only one; we don't check or require that here). +/// Note it is possible that DestA and/or DestB are LandingPads. static bool CorrectExtraCFGEdges(MachineBasicBlock &MBB, MachineBasicBlock *DestA, MachineBasicBlock *DestB, @@ -700,25 +703,19 @@ } MachineBasicBlock::succ_iterator SI = MBB.succ_begin(); - bool foundPad = false; + MachineBasicBlock *OrigDestA = DestA, *OrigDestB = DestB; while (SI != MBB.succ_end()) { if (*SI == DestA && DestA == DestB) { DestA = DestB = 0; - if ((*SI)->isLandingPad()) - foundPad = true; ++SI; } else if (*SI == DestA) { DestA = 0; - if ((*SI)->isLandingPad()) - foundPad = true; ++SI; } else if (*SI == DestB) { DestB = 0; - if ((*SI)->isLandingPad()) - foundPad = true; ++SI; - } else if ((*SI)->isLandingPad() && !foundPad) { - foundPad = true; + } else if ((*SI)->isLandingPad() && + *SI!=OrigDestA && *SI!=OrigDestB) { ++SI; } else { // Otherwise, this is a superfluous edge, remove it. From dalej at apple.com Fri Jun 1 19:12:03 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 1 Jun 2007 17:12:03 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp In-Reply-To: <51D6272E-C2B6-4C85-8672-AB88361D55F5@apple.com> References: <200705312154.l4VLsKV9003890@zion.cs.uiuc.edu> <200706012156.24470.baldrick@free.fr> <31747D10-B9D9-4EE8-942C-920F687C5634@apple.com> <200706012224.06767.baldrick@free.fr> <51D6272E-C2B6-4C85-8672-AB88361D55F5@apple.com> Message-ID: <42ACEA38-9875-4D3E-8609-361B6FFD6708@apple.com> On Jun 1, 2007, at 1:28 PM, Dale Johannesen wrote: > > On Jun 1, 2007, at 1:24 PM, Duncan Sands wrote: >> Suppose a successor S1 has isLandingPad true because it is >> a landing pad for some other MBB, and some later successor (S2) >> has isLandingPad true because it is the landing pad for this >> MBB. What will happen? When we get to S1 foundPad is set to >> true and S1 is not deleted. Later we get to S2 and, because >> foundPad is true, fall through to >> } else { >> // Otherwise, this is a superfluous edge, remove it. >> MBB.removeSuccessor(SI); >> MadeChange = true; >> } >> and wrongly delete S2. > > Good catch, thanks. I'll fix that. Should be fixed now. From reid at x10sys.com Fri Jun 1 20:48:58 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 1 Jun 2007 20:48:58 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output Message-ID: <200706020148.l521mwcr023544@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/Integer: reduce_xor.reference_output updated: 1.1 -> 1.2 --- Log message: Add the exit code to the reference output. --- Diffs of the changes: (+1 -0) reduce_xor.reference_output | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output diff -u llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output:1.1 llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output:1.2 --- llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output:1.1 Thu May 31 05:25:04 2007 +++ llvm-test/SingleSource/UnitTests/Integer/reduce_xor.reference_output Fri Jun 1 20:48:36 2007 @@ -78,3 +78,4 @@ reduce_xor68(x) = 1 reduce_xor250(x) = 1 Xor reductions of x = 2 +exit 0 From reid at x10sys.com Fri Jun 1 20:52:14 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 1 Jun 2007 20:52:14 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bits.h Message-ID: <200706020152.l521qEIn023619@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/Integer: bits.h updated: 1.11 -> 1.12 --- Log message: Add int8 --- Diffs of the changes: (+1 -0) bits.h | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/SingleSource/UnitTests/Integer/bits.h diff -u llvm-test/SingleSource/UnitTests/Integer/bits.h:1.11 llvm-test/SingleSource/UnitTests/Integer/bits.h:1.12 --- llvm-test/SingleSource/UnitTests/Integer/bits.h:1.11 Fri May 18 19:39:45 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bits.h Fri Jun 1 20:51:51 2007 @@ -51,6 +51,7 @@ typedef unsigned int __attribute__((bitwidth(1024))) uint1024; typedef int __attribute__((bitwidth(3))) int3; +typedef int __attribute__((bitwidth(8))) int8; typedef int __attribute__((bitwidth(9))) int9; typedef int __attribute__((bitwidth(10))) int10; typedef int __attribute__((bitwidth(21))) int21; From zhousheng00 at gmail.com Fri Jun 1 23:10:55 2007 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Fri, 1 Jun 2007 23:10:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200706020410.l524AtX0026064@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.85 -> 1.86 --- Log message: Make LowerCTPOP() support arbitrary bitwidth integer type. --- Diffs of the changes: (+22 -9) IntrinsicLowering.cpp | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.85 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.86 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.85 Fri May 25 22:43:13 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Fri Jun 1 23:10:33 2007 @@ -208,17 +208,30 @@ }; unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); + unsigned WordSize = (BitSize + 63) / 64; + Value *Count = ConstantInt::get(V->getType(), 0); - for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { - Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]); - Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); - Value *VShift = BinaryOperator::createLShr(V, - ConstantInt::get(V->getType(), i), "ctpop.sh", IP); - Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP); - V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP); + for (unsigned n = 0; n < WordSize; ++n) { + Value *PartValue = V; + for (unsigned i = 1, ct = 0; i < (BitSize>64 ? 64 : BitSize); + i <<= 1, ++ct) { + Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]); + Value *LHS = BinaryOperator::createAnd( + PartValue, MaskCst, "cppop.and1", IP); + Value *VShift = BinaryOperator::createLShr(PartValue, + ConstantInt::get(V->getType(), i), "ctpop.sh", IP); + Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP); + PartValue = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP); + } + Count = BinaryOperator::createAdd(PartValue, Count, "ctpop.part", IP); + if (BitSize > 64) { + V = BinaryOperator::createLShr(V, ConstantInt::get(V->getType(), 64), + "ctpop.part.sh", IP); + BitSize -= 64; + } } - return CastInst::createIntegerCast(V, Type::Int32Ty, false, "ctpop", IP); + return CastInst::createIntegerCast(Count, Type::Int32Ty, false, "ctpop", IP); } /// LowerCTLZ - Emit the code to lower ctlz of V before the specified @@ -226,7 +239,7 @@ static Value *LowerCTLZ(Value *V, Instruction *IP) { unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); - for (unsigned i = 1; i != BitSize; i <<= 1) { + for (unsigned i = 1; i < BitSize; i <<= 1) { Value *ShVal = ConstantInt::get(V->getType(), i); ShVal = BinaryOperator::createLShr(V, ShVal, "ctlz.sh", IP); V = BinaryOperator::createOr(V, ShVal, "ctlz.step", IP); From baldrick at free.fr Sat Jun 2 11:54:13 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 2 Jun 2007 11:54:13 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineModuleInfo.h Message-ID: <200706021654.l52GsDaZ022182@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineModuleInfo.h updated: 1.15 -> 1.16 --- Log message: Integrate exception filter support and exception catch support. This simplifies the code in DwarfWriter, allows for multiple filters and makes it trivial to specify filters accompanied by cleanups or catch-all specifications (see next patch). What a deal! Patch blessed by Anton. --- Diffs of the changes: (+24 -12) MachineModuleInfo.h | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-) Index: llvm/include/llvm/CodeGen/MachineModuleInfo.h diff -u llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.15 llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.16 --- llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.15 Wed May 23 06:08:30 2007 +++ llvm/include/llvm/CodeGen/MachineModuleInfo.h Sat Jun 2 11:53:42 2007 @@ -960,16 +960,13 @@ SmallVector EndLabels; // Labels after invoke. unsigned LandingPadLabel; // Label at beginning of landing pad. Function *Personality; // Personality function. - std::vector TypeIds; // List of type ids. - bool IsFilter; // Indicate if the landing pad is a - // throw filter. - + std::vector TypeIds; // List of type ids (filters negative) + LandingPadInfo(MachineBasicBlock *MBB) : LandingPadBlock(MBB) , LandingPadLabel(0) , Personality(NULL) , TypeIds() - , IsFilter(false) {} }; @@ -1021,6 +1018,10 @@ // std::vector TypeInfos; + // FilterIds - List of typeids encoding filters used in the current function. + // + std::vector FilterIds; + // Personalities - Vector of all personality functions ever seen. Used to emit // common EH frames. std::vector Personalities; @@ -1213,20 +1214,25 @@ const std::vector& getPersonalities() const { return Personalities; } - + /// addCatchTypeInfo - Provide the catch typeinfo for a landing pad. /// void addCatchTypeInfo(MachineBasicBlock *LandingPad, std::vector &TyInfo); - - /// setIsFilterLandingPad - Indicates that the landing pad is a throw filter. + + /// addFilterTypeInfo - Provide the filter typeinfo for a landing pad. /// - void setIsFilterLandingPad(MachineBasicBlock *LandingPad); - + void addFilterTypeInfo(MachineBasicBlock *LandingPad, + std::vector &TyInfo); + /// getTypeIDFor - Return the type id for the specified typeinfo. This is /// function wide. unsigned getTypeIDFor(GlobalVariable *TI); - + + /// getFilterIDFor - Return the id of the filter encoded by TyIds. This is + /// function wide. + int getFilterIDFor(std::vector &TyIds); + /// TidyLandingPads - Remap landing pad labels and remove any deleted landing /// pads. void TidyLandingPads(); @@ -1242,7 +1248,13 @@ const std::vector &getTypeInfos() const { return TypeInfos; } - + + /// getFilterIds - Return a reference to the typeids encoding filters used in + /// the current function. + const std::vector &getFilterIds() const { + return FilterIds; + } + /// getPersonality - Return a personality function if available. The presence /// of one is required to emit exception handling info. Function *getPersonality() const; From baldrick at free.fr Sat Jun 2 11:54:13 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 2 Jun 2007 11:54:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineModuleInfo.cpp Message-ID: <200706021654.l52GsDC3022186@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.149 -> 1.150 MachineModuleInfo.cpp updated: 1.15 -> 1.16 --- Log message: Integrate exception filter support and exception catch support. This simplifies the code in DwarfWriter, allows for multiple filters and makes it trivial to specify filters accompanied by cleanups or catch-all specifications (see next patch). What a deal! Patch blessed by Anton. --- Diffs of the changes: (+44 -57) DwarfWriter.cpp | 74 ++++++++++++++------------------------------------ MachineModuleInfo.cpp | 27 +++++++++++++++--- 2 files changed, 44 insertions(+), 57 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.149 llvm/lib/CodeGen/DwarfWriter.cpp:1.150 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.149 Wed May 23 06:08:30 2007 +++ llvm/lib/CodeGen/DwarfWriter.cpp Sat Jun 2 11:53:42 2007 @@ -2896,13 +2896,10 @@ /// EquivPads - Whether two landing pads have equivalent actions. static bool EquivPads(const LandingPadInfo *L, const LandingPadInfo *R) { - const std::vector &LIds = L->TypeIds; - const std::vector &RIds = R->TypeIds; + const std::vector &LIds = L->TypeIds; + const std::vector &RIds = R->TypeIds; unsigned LSize = LIds.size(), RSize = RIds.size(); - if (L->IsFilter != R->IsFilter) - return false; - if (LSize != RSize) return false; @@ -2915,14 +2912,10 @@ /// PadLT - An order on landing pads, with EquivPads as order equivalence. static bool PadLT(const LandingPadInfo *L, const LandingPadInfo *R) { - const std::vector &LIds = L->TypeIds; - const std::vector &RIds = R->TypeIds; + const std::vector &LIds = L->TypeIds; + const std::vector &RIds = R->TypeIds; unsigned LSize = LIds.size(), RSize = RIds.size(); - if (L->IsFilter != R->IsFilter) - // Make filters come last - return L->IsFilter < R->IsFilter; - if (LSize != RSize) return LSize < RSize; @@ -2972,6 +2965,7 @@ MMI->TidyLandingPads(); const std::vector &TypeInfos = MMI->getTypeInfos(); + const std::vector &FilterIds = MMI->getFilterIds(); const std::vector &PadInfos = MMI->getLandingPads(); if (PadInfos.empty()) return; @@ -2985,11 +2979,6 @@ // Gather first action index for each landing pad site. SmallVector Actions; - // FIXME - Assume there is only one filter typeinfo list per function - // time being. I.E., Each call to eh_filter will have the same list. - // This can change if a function is inlined. - const LandingPadInfo *Filter = 0; - // Compute sizes for exception table. unsigned SizeSites = 0; unsigned SizeActions = 0; @@ -3003,24 +2992,15 @@ unsigned SizeSiteActions = 0; if (!i || !EquivPads(LandingPad, LandingPads[i-1])) { - const std::vector &TypeIds = LandingPad->TypeIds; + const std::vector &TypeIds = LandingPad->TypeIds; unsigned SizeAction = 0; - if (LandingPad->IsFilter) { - // FIXME - Assume there is only one filter typeinfo list per function - // time being. I.E., Each call to eh_filter will have the same list. - // This can change if a function is inlined. - Filter = LandingPad; - SizeAction = Asm->SizeSLEB128(-1) + Asm->SizeSLEB128(0); - SizeSiteActions += SizeAction; - // Record the first action of the landing pad site. - FirstAction = SizeActions + SizeSiteActions - SizeAction + 1; - } else if (TypeIds.empty()) { + if (TypeIds.empty()) { FirstAction = 0; } else { // Gather the action sizes for (unsigned j = 0, M = TypeIds.size(); j != M; ++j) { - unsigned TypeID = TypeIds[j]; + int TypeID = TypeIds[j]; unsigned SizeTypeID = Asm->SizeSLEB128(TypeID); signed Action = j ? -(SizeAction + SizeTypeID) : 0; SizeAction = SizeTypeID + Asm->SizeSLEB128(Action); @@ -3140,25 +3120,18 @@ for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { if (!i || Actions[i] != Actions[i-1]) { const LandingPadInfo *LandingPad = LandingPads[i]; - const std::vector &TypeIds = LandingPad->TypeIds; + const std::vector &TypeIds = LandingPad->TypeIds; unsigned SizeAction = 0; - if (LandingPad->IsFilter) { - Asm->EmitSLEB128Bytes(-1); + for (unsigned j = 0, M = TypeIds.size(); j < M; ++j) { + int TypeID = TypeIds[j]; + unsigned SizeTypeID = Asm->SizeSLEB128(TypeID); + Asm->EmitSLEB128Bytes(TypeID); Asm->EOL("TypeInfo index"); - Asm->EmitSLEB128Bytes(0); + signed Action = j ? -(SizeAction + SizeTypeID) : 0; + SizeAction = SizeTypeID + Asm->SizeSLEB128(Action); + Asm->EmitSLEB128Bytes(Action); Asm->EOL("Next action"); - } else { - for (unsigned j = 0, M = TypeIds.size(); j < M; ++j) { - unsigned TypeID = TypeIds[j]; - unsigned SizeTypeID = Asm->SizeSLEB128(TypeID); - Asm->EmitSLEB128Bytes(TypeID); - Asm->EOL("TypeInfo index"); - signed Action = j ? -(SizeAction + SizeTypeID) : 0; - SizeAction = SizeTypeID + Asm->SizeSLEB128(Action); - Asm->EmitSLEB128Bytes(Action); - Asm->EOL("Next action"); - } } } } @@ -3180,16 +3153,11 @@ Asm->EOL("TypeInfo"); } - // Emit the filter typeinfo. - if (Filter) { - const std::vector &TypeIds = Filter->TypeIds; - for (unsigned j = 0, M = TypeIds.size(); j < M; ++j) { - unsigned TypeID = TypeIds[j]; - Asm->EmitSLEB128Bytes(TypeID); - Asm->EOL("TypeInfo index"); - } - Asm->EmitSLEB128Bytes(0); - Asm->EOL("End of filter typeinfo"); + // Emit the filter typeids. + for (unsigned j = 0, M = FilterIds.size(); j < M; ++j) { + unsigned TypeID = FilterIds[j]; + Asm->EmitSLEB128Bytes(TypeID); + Asm->EOL("Filter TypeInfo index"); } Asm->EmitAlignment(2); Index: llvm/lib/CodeGen/MachineModuleInfo.cpp diff -u llvm/lib/CodeGen/MachineModuleInfo.cpp:1.15 llvm/lib/CodeGen/MachineModuleInfo.cpp:1.16 --- llvm/lib/CodeGen/MachineModuleInfo.cpp:1.15 Wed May 23 06:08:31 2007 +++ llvm/lib/CodeGen/MachineModuleInfo.cpp Sat Jun 2 11:53:42 2007 @@ -1521,6 +1521,7 @@ // Clean up exception info. LandingPads.clear(); TypeInfos.clear(); + FilterIds.clear(); } /// getDescFor - Convert a Value to a debug information descriptor. @@ -1708,12 +1709,16 @@ for (unsigned N = TyInfo.size(); N; --N) LP.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1])); } - -/// setIsFilterLandingPad - Indicates that the landing pad is a throw filter. + +/// addFilterTypeInfo - Provide the filter typeinfo for a landing pad. /// -void MachineModuleInfo::setIsFilterLandingPad(MachineBasicBlock *LandingPad) { +void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad, + std::vector &TyInfo) { LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); - LP.IsFilter = true; + std::vector IdsInFilter (TyInfo.size()); + for (unsigned I = 0, E = TyInfo.size(); I != E; ++I) + IdsInFilter[I] = getTypeIDFor(TyInfo[I]); + LP.TypeIds.push_back(getFilterIDFor(IdsInFilter)); } /// TidyLandingPads - Remap landing pad labels and remove any deleted landing @@ -1760,6 +1765,20 @@ return TypeInfos.size(); } +/// getFilterIDFor - Return the filter id for the specified typeinfos. This is +/// function wide. +int MachineModuleInfo::getFilterIDFor(std::vector &TyIds) { + // TODO: map duplicate filters to the same filter id; a filter equal to the + // tail of an existing filter also need not be added; re-order filters and + // filter elements to maximize this kind of sharing. + int FilterID = -(1 + FilterIds.size()); + FilterIds.reserve(FilterIds.size() + TyIds.size() + 1); + for (unsigned I = 0, N = TyIds.size(); I != N; ++I) + FilterIds.push_back(TyIds[I]); + FilterIds.push_back(0); // terminator + return FilterID; +} + /// getPersonality - Return the personality function for the current function. Function *MachineModuleInfo::getPersonality() const { // FIXME: Until PR1414 will be fixed, we're using 1 personality function per From baldrick at free.fr Sat Jun 2 11:54:13 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 2 Jun 2007 11:54:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200706021654.l52GsDTm022183@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.455 -> 1.456 --- Log message: Integrate exception filter support and exception catch support. This simplifies the code in DwarfWriter, allows for multiple filters and makes it trivial to specify filters accompanied by cleanups or catch-all specifications (see next patch). What a deal! Patch blessed by Anton. --- Diffs of the changes: (+4 -3) SelectionDAGISel.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.455 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.456 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.455 Fri Jun 1 03:18:30 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jun 2 11:53:42 2007 @@ -2611,8 +2611,6 @@ isa(CE->getOperand(0)) && "Personality should be a function"); MMI->addPersonality(CurMBB, cast(CE->getOperand(0))); - if (Intrinsic == Intrinsic::eh_filter) - MMI->setIsFilterLandingPad(CurMBB); // Gather all the type infos for this landing pad and pass them along to // MachineModuleInfo. @@ -2624,7 +2622,10 @@ "TypeInfo must be a global variable or NULL"); TyInfo.push_back(GV); } - MMI->addCatchTypeInfo(CurMBB, TyInfo); + if (Intrinsic == Intrinsic::eh_filter) + MMI->addFilterTypeInfo(CurMBB, TyInfo); + else + MMI->addCatchTypeInfo(CurMBB, TyInfo); // Mark exception selector register as live in. unsigned Reg = TLI.getExceptionSelectorRegister(); From baldrick at free.fr Sat Jun 2 12:16:27 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 2 Jun 2007 12:16:27 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineModuleInfo.h Message-ID: <200706021716.l52HGR6l022613@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineModuleInfo.h updated: 1.16 -> 1.17 --- Log message: The semantics of invoke require that we always jump to the unwind block (landing pad) when an exception unwinds through the call. This doesn't quite match the way the dwarf unwinder works: by default it only jumps to the landing pad if the catch or filter specification matches, and otherwise it keeps on unwinding. There are two ways of specifying to the unwinder that it should "always" (more on why there are quotes here later) jump to the landing pad: follow the specification by a 0 typeid, or follow it by the typeid for the NULL typeinfo. GCC does the first, and this patch makes LLVM do the same as gcc. However there is a problem: the unwinder performs optimizations based on C++ semantics (it only expects destructors to be run if the 0 typeid fires - known as "cleanups"), meaning it assumes that no exceptions will be raised and that the raised exception will be reraised at the end of the cleanup code. So if someone writes their own LLVM code using the exception intrinsics they will get a nasty surprise if they don't follow these rules. The other possibility of using the typeid corresponding to NULL (catch-all) causes the unwinder to make no assumptions, so this is probably what we should use in the long-run. However since we are still having trouble getting exception handling working properly, for the moment it seems best to closely imitate GCC. --- Diffs of the changes: (+1 -1) MachineModuleInfo.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/MachineModuleInfo.h diff -u llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.16 llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.17 --- llvm/include/llvm/CodeGen/MachineModuleInfo.h:1.16 Sat Jun 2 11:53:42 2007 +++ llvm/include/llvm/CodeGen/MachineModuleInfo.h Sat Jun 2 12:16:06 2007 @@ -966,7 +966,7 @@ : LandingPadBlock(MBB) , LandingPadLabel(0) , Personality(NULL) - , TypeIds() + , TypeIds(1, 0) // Always have cleanups {} }; From baldrick at free.fr Sat Jun 2 12:16:28 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 2 Jun 2007 12:16:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200706021716.l52HGSx7022619@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineModuleInfo.cpp updated: 1.16 -> 1.17 --- Log message: The semantics of invoke require that we always jump to the unwind block (landing pad) when an exception unwinds through the call. This doesn't quite match the way the dwarf unwinder works: by default it only jumps to the landing pad if the catch or filter specification matches, and otherwise it keeps on unwinding. There are two ways of specifying to the unwinder that it should "always" (more on why there are quotes here later) jump to the landing pad: follow the specification by a 0 typeid, or follow it by the typeid for the NULL typeinfo. GCC does the first, and this patch makes LLVM do the same as gcc. However there is a problem: the unwinder performs optimizations based on C++ semantics (it only expects destructors to be run if the 0 typeid fires - known as "cleanups"), meaning it assumes that no exceptions will be raised and that the raised exception will be reraised at the end of the cleanup code. So if someone writes their own LLVM code using the exception intrinsics they will get a nasty surprise if they don't follow these rules. The other possibility of using the typeid corresponding to NULL (catch-all) causes the unwinder to make no assumptions, so this is probably what we should use in the long-run. However since we are still having trouble getting exception handling working properly, for the moment it seems best to closely imitate GCC. --- Diffs of the changes: (+4 -0) MachineModuleInfo.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/MachineModuleInfo.cpp diff -u llvm/lib/CodeGen/MachineModuleInfo.cpp:1.16 llvm/lib/CodeGen/MachineModuleInfo.cpp:1.17 --- llvm/lib/CodeGen/MachineModuleInfo.cpp:1.16 Sat Jun 2 11:53:42 2007 +++ llvm/lib/CodeGen/MachineModuleInfo.cpp Sat Jun 2 12:16:06 2007 @@ -1728,6 +1728,10 @@ LandingPadInfo &LandingPad = LandingPads[i]; LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel); + if (!LandingPad.LandingPadBlock) + // Must not have cleanups if no landing pad. + LandingPad.TypeIds.clear(); + // Special case: we *should* emit LPs with null LP MBB. This indicates // "rethrow" case. if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) { From clattner at apple.com Sat Jun 2 12:36:45 2007 From: clattner at apple.com (Chris Lattner) Date: Sat, 2 Jun 2007 10:36:45 -0700 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineModuleInfo.h In-Reply-To: <200706021654.l52GsDaZ022182@zion.cs.uiuc.edu> References: <200706021654.l52GsDaZ022182@zion.cs.uiuc.edu> Message-ID: <456EAE7A-163B-42AB-8CEC-C5C7B21DEFA2@apple.com> > > Integrate exception filter support and exception catch support. This > simplifies the code in DwarfWriter, allows for multiple filters and > makes it trivial to specify filters accompanied by cleanups or > catch-all > specifications (see next patch). What a deal! Patch blessed by > Anton. Very nice guys! -Chris From sabre at nondot.org Sat Jun 2 13:45:36 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 2 Jun 2007 13:45:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/README-Thumb.txt Message-ID: <200706021845.l52IjaOt024257@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: README-Thumb.txt updated: 1.10 -> 1.11 --- Log message: update this entry, now that Anton implemented shift/and lowering for switches. There is one really easy isel thing here with tst we are not getting. --- Diffs of the changes: (+66 -17) README-Thumb.txt | 83 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 66 insertions(+), 17 deletions(-) Index: llvm/lib/Target/ARM/README-Thumb.txt diff -u llvm/lib/Target/ARM/README-Thumb.txt:1.10 llvm/lib/Target/ARM/README-Thumb.txt:1.11 --- llvm/lib/Target/ARM/README-Thumb.txt:1.10 Thu Mar 29 16:40:13 2007 +++ llvm/lib/Target/ARM/README-Thumb.txt Sat Jun 2 13:45:14 2007 @@ -67,25 +67,9 @@ //===---------------------------------------------------------------------===// -We compiles the following using a jump table. +We compiles the following: define i16 @func_entry_2E_ce(i32 %i) { -newFuncRoot: - br label %entry.ce - -bb12.exitStub: ; preds = %entry.ce - ret i16 0 - -bb4.exitStub: ; preds = %entry.ce, %entry.ce, %entry.ce - ret i16 1 - -bb9.exitStub: ; preds = %entry.ce, %entry.ce, %entry.ce - ret i16 2 - -bb.exitStub: ; preds = %entry.ce - ret i16 3 - -entry.ce: ; preds = %newFuncRoot switch i32 %i, label %bb12.exitStub [ i32 0, label %bb4.exitStub i32 1, label %bb9.exitStub @@ -95,8 +79,58 @@ i32 8, label %bb.exitStub i32 9, label %bb9.exitStub ] + +bb12.exitStub: + ret i16 0 + +bb4.exitStub: + ret i16 1 + +bb9.exitStub: + ret i16 2 + +bb.exitStub: + ret i16 3 } +into: + +_func_entry_2E_ce: + mov r2, #1 + lsl r2, r0 + cmp r0, #9 + bhi LBB1_4 @bb12.exitStub +LBB1_1: @newFuncRoot + mov r1, #13 + tst r2, r1 + bne LBB1_5 @bb4.exitStub +LBB1_2: @newFuncRoot + ldr r1, LCPI1_0 + tst r2, r1 + bne LBB1_6 @bb9.exitStub +LBB1_3: @newFuncRoot + mov r1, #1 + lsl r1, r1, #8 + tst r2, r1 + bne LBB1_7 @bb.exitStub +LBB1_4: @bb12.exitStub + mov r0, #0 + bx lr +LBB1_5: @bb4.exitStub + mov r0, #1 + bx lr +LBB1_6: @bb9.exitStub + mov r0, #2 + bx lr +LBB1_7: @bb.exitStub + mov r0, #3 + bx lr +LBB1_8: + .align 2 +LCPI1_0: + .long 642 + + gcc compiles to: cmp r0, #9 @@ -124,6 +158,21 @@ .align 2 L11: .long 642 + + +GCC is doing a couple of clever things here: + 1. It is predicating one of the returns. This isn't a clear win though: in + cases where that return isn't taken, it is replacing one condbranch with + two 'ne' predicated instructions. + 2. It is sinking the shift of "1 << i" into the tst, and using ands instead of + tst. This will probably require whole function isel. + 3. GCC emits: + tst r1, #256 + we emit: + mov r1, #1 + lsl r1, r1, #8 + tst r2, r1 + //===---------------------------------------------------------------------===// From sabre at nondot.org Sat Jun 2 18:15:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 2 Jun 2007 18:15:57 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200706022315.l52NFvoZ030955@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.20 -> 1.21 --- Log message: osnews --- Diffs of the changes: (+3 -1) InTheNews.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.20 llvm-www/InTheNews.html:1.21 --- llvm-www/InTheNews.html:1.20 Thu May 24 12:54:42 2007 +++ llvm-www/InTheNews.html Sat Jun 2 18:15:32 2007 @@ -15,6 +15,8 @@
    News Articles

    2007

      +
    • 2007-06-02, OSNews, "Apple Developing a New LLVM C + Front-End", Eugenia Loli-Queru.
    • 2007-05-24, zrusin, "Mesa and LLVM", Zack Rusin.
    • 2007-05-24, lucille, "LLVM 2.0 and GCC 4.2". Finds the LLVM JIT 20% faster than GCC 4.2 at some benchmark.
    • 2007-03-31, Cliff Hacks, "Experimenting with LLVM", Cliff Biffle.
    • @@ -106,6 +108,6 @@ Valid HTML 4.01!
      - Last modified: $Date: 2007/05/24 17:54:42 $ + Last modified: $Date: 2007/06/02 23:15:32 $ From resistor at mac.com Sun Jun 3 00:56:20 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 3 Jun 2007 00:56:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200706030556.l535uKEc010385@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.10 -> 1.11 --- Log message: There's no need to have an Expression class... Value works just as well! This simplifies a lot of code. --- Diffs of the changes: (+168 -287) GVNPRE.cpp | 455 ++++++++++++++++++++++--------------------------------------- 1 files changed, 168 insertions(+), 287 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.10 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.11 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.10 Fri Jun 1 17:00:37 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Sun Jun 3 00:55:58 2007 @@ -36,6 +36,23 @@ #include using namespace llvm; +struct ExprLT { + bool operator()(Value* left, Value* right) { + if (!isa(left) || !isa(right)) + return left < right; + + BinaryOperator* BO1 = cast(left); + BinaryOperator* BO2 = cast(right); + + if ((*this)(BO1->getOperand(0), BO2->getOperand(0))) + return true; + else if ((*this)(BO2->getOperand(0), BO1->getOperand(0))) + return false; + else + return (*this)(BO1->getOperand(1), BO2->getOperand(1)); + } +}; + namespace { class VISIBILITY_HIDDEN GVNPRE : public FunctionPass { @@ -46,49 +63,7 @@ private: uint32_t nextValueNumber; - - struct Expression { - char opcode; - Value* value; - uint32_t lhs; - uint32_t rhs; - - bool operator<(const Expression& other) const { - if (opcode < other.opcode) - return true; - else if (other.opcode < opcode) - return false; - - if (opcode == 0) { - return value < other.value; - } else { - if (lhs < other.lhs) - return true; - else if (other.lhs < lhs) - return false; - else - return rhs < other.rhs; - } - } - - bool operator==(const Expression& other) const { - if (opcode != other.opcode) - return false; - - if (value != other.value) - return false; - - if (lhs != other.lhs) - return false; - - if (rhs != other.rhs) - return false; - - return true; - } - }; - - typedef std::map ValueTable; + typedef std::map ValueTable; virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); @@ -98,30 +73,27 @@ // Helper fuctions // FIXME: eliminate or document these better - void dump(ValueTable& VN, std::set& s); - void clean(ValueTable VN, std::set& set); - Expression add(ValueTable& VN, std::set& MS, Instruction* V); + void dump(ValueTable& VN, std::set& s); + void clean(ValueTable VN, std::set& set); + bool add(ValueTable& VN, std::set& MS, Value* V); ValueTable::iterator lookup(ValueTable& VN, Value* V); - Expression buildExpression(ValueTable& VN, Value* V); - std::set::iterator find_leader(ValueTable VN, - std::set& vals, - uint32_t v); - void phi_translate(ValueTable& VN, std::set& MS, - std::set& anticIn, BasicBlock* B, - std::set& out); + Value* find_leader(ValueTable VN, std::set& vals, uint32_t v); + void phi_translate(ValueTable& VN, std::set& MS, + std::set& anticIn, BasicBlock* B, + std::set& out); - void topo_sort(ValueTable& VN, std::set& set, - std::vector& vec); + void topo_sort(ValueTable& VN, std::set& set, + std::vector& vec); // For a given block, calculate the generated expressions, temporaries, // and the AVAIL_OUT set - void CalculateAvailOut(ValueTable& VN, std::set& MS, + void CalculateAvailOut(ValueTable& VN, std::set& MS, DominatorTree::Node* DI, - std::set& currExps, + std::set& currExps, std::set& currPhis, - std::set& currTemps, - std::set& currAvail, - std::map > availOut); + std::set& currTemps, + std::set& currAvail, + std::map > availOut); }; @@ -134,269 +106,173 @@ RegisterPass X("gvnpre", "Global Value Numbering/Partial Redundancy Elimination"); -// Given a Value, build an Expression to represent it -GVNPRE::Expression GVNPRE::buildExpression(ValueTable& VN, Value* V) { - if (Instruction* I = dyn_cast(V)) { - Expression e; - - switch (I->getOpcode()) { - case 7: - e.opcode = 1; // ADD - break; - case 8: - e.opcode = 2; // SUB - break; - case 9: - e.opcode = 3; // MUL - break; - case 10: - e.opcode = 4; // UDIV - break; - case 11: - e.opcode = 5; // SDIV - break; - case 12: - e.opcode = 6; // FDIV - break; - case 13: - e.opcode = 7; // UREM - break; - case 14: - e.opcode = 8; // SREM - break; - case 15: - e.opcode = 9; // FREM - break; - default: - e.opcode = 0; // OPAQUE - e.lhs = 0; - e.rhs = 0; - e.value = V; - return e; - } - - e.value = 0; - - ValueTable::iterator lhs = lookup(VN, I->getOperand(0)); - if (lhs == VN.end()) { - Expression lhsExp = buildExpression(VN, I->getOperand(0)); - VN.insert(std::make_pair(lhsExp, nextValueNumber)); - e.lhs = nextValueNumber; - nextValueNumber++; - } else - e.lhs = lhs->second; - ValueTable::iterator rhs = lookup(VN, I->getOperand(1)); - if (rhs == VN.end()) { - Expression rhsExp = buildExpression(VN, I->getOperand(1)); - VN.insert(std::make_pair(rhsExp, nextValueNumber)); - e.rhs = nextValueNumber; - nextValueNumber++; - } else - e.rhs = rhs->second; - - return e; - } else { - Expression e; - e.opcode = 0; - e.value = V; - e.lhs = 0; - e.rhs = 0; - - return e; - } -} -GVNPRE::Expression GVNPRE::add(ValueTable& VN, std::set& MS, - Instruction* V) { - Expression e = buildExpression(VN, V); - std::pair ret = VN.insert(std::make_pair(e, nextValueNumber)); + +bool GVNPRE::add(ValueTable& VN, std::set& MS, Value* V) { + std::pair ret = VN.insert(std::make_pair(V, nextValueNumber)); if (ret.second) nextValueNumber++; - if (e.opcode != 0 || (e.opcode == 0 && isa(e.value))) - MS.insert(e); - return e; + if (isa(V) || isa(V)) + MS.insert(V); + return ret.second; } GVNPRE::ValueTable::iterator GVNPRE::lookup(ValueTable& VN, Value* V) { - Expression e = buildExpression(VN, V); - return VN.find(e); + return VN.find(V); } -std::set::iterator GVNPRE::find_leader(GVNPRE::ValueTable VN, - std::set& vals, +Value* GVNPRE::find_leader(GVNPRE::ValueTable VN, + std::set& vals, uint32_t v) { - for (std::set::iterator I = vals.begin(), E = vals.end(); + for (std::set::iterator I = vals.begin(), E = vals.end(); I != E; ++I) if (VN[*I] == v) - return I; + return *I; - return vals.end(); + return 0; } void GVNPRE::phi_translate(GVNPRE::ValueTable& VN, - std::set& MS, - std::set& anticIn, BasicBlock* B, - std::set& out) { + std::set& MS, + std::set& anticIn, BasicBlock* B, + std::set& out) { BasicBlock* succ = B->getTerminator()->getSuccessor(0); - for (std::set::iterator I = anticIn.begin(), E = anticIn.end(); + for (std::set::iterator I = anticIn.begin(), E = anticIn.end(); I != E; ++I) { - if (I->opcode == 0) { - Value *v = I->value; - if (PHINode* p = dyn_cast(v)) { + if (!isa(*I)) { + if (PHINode* p = dyn_cast(*I)) { if (p->getParent() == succ) - out.insert(buildExpression(VN, p->getIncomingValueForBlock(B))); + out.insert(p); } else { out.insert(*I); } } else { - std::set::iterator lhs_it = find_leader(VN, anticIn, I->lhs); - if (lhs_it == anticIn.end()) + BinaryOperator* BO = cast(*I); + Value* lhs = find_leader(VN, anticIn, VN[BO->getOperand(0)]); + if (lhs == 0) continue; - Expression lhs = *lhs_it; - if (lhs.value != 0) - if (PHINode* p = dyn_cast(lhs.value)) - if (p->getParent() == succ) { - Expression t = buildExpression(VN, p->getIncomingValueForBlock(B)); - lhs.opcode = t.opcode; - lhs.value = t.value; - lhs.lhs = t.lhs; - lhs.rhs = t.rhs; - - out.insert(t); - } + if (PHINode* p = dyn_cast(lhs)) + if (p->getParent() == succ) { + lhs = p->getIncomingValueForBlock(B); + out.insert(lhs); + } - std::set::iterator rhs_it = find_leader(VN, anticIn, I->rhs); - if (rhs_it == anticIn.end()) + Value* rhs = find_leader(VN, anticIn, VN[BO->getOperand(1)]); + if (rhs == 0) continue; - Expression rhs = *rhs_it; - if (rhs.value != 0) - if (PHINode* p = dyn_cast(rhs.value)) - if (p->getParent() == succ) { - Expression t = buildExpression(VN, p->getIncomingValueForBlock(B)); - rhs.opcode = t.opcode; - rhs.value = t.value; - rhs.lhs = t.lhs; - rhs.rhs = t.rhs; - - out.insert(t); - } - - Expression e; - e.opcode = I->opcode; - e.value = 0; - e.lhs = VN[lhs]; - e.rhs = VN[rhs]; - - if (VN.insert(std::make_pair(e, nextValueNumber)).second) - nextValueNumber++; - MS.insert(e); + if (PHINode* p = dyn_cast(rhs)) + if (p->getParent() == succ) { + rhs = p->getIncomingValueForBlock(B); + out.insert(rhs); + } + + if (lhs != BO->getOperand(0) || rhs != BO->getOperand(1)) { + BO = BinaryOperator::create(BO->getOpcode(), lhs, rhs, BO->getName()+".gvnpre"); + if (VN.insert(std::make_pair(BO, nextValueNumber)).second) + nextValueNumber++; + MS.insert(BO); + } + + out.insert(BO); + } } } // Remove all expressions whose operands are not themselves in the set -void GVNPRE::clean(GVNPRE::ValueTable VN, std::set& set) { - std::vector worklist; +void GVNPRE::clean(GVNPRE::ValueTable VN, std::set& set) { + std::vector worklist; topo_sort(VN, set, worklist); while (!worklist.empty()) { - Expression e = worklist.back(); + Value* v = worklist.back(); worklist.pop_back(); - if (e.opcode == 0) // OPAQUE - continue; - - bool lhsValid = false; - for (std::set::iterator I = set.begin(), E = set.end(); - I != E; ++I) - if (VN[*I] == e.lhs); - lhsValid = true; - - bool rhsValid = false; - for (std::set::iterator I = set.begin(), E = set.end(); - I != E; ++I) - if (VN[*I] == e.rhs); - rhsValid = true; + if (BinaryOperator* BO = dyn_cast(v)) { + bool lhsValid = false; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) + if (VN[*I] == VN[BO->getOperand(0)]); + lhsValid = true; + + bool rhsValid = false; + for (std::set::iterator I = set.begin(), E = set.end(); + I != E; ++I) + if (VN[*I] == VN[BO->getOperand(1)]); + rhsValid = true; - if (!lhsValid || !rhsValid) - set.erase(e); + if (!lhsValid || !rhsValid) + set.erase(BO); + } } } void GVNPRE::topo_sort(GVNPRE::ValueTable& VN, - std::set& set, - std::vector& vec) { - std::set toErase; - for (std::set::iterator I = set.begin(), E = set.end(); + std::set& set, + std::vector& vec) { + std::set toErase; + for (std::set::iterator I = set.begin(), E = set.end(); I != E; ++I) { - for (std::set::iterator SI = set.begin(); SI != E; ++SI) { - if (I->lhs == VN[*SI] || I->rhs == VN[*SI]) { - toErase.insert(*SI); - } + if (BinaryOperator* BO = dyn_cast(*I)) + for (std::set::iterator SI = set.begin(); SI != E; ++SI) { + if (VN[BO->getOperand(0)] == VN[*SI] || VN[BO->getOperand(1)] == VN[*SI]) { + toErase.insert(BO); + } } } - std::vector Q; - std::insert_iterator > q_ins(Q, Q.begin()); + std::vector Q; + std::insert_iterator > q_ins(Q, Q.begin()); std::set_difference(set.begin(), set.end(), toErase.begin(), toErase.end(), - q_ins); + q_ins, ExprLT()); - std::set visited; + std::set visited; while (!Q.empty()) { - Expression e = Q.back(); - - if (e.opcode == 0) { + Value* e = Q.back(); + + if (BinaryOperator* BO = dyn_cast(e)) { + Value* l = find_leader(VN, set, VN[BO->getOperand(0)]); + Value* r = find_leader(VN, set, VN[BO->getOperand(1)]); + + if (l != 0 && visited.find(l) == visited.end()) + Q.push_back(l); + else if (r != 0 && visited.find(r) == visited.end()) + Q.push_back(r); + else { + vec.push_back(e); + visited.insert(e); + Q.pop_back(); + } + } else { visited.insert(e); vec.push_back(e); Q.pop_back(); - continue; - } - - std::set::iterator l = find_leader(VN, set, e.lhs); - std::set::iterator r = find_leader(VN, set, e.rhs); - - if (l != set.end() && visited.find(*l) == visited.end()) - Q.push_back(*l); - else if (r != set.end() && visited.find(*r) == visited.end()) - Q.push_back(*r); - else { - vec.push_back(e); - visited.insert(e); - Q.pop_back(); } } } -void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { - std::vector sorted; +void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { + std::vector sorted; topo_sort(VN, s, sorted); DOUT << "{ "; - for (std::vector::iterator I = sorted.begin(), E = sorted.end(); + for (std::vector::iterator I = sorted.begin(), E = sorted.end(); I != E; ++I) { - DOUT << VN[*I] << ": "; - DOUT << "( "; - DOUT << (char)(I->opcode+48); - DOUT << ", "; - if (I->value == 0) - DOUT << "0"; - else - DEBUG(I->value->dump()); - DOUT << ", value." << I->lhs << ", value." << I->rhs << " ) "; + DEBUG((*I)->dump()); } DOUT << "}\n\n"; } -void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set& MS, +void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set& MS, DominatorTree::Node* DI, - std::set& currExps, + std::set& currExps, std::set& currPhis, - std::set& currTemps, - std::set& currAvail, - std::map > availOut) { + std::set& currTemps, + std::set& currAvail, + std::map > availOut) { BasicBlock* BB = DI->getBlock(); @@ -416,36 +292,37 @@ // Handle binary ops... } else if (BinaryOperator* BO = dyn_cast(BI)) { - Expression leftValue = buildExpression(VN, BO->getOperand(0)); - Expression rightValue = buildExpression(VN, BO->getOperand(1)); + Value* leftValue = BO->getOperand(0); + Value* rightValue = BO->getOperand(1); - Expression e = add(VN, MS, BO); + add(VN, MS, BO); currExps.insert(leftValue); currExps.insert(rightValue); - currExps.insert(e); + currExps.insert(BO); - currTemps.insert(e); + currTemps.insert(BO); // Handle unsupported ops - } else { - Expression e = add(VN, MS, BI); - currTemps.insert(e); + } else if (!BI->isTerminator()){ + add(VN, MS, BI); + currTemps.insert(BI); } - - currAvail.insert(buildExpression(VN, BI)); + + if (!BI->isTerminator()) + currAvail.insert(BI); } } bool GVNPRE::runOnFunction(Function &F) { ValueTable VN; - std::set maximalSet; + std::set maximalSet; - std::map > generatedExpressions; + std::map > generatedExpressions; std::map > generatedPhis; - std::map > generatedTemporaries; - std::map > availableOut; - std::map > anticipatedIn; + std::map > generatedTemporaries; + std::map > availableOut; + std::map > anticipatedIn; DominatorTree &DT = getAnalysis(); @@ -456,10 +333,10 @@ E = df_end(DT.getRootNode()); DI != E; ++DI) { // Get the sets to update for this block - std::set& currExps = generatedExpressions[DI->getBlock()]; + std::set& currExps = generatedExpressions[DI->getBlock()]; std::set& currPhis = generatedPhis[DI->getBlock()]; - std::set& currTemps = generatedTemporaries[DI->getBlock()]; - std::set& currAvail = availableOut[DI->getBlock()]; + std::set& currTemps = generatedTemporaries[DI->getBlock()]; + std::set& currAvail = availableOut[DI->getBlock()]; CalculateAvailOut(VN, maximalSet, *DI, currExps, currPhis, currTemps, currAvail, availableOut); @@ -475,7 +352,7 @@ unsigned iterations = 0; while (changed) { changed = false; - std::set anticOut; + std::set anticOut; // Top-down walk of the postdominator tree for (df_iterator PDI = @@ -485,8 +362,8 @@ visited.insert(BB); - std::set& anticIn = anticipatedIn[BB]; - std::set old (anticIn.begin(), anticIn.end()); + std::set& anticIn = anticipatedIn[BB]; + std::set old (anticIn.begin(), anticIn.end()); if (BB->getTerminator()->getNumSuccessors() == 1) { if (visited.find(BB) == visited.end()) @@ -496,43 +373,43 @@ } else if (BB->getTerminator()->getNumSuccessors() > 1) { for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); - std::set temp; + std::set temp; if (visited.find(currSucc) == visited.end()) temp.insert(maximalSet.begin(), maximalSet.end()); else temp.insert(anticIn.begin(), anticIn.end()); anticIn.clear(); - std::insert_iterator > ai_ins(anticIn, + std::insert_iterator > ai_ins(anticIn, anticIn.begin()); std::set_difference(anticipatedIn[currSucc].begin(), anticipatedIn[currSucc].end(), temp.begin(), temp.end(), - ai_ins); + ai_ins, + ExprLT()); } } - std::set S; - std::insert_iterator > s_ins(S, S.begin()); + std::set S; + std::insert_iterator > s_ins(S, S.begin()); std::set_union(anticOut.begin(), anticOut.end(), generatedExpressions[BB].begin(), generatedExpressions[BB].end(), - s_ins); + s_ins, ExprLT()); anticIn.clear(); - std::insert_iterator > antic_ins(anticIn, + std::insert_iterator > antic_ins(anticIn, anticIn.begin()); std::set_difference(S.begin(), S.end(), generatedTemporaries[BB].begin(), generatedTemporaries[BB].end(), - antic_ins); + antic_ins, + ExprLT()); clean(VN, anticIn); - - if (old != anticIn) changed = true; @@ -557,6 +434,10 @@ DOUT << "ANTIC_IN: "; dump(VN, anticipatedIn[I]); DOUT << "\n"; + + DOUT << "AVAIL_OUT: "; + dump(VN, availableOut[I]); + DOUT << "\n"; } return false; From resistor at mac.com Sun Jun 3 00:58:47 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 3 Jun 2007 00:58:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200706030558.l535wlvs010433@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.11 -> 1.12 --- Log message: Remove an unused method. --- Diffs of the changes: (+0 -5) GVNPRE.cpp | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.11 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.12 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.11 Sun Jun 3 00:55:58 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Sun Jun 3 00:58:25 2007 @@ -76,7 +76,6 @@ void dump(ValueTable& VN, std::set& s); void clean(ValueTable VN, std::set& set); bool add(ValueTable& VN, std::set& MS, Value* V); - ValueTable::iterator lookup(ValueTable& VN, Value* V); Value* find_leader(ValueTable VN, std::set& vals, uint32_t v); void phi_translate(ValueTable& VN, std::set& MS, std::set& anticIn, BasicBlock* B, @@ -117,10 +116,6 @@ return ret.second; } -GVNPRE::ValueTable::iterator GVNPRE::lookup(ValueTable& VN, Value* V) { - return VN.find(V); -} - Value* GVNPRE::find_leader(GVNPRE::ValueTable VN, std::set& vals, uint32_t v) { From dpatel at apple.com Sun Jun 3 01:26:37 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 01:26:37 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h PostDominators.h Message-ID: <200706030626.l536QbmV011470@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Dominators.h updated: 1.83 -> 1.84 PostDominators.h updated: 1.21 -> 1.22 --- Log message: s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g --- Diffs of the changes: (+35 -35) Dominators.h | 64 +++++++++++++++++++++++++++---------------------------- PostDominators.h | 6 ++--- 2 files changed, 35 insertions(+), 35 deletions(-) Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.83 llvm/include/llvm/Analysis/Dominators.h:1.84 --- llvm/include/llvm/Analysis/Dominators.h:1.83 Wed May 23 14:55:36 2007 +++ llvm/include/llvm/Analysis/Dominators.h Sun Jun 3 01:26:14 2007 @@ -61,13 +61,13 @@ /// class DominatorTreeBase : public DominatorBase { public: - class Node; + class DomTreeNode; protected: - std::map Nodes; + std::map DomTreeNodes; void reset(); - typedef std::map NodeMapType; + typedef std::map DomTreeNodeMapType; - Node *RootNode; + DomTreeNode *RootNode; struct InfoRec { unsigned Semi; @@ -88,16 +88,16 @@ std::map Info; public: - class Node { + class DomTreeNode { friend class DominatorTree; friend struct PostDominatorTree; friend class DominatorTreeBase; BasicBlock *TheBB; - Node *IDom; - std::vector Children; + DomTreeNode *IDom; + std::vector Children; public: - typedef std::vector::iterator iterator; - typedef std::vector::const_iterator const_iterator; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; iterator begin() { return Children.begin(); } iterator end() { return Children.end(); } @@ -105,14 +105,14 @@ const_iterator end() const { return Children.end(); } inline BasicBlock *getBlock() const { return TheBB; } - inline Node *getIDom() const { return IDom; } - inline const std::vector &getChildren() const { return Children; } + inline DomTreeNode *getIDom() const { return IDom; } + inline const std::vector &getChildren() const { return Children; } /// properlyDominates - Returns true iff this dominates N and this != N. /// Note that this is not a constant time operation! /// - bool properlyDominates(const Node *N) const { - const Node *IDom; + bool properlyDominates(const DomTreeNode *N) const { + const DomTreeNode *IDom; if (this == 0 || N == 0) return false; while ((IDom = N->getIDom()) != 0 && IDom != this) N = IDom; // Walk up the tree @@ -122,16 +122,16 @@ /// dominates - Returns true iff this dominates N. Note that this is not a /// constant time operation! /// - inline bool dominates(const Node *N) const { + inline bool dominates(const DomTreeNode *N) const { if (N == this) return true; // A node trivially dominates itself. return properlyDominates(N); } private: - inline Node(BasicBlock *BB, Node *iDom) : TheBB(BB), IDom(iDom) {} - inline Node *addChild(Node *C) { Children.push_back(C); return C; } + inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {} + inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; } - void setIDom(Node *NewIDom); + void setIDom(DomTreeNode *NewIDom); }; public: @@ -144,12 +144,12 @@ /// getNode - return the (Post)DominatorTree node for the specified basic /// block. This is the same as using operator[] on this class. /// - inline Node *getNode(BasicBlock *BB) const { - NodeMapType::const_iterator i = Nodes.find(BB); - return (i != Nodes.end()) ? i->second : 0; + inline DomTreeNode *getNode(BasicBlock *BB) const { + DomTreeNodeMapType::const_iterator i = DomTreeNodes.find(BB); + return (i != DomTreeNodes.end()) ? i->second : 0; } - inline Node *operator[](BasicBlock *BB) const { + inline DomTreeNode *operator[](BasicBlock *BB) const { return getNode(BB); } @@ -160,8 +160,8 @@ /// post-dominance information must be capable of dealing with this /// possibility. /// - Node *getRootNode() { return RootNode; } - const Node *getRootNode() const { return RootNode; } + DomTreeNode *getRootNode() { return RootNode; } + const DomTreeNode *getRootNode() const { return RootNode; } //===--------------------------------------------------------------------===// // API to update (Post)DominatorTree information based on modifications to @@ -171,16 +171,16 @@ /// creates a new node as a child of IDomNode, linking it into the children /// list of the immediate dominator. /// - Node *createNewNode(BasicBlock *BB, Node *IDomNode) { + DomTreeNode *createNewNode(BasicBlock *BB, DomTreeNode *IDomNode) { assert(getNode(BB) == 0 && "Block already in dominator tree!"); assert(IDomNode && "Not immediate dominator specified for block!"); - return Nodes[BB] = IDomNode->addChild(new Node(BB, IDomNode)); + return DomTreeNodes[BB] = IDomNode->addChild(new DomTreeNode(BB, IDomNode)); } /// changeImmediateDominator - This method is used to update the dominator /// tree information when a node's immediate dominator changes. /// - void changeImmediateDominator(Node *N, Node *NewIDom) { + void changeImmediateDominator(DomTreeNode *N, DomTreeNode *NewIDom) { assert(N && NewIDom && "Cannot change null node pointers!"); N->setIDom(NewIDom); } @@ -190,7 +190,7 @@ /// block. void removeNode(BasicBlock *BB) { assert(getNode(BB) && "Removing node that isn't in dominator tree."); - Nodes.erase(BB); + DomTreeNodes.erase(BB); } /// print - Convert to human readable form @@ -223,7 +223,7 @@ } private: void calculate(Function& F); - Node *getNodeForBlock(BasicBlock *BB); + DomTreeNode *getNodeForBlock(BasicBlock *BB); unsigned DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N); void Compress(BasicBlock *V); BasicBlock *Eval(BasicBlock *v); @@ -238,8 +238,8 @@ /// DominatorTree GraphTraits specialization so the DominatorTree can be /// iterable by generic graph iterators. /// -template <> struct GraphTraits { - typedef DominatorTree::Node NodeType; +template <> struct GraphTraits { + typedef DominatorTree::DomTreeNode NodeType; typedef NodeType::iterator ChildIteratorType; static NodeType *getEntryNode(NodeType *N) { @@ -254,7 +254,7 @@ }; template <> struct GraphTraits - : public GraphTraits { + : public GraphTraits { static NodeType *getEntryNode(DominatorTree *DT) { return DT->getRootNode(); } @@ -503,7 +503,7 @@ } private: const DomSetType &calculate(const DominatorTree &DT, - const DominatorTree::Node *Node); + const DominatorTree::DomTreeNode *Node); }; Index: llvm/include/llvm/Analysis/PostDominators.h diff -u llvm/include/llvm/Analysis/PostDominators.h:1.21 llvm/include/llvm/Analysis/PostDominators.h:1.22 --- llvm/include/llvm/Analysis/PostDominators.h:1.21 Sun May 6 08:37:15 2007 +++ llvm/include/llvm/Analysis/PostDominators.h Sun Jun 3 01:26:14 2007 @@ -38,7 +38,7 @@ } private: void calculate(Function &F); - Node *getNodeForBlock(BasicBlock *BB); + DomTreeNode *getNodeForBlock(BasicBlock *BB); unsigned DFSPass(BasicBlock *V, InfoRec &VInfo,unsigned N); void Compress(BasicBlock *V, InfoRec &VInfo); BasicBlock *Eval(BasicBlock *V); @@ -87,7 +87,7 @@ Frontiers.clear(); PostDominatorTree &DT = getAnalysis(); Roots = DT.getRoots(); - if (const DominatorTree::Node *Root = DT.getRootNode()) + if (const DominatorTree::DomTreeNode *Root = DT.getRootNode()) calculate(DT, Root); return false; } @@ -99,7 +99,7 @@ private: const DomSetType &calculate(const PostDominatorTree &DT, - const DominatorTree::Node *Node); + const DominatorTree::DomTreeNode *Node); }; } // End llvm namespace From dpatel at apple.com Sun Jun 3 01:26:46 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 01:26:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp Message-ID: <200706030626.l536QkS3011480@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: PostDominators.cpp updated: 1.70 -> 1.71 --- Log message: s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g --- Diffs of the changes: (+14 -14) PostDominators.cpp | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) Index: llvm/lib/Analysis/PostDominators.cpp diff -u llvm/lib/Analysis/PostDominators.cpp:1.70 llvm/lib/Analysis/PostDominators.cpp:1.71 --- llvm/lib/Analysis/PostDominators.cpp:1.70 Wed May 2 20:11:53 2007 +++ llvm/lib/Analysis/PostDominators.cpp Sun Jun 3 01:26:14 2007 @@ -165,19 +165,19 @@ // one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0) // which postdominates all real exits if there are multiple exit blocks. BasicBlock *Root = Roots.size() == 1 ? Roots[0] : 0; - Nodes[Root] = RootNode = new Node(Root, 0); + DomTreeNodes[Root] = RootNode = new DomTreeNode(Root, 0); // Loop over all of the reachable blocks in the function... for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) if (BasicBlock *ImmPostDom = getIDom(I)) { // Reachable block. - Node *&BBNode = Nodes[I]; + DomTreeNode *&BBNode = DomTreeNodes[I]; if (!BBNode) { // Haven't calculated this node yet? // Get or calculate the node for the immediate dominator - Node *IPDomNode = getNodeForBlock(ImmPostDom); + DomTreeNode *IPDomNode = getNodeForBlock(ImmPostDom); // Add a new tree node for this BasicBlock, and link it as a child of // IDomNode - BBNode = IPDomNode->addChild(new Node(I, IPDomNode)); + BBNode = IPDomNode->addChild(new DomTreeNode(I, IPDomNode)); } } @@ -188,18 +188,18 @@ } -DominatorTreeBase::Node *PostDominatorTree::getNodeForBlock(BasicBlock *BB) { - Node *&BBNode = Nodes[BB]; +DominatorTreeBase::DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) { + DomTreeNode *&BBNode = DomTreeNodes[BB]; if (BBNode) return BBNode; // Haven't calculated this node yet? Get or calculate the node for the // immediate postdominator. BasicBlock *IPDom = getIDom(BB); - Node *IPDomNode = getNodeForBlock(IPDom); + DomTreeNode *IPDomNode = getNodeForBlock(IPDom); // Add a new tree node for this BasicBlock, and link it as a child of // IDomNode - return BBNode = IPDomNode->addChild(new Node(BB, IPDomNode)); + return BBNode = IPDomNode->addChild(new DomTreeNode(BB, IPDomNode)); } //===----------------------------------------------------------------------===// @@ -215,7 +215,7 @@ // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. - PostDominatorTree::Node *node = getAnalysis().getNode(BB); + PostDominatorTree::DomTreeNode *node = getAnalysis().getNode(BB); // If we are unreachable, we may not have an immediate dominator. if (!node) @@ -245,7 +245,7 @@ ETNode *&BBNode = Nodes[BB]; if (!BBNode) { ETNode *IDomNode = NULL; - PostDominatorTree::Node *node = DT.getNode(BB); + PostDominatorTree::DomTreeNode *node = DT.getNode(BB); if (node && node->getIDom()) IDomNode = getNodeForBlock(node->getIDom()->getBlock()); @@ -277,7 +277,7 @@ const DominanceFrontier::DomSetType & PostDominanceFrontier::calculate(const PostDominatorTree &DT, - const DominatorTree::Node *Node) { + const DominatorTree::DomTreeNode *Node) { // Loop over CFG successors to calculate DFlocal[Node] BasicBlock *BB = Node->getBlock(); DomSetType &S = Frontiers[BB]; // The new set to fill in... @@ -287,7 +287,7 @@ for (pred_iterator SI = pred_begin(BB), SE = pred_end(BB); SI != SE; ++SI) { // Does Node immediately dominate this predecessor? - DominatorTree::Node *SINode = DT[*SI]; + DominatorTree::DomTreeNode *SINode = DT[*SI]; if (SINode && SINode->getIDom() != Node) S.insert(*SI); } @@ -296,9 +296,9 @@ // Loop through and visit the nodes that Node immediately dominates (Node's // children in the IDomTree) // - for (PostDominatorTree::Node::const_iterator + for (PostDominatorTree::DomTreeNode::const_iterator NI = Node->begin(), NE = Node->end(); NI != NE; ++NI) { - DominatorTree::Node *IDominee = *NI; + DominatorTree::DomTreeNode *IDominee = *NI; const DomSetType &ChildDF = calculate(DT, IDominee); DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end(); From dpatel at apple.com Sun Jun 3 01:26:46 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 01:26:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp Message-ID: <200706030626.l536Qkfm011485@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Dominators.cpp updated: 1.102 -> 1.103 --- Log message: s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g --- Diffs of the changes: (+27 -27) Dominators.cpp | 54 +++++++++++++++++++++++++++--------------------------- 1 files changed, 27 insertions(+), 27 deletions(-) Index: llvm/lib/VMCore/Dominators.cpp diff -u llvm/lib/VMCore/Dominators.cpp:1.102 llvm/lib/VMCore/Dominators.cpp:1.103 --- llvm/lib/VMCore/Dominators.cpp:1.102 Wed May 23 14:55:36 2007 +++ llvm/lib/VMCore/Dominators.cpp Sun Jun 3 01:26:14 2007 @@ -234,7 +234,7 @@ void DominatorTree::calculate(Function& F) { BasicBlock* Root = Roots[0]; - Nodes[Root] = RootNode = new Node(Root, 0); // Add a node for the root... + DomTreeNodes[Root] = RootNode = new DomTreeNode(Root, 0); // Add a node for the root... Vertex.push_back(0); @@ -282,14 +282,14 @@ // Loop over all of the reachable blocks in the function... for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) if (BasicBlock *ImmDom = getIDom(I)) { // Reachable block. - Node *&BBNode = Nodes[I]; + DomTreeNode *&BBNode = DomTreeNodes[I]; if (!BBNode) { // Haven't calculated this node yet? // Get or calculate the node for the immediate dominator - Node *IDomNode = getNodeForBlock(ImmDom); + DomTreeNode *IDomNode = getNodeForBlock(ImmDom); // Add a new tree node for this BasicBlock, and link it as a child of // IDomNode - BBNode = IDomNode->addChild(new Node(I, IDomNode)); + BBNode = IDomNode->addChild(new DomTreeNode(I, IDomNode)); } } @@ -302,19 +302,19 @@ // DominatorTreeBase::reset - Free all of the tree node memory. // void DominatorTreeBase::reset() { - for (NodeMapType::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) + for (DomTreeNodeMapType::iterator I = DomTreeNodes.begin(), E = DomTreeNodes.end(); I != E; ++I) delete I->second; - Nodes.clear(); + DomTreeNodes.clear(); IDoms.clear(); Roots.clear(); Vertex.clear(); RootNode = 0; } -void DominatorTreeBase::Node::setIDom(Node *NewIDom) { +void DominatorTreeBase::DomTreeNode::setIDom(DomTreeNode *NewIDom) { assert(IDom && "No immediate dominator?"); if (IDom != NewIDom) { - std::vector::iterator I = + std::vector::iterator I = std::find(IDom->Children.begin(), IDom->Children.end(), this); assert(I != IDom->Children.end() && "Not in immediate dominator children set!"); @@ -327,22 +327,22 @@ } } -DominatorTreeBase::Node *DominatorTree::getNodeForBlock(BasicBlock *BB) { - Node *&BBNode = Nodes[BB]; +DominatorTreeBase::DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) { + DomTreeNode *&BBNode = DomTreeNodes[BB]; if (BBNode) return BBNode; // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. BasicBlock *IDom = getIDom(BB); - Node *IDomNode = getNodeForBlock(IDom); + DomTreeNode *IDomNode = getNodeForBlock(IDom); // Add a new tree node for this BasicBlock, and link it as a child of // IDomNode - return BBNode = IDomNode->addChild(new Node(BB, IDomNode)); + return BBNode = IDomNode->addChild(new DomTreeNode(BB, IDomNode)); } static std::ostream &operator<<(std::ostream &o, - const DominatorTreeBase::Node *Node) { + const DominatorTreeBase::DomTreeNode *Node) { if (Node->getBlock()) WriteAsOperand(o, Node->getBlock(), false); else @@ -350,10 +350,10 @@ return o << "\n"; } -static void PrintDomTree(const DominatorTreeBase::Node *N, std::ostream &o, +static void PrintDomTree(const DominatorTreeBase::DomTreeNode *N, std::ostream &o, unsigned Lev) { o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N; - for (DominatorTreeBase::Node::const_iterator I = N->begin(), E = N->end(); + for (DominatorTreeBase::DomTreeNode::const_iterator I = N->begin(), E = N->end(); I != E; ++I) PrintDomTree(*I, o, Lev+1); } @@ -387,19 +387,19 @@ class DFCalculateWorkObject { public: DFCalculateWorkObject(BasicBlock *B, BasicBlock *P, - const DominatorTree::Node *N, - const DominatorTree::Node *PN) - : currentBB(B), parentBB(P), Node(N), parentNode(PN) {} + const DominatorTree::DomTreeNode *N, + const DominatorTree::DomTreeNode *PN) + : currentBB(B), parentBB(P), DomTreeNode(N), parentNode(PN) {} BasicBlock *currentBB; BasicBlock *parentBB; - const DominatorTree::Node *Node; - const DominatorTree::Node *parentNode; + const DominatorTree::DomTreeNode *DomTreeNode; + const DominatorTree::DomTreeNode *parentNode; }; } const DominanceFrontier::DomSetType & DominanceFrontier::calculate(const DominatorTree &DT, - const DominatorTree::Node *Node) { + const DominatorTree::DomTreeNode *Node) { BasicBlock *BB = Node->getBlock(); DomSetType *Result = NULL; @@ -413,8 +413,8 @@ BasicBlock *currentBB = currentW->currentBB; BasicBlock *parentBB = currentW->parentBB; - const DominatorTree::Node *currentNode = currentW->Node; - const DominatorTree::Node *parentNode = currentW->parentNode; + const DominatorTree::DomTreeNode *currentNode = currentW->DomTreeNode; + const DominatorTree::DomTreeNode *parentNode = currentW->parentNode; assert (currentBB && "Invalid work object. Missing current Basic Block"); assert (currentNode && "Invalid work object. Missing current Node"); DomSetType &S = Frontiers[currentBB]; @@ -436,9 +436,9 @@ // Loop through and visit the nodes that Node immediately dominates (Node's // children in the IDomTree) bool visitChild = false; - for (DominatorTree::Node::const_iterator NI = currentNode->begin(), + for (DominatorTree::DomTreeNode::const_iterator NI = currentNode->begin(), NE = currentNode->end(); NI != NE; ++NI) { - DominatorTree::Node *IDominee = *NI; + DominatorTree::DomTreeNode *IDominee = *NI; BasicBlock *childBB = IDominee->getBlock(); if (visited.count(childBB) == 0) { workList.push_back(DFCalculateWorkObject(childBB, currentBB, @@ -927,7 +927,7 @@ // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. - DominatorTree::Node *node= getAnalysis().getNode(BB); + DominatorTree::DomTreeNode *node= getAnalysis().getNode(BB); // If we are unreachable, we may not have an immediate dominator. if (!node || !node->getIDom()) @@ -951,7 +951,7 @@ Function *F = Root->getParent(); // Loop over all of the reachable blocks in the function... for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { - DominatorTree::Node* node = DT.getNode(I); + DominatorTree::DomTreeNode* node = DT.getNode(I); if (node && node->getIDom()) { // Reachable block. BasicBlock* ImmDom = node->getIDom()->getBlock(); ETNode *&BBNode = Nodes[I]; From dpatel at apple.com Sun Jun 3 01:26:47 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 01:26:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp GCSE.cpp GVNPRE.cpp LICM.cpp PredicateSimplifier.cpp Message-ID: <200706030626.l536Qles011498@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.110 -> 1.111 GCSE.cpp updated: 1.57 -> 1.58 GVNPRE.cpp updated: 1.12 -> 1.13 LICM.cpp updated: 1.102 -> 1.103 PredicateSimplifier.cpp updated: 1.75 -> 1.76 --- Log message: s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g --- Diffs of the changes: (+26 -26) ADCE.cpp | 4 ++-- GCSE.cpp | 2 +- GVNPRE.cpp | 8 ++++---- LICM.cpp | 16 ++++++++-------- PredicateSimplifier.cpp | 22 +++++++++++----------- 5 files changed, 26 insertions(+), 26 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.110 llvm/lib/Transforms/Scalar/ADCE.cpp:1.111 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.110 Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Sun Jun 3 01:26:14 2007 @@ -387,8 +387,8 @@ // postdominator that is alive, and the last postdominator that is // dead... // - PostDominatorTree::Node *LastNode = DT[TI->getSuccessor(i)]; - PostDominatorTree::Node *NextNode = 0; + PostDominatorTree::DomTreeNode *LastNode = DT[TI->getSuccessor(i)]; + PostDominatorTree::DomTreeNode *NextNode = 0; if (LastNode) { NextNode = LastNode->getIDom(); Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.57 llvm/lib/Transforms/Scalar/GCSE.cpp:1.58 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.57 Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Sun Jun 3 01:26:14 2007 @@ -94,7 +94,7 @@ // Traverse the CFG of the function in dominator order, so that we see each // instruction after we see its operands. - for (df_iterator DI = df_begin(DT.getRootNode()), + for (df_iterator DI = df_begin(DT.getRootNode()), E = df_end(DT.getRootNode()); DI != E; ++DI) { BasicBlock *BB = DI->getBlock(); Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.12 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.13 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.12 Sun Jun 3 00:58:25 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Sun Jun 3 01:26:14 2007 @@ -87,7 +87,7 @@ // For a given block, calculate the generated expressions, temporaries, // and the AVAIL_OUT set void CalculateAvailOut(ValueTable& VN, std::set& MS, - DominatorTree::Node* DI, + DominatorTree::DomTreeNode* DI, std::set& currExps, std::set& currPhis, std::set& currTemps, @@ -262,7 +262,7 @@ } void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set& MS, - DominatorTree::Node* DI, + DominatorTree::DomTreeNode* DI, std::set& currExps, std::set& currPhis, std::set& currTemps, @@ -324,7 +324,7 @@ // First Phase of BuildSets - calculate AVAIL_OUT // Top-down walk of the dominator tree - for (df_iterator DI = df_begin(DT.getRootNode()), + for (df_iterator DI = df_begin(DT.getRootNode()), E = df_end(DT.getRootNode()); DI != E; ++DI) { // Get the sets to update for this block @@ -350,7 +350,7 @@ std::set anticOut; // Top-down walk of the postdominator tree - for (df_iterator PDI = + for (df_iterator PDI = df_begin(PDT.getRootNode()), E = df_end(DT.getRootNode()); PDI != E; ++PDI) { BasicBlock* BB = PDI->getBlock(); Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.102 llvm/lib/Transforms/Scalar/LICM.cpp:1.103 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.102 Fri Jun 1 17:15:31 2007 +++ llvm/lib/Transforms/Scalar/LICM.cpp Sun Jun 3 01:26:14 2007 @@ -107,7 +107,7 @@ /// visit uses before definitions, allowing us to sink a loop body in one /// pass without iteration. /// - void SinkRegion(DominatorTree::Node *N); + void SinkRegion(DominatorTree::DomTreeNode *N); /// HoistRegion - Walk the specified region of the CFG (defined by all /// blocks dominated by the specified block, and that are in the current @@ -115,7 +115,7 @@ /// visit definitions before uses, allowing us to hoist a loop body in one /// pass without iteration. /// - void HoistRegion(DominatorTree::Node *N); + void HoistRegion(DominatorTree::DomTreeNode *N); /// inSubLoop - Little predicate that returns true if the specified basic /// block is in a subloop of the current one, not the current one itself. @@ -140,8 +140,8 @@ if (BlockInLoop == LoopHeader) return true; - DominatorTree::Node *BlockInLoopNode = DT->getNode(BlockInLoop); - DominatorTree::Node *IDom = DT->getNode(ExitBlock); + DominatorTree::DomTreeNode *BlockInLoopNode = DT->getNode(BlockInLoop); + DominatorTree::DomTreeNode *IDom = DT->getNode(ExitBlock); // Because the exit block is not in the loop, we know we have to get _at // least_ its immediate dominator. @@ -281,7 +281,7 @@ /// uses before definitions, allowing us to sink a loop body in one pass without /// iteration. /// -void LICM::SinkRegion(DominatorTree::Node *N) { +void LICM::SinkRegion(DominatorTree::DomTreeNode *N) { assert(N != 0 && "Null dominator tree node?"); BasicBlock *BB = N->getBlock(); @@ -289,7 +289,7 @@ if (!CurLoop->contains(BB)) return; // We are processing blocks in reverse dfo, so process children first... - const std::vector &Children = N->getChildren(); + const std::vector &Children = N->getChildren(); for (unsigned i = 0, e = Children.size(); i != e; ++i) SinkRegion(Children[i]); @@ -318,7 +318,7 @@ /// first order w.r.t the DominatorTree. This allows us to visit definitions /// before uses, allowing us to hoist a loop body in one pass without iteration. /// -void LICM::HoistRegion(DominatorTree::Node *N) { +void LICM::HoistRegion(DominatorTree::DomTreeNode *N) { assert(N != 0 && "Null dominator tree node?"); BasicBlock *BB = N->getBlock(); @@ -340,7 +340,7 @@ hoist(I); } - const std::vector &Children = N->getChildren(); + const std::vector &Children = N->getChildren(); for (unsigned i = 0, e = Children.size(); i != e; ++i) HoistRegion(Children[i]); } Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.75 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.76 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.75 Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Sun Jun 3 01:26:14 2007 @@ -1986,7 +1986,7 @@ UnreachableBlocks UB; ValueRanges *VR; - std::vector WorkList; + std::vector WorkList; public: static char ID; // Pass identification, replacement for typeid @@ -2012,14 +2012,14 @@ class VISIBILITY_HIDDEN Forwards : public InstVisitor { friend class InstVisitor; PredicateSimplifier *PS; - DominatorTree::Node *DTNode; + DominatorTree::DomTreeNode *DTNode; public: InequalityGraph &IG; UnreachableBlocks &UB; ValueRanges &VR; - Forwards(PredicateSimplifier *PS, DominatorTree::Node *DTNode) + Forwards(PredicateSimplifier *PS, DominatorTree::DomTreeNode *DTNode) : PS(PS), DTNode(DTNode), IG(*PS->IG), UB(PS->UB), VR(*PS->VR) {} void visitTerminatorInst(TerminatorInst &TI); @@ -2040,19 +2040,19 @@ // Used by terminator instructions to proceed from the current basic // block to the next. Verifies that "current" dominates "next", // then calls visitBasicBlock. - void proceedToSuccessors(DominatorTree::Node *Current) { - for (DominatorTree::Node::iterator I = Current->begin(), + void proceedToSuccessors(DominatorTree::DomTreeNode *Current) { + for (DominatorTree::DomTreeNode::iterator I = Current->begin(), E = Current->end(); I != E; ++I) { WorkList.push_back(*I); } } - void proceedToSuccessor(DominatorTree::Node *Next) { + void proceedToSuccessor(DominatorTree::DomTreeNode *Next) { WorkList.push_back(Next); } // Visits each instruction in the basic block. - void visitBasicBlock(DominatorTree::Node *Node) { + void visitBasicBlock(DominatorTree::DomTreeNode *Node) { BasicBlock *BB = Node->getBlock(); ETNode *ET = Forest->getNodeForBlock(BB); DOUT << "Entering Basic Block: " << BB->getName() @@ -2064,7 +2064,7 @@ // Tries to simplify each Instruction and add new properties to // the PropertySet. - void visitInstruction(Instruction *I, DominatorTree::Node *DT, ETNode *ET) { + void visitInstruction(Instruction *I, DominatorTree::DomTreeNode *DT, ETNode *ET) { DOUT << "Considering instruction " << *I << "\n"; DEBUG(IG->dump()); @@ -2132,7 +2132,7 @@ WorkList.push_back(DT->getRootNode()); do { - DominatorTree::Node *DTNode = WorkList.back(); + DominatorTree::DomTreeNode *DTNode = WorkList.back(); WorkList.pop_back(); if (!UB.isDead(DTNode->getBlock())) visitBasicBlock(DTNode); } while (!WorkList.empty()); @@ -2164,7 +2164,7 @@ return; } - for (DominatorTree::Node::iterator I = DTNode->begin(), E = DTNode->end(); + for (DominatorTree::DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end(); I != E; ++I) { BasicBlock *Dest = (*I)->getBlock(); DOUT << "Branch thinking about %" << Dest->getName() @@ -2194,7 +2194,7 @@ // Set the EQProperty in each of the cases BBs, and the NEProperties // in the default BB. - for (DominatorTree::Node::iterator I = DTNode->begin(), E = DTNode->end(); + for (DominatorTree::DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end(); I != E; ++I) { BasicBlock *BB = (*I)->getBlock(); DOUT << "Switch thinking about BB %" << BB->getName() From dpatel at apple.com Sun Jun 3 01:26:48 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 01:26:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp LCSSA.cpp LoopSimplify.cpp Message-ID: <200706030626.l536Qm9N011507@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.48 -> 1.49 LCSSA.cpp updated: 1.43 -> 1.44 LoopSimplify.cpp updated: 1.96 -> 1.97 --- Log message: s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g --- Diffs of the changes: (+15 -15) BreakCriticalEdges.cpp | 8 ++++---- LCSSA.cpp | 16 ++++++++-------- LoopSimplify.cpp | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.48 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.49 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.48 Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Sun Jun 3 01:26:14 2007 @@ -203,20 +203,20 @@ // Should we update DominatorTree information? if (DominatorTree *DT = P->getAnalysisToUpdate()) { - DominatorTree::Node *TINode = DT->getNode(TIBB); + DominatorTree::DomTreeNode *TINode = DT->getNode(TIBB); // The new block is not the immediate dominator for any other nodes, but // TINode is the immediate dominator for the new node. // if (TINode) { // Don't break unreachable code! - DominatorTree::Node *NewBBNode = DT->createNewNode(NewBB, TINode); - DominatorTree::Node *DestBBNode = 0; + DominatorTree::DomTreeNode *NewBBNode = DT->createNewNode(NewBB, TINode); + DominatorTree::DomTreeNode *DestBBNode = 0; // If NewBBDominatesDestBB hasn't been computed yet, do so with DT. if (!OtherPreds.empty()) { DestBBNode = DT->getNode(DestBB); while (!OtherPreds.empty() && NewBBDominatesDestBB) { - if (DominatorTree::Node *OPNode = DT->getNode(OtherPreds.back())) + if (DominatorTree::DomTreeNode *OPNode = DT->getNode(OtherPreds.back())) NewBBDominatesDestBB = DestBBNode->dominates(OPNode); OtherPreds.pop_back(); } Index: llvm/lib/Transforms/Utils/LCSSA.cpp diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.43 llvm/lib/Transforms/Utils/LCSSA.cpp:1.44 --- llvm/lib/Transforms/Utils/LCSSA.cpp:1.43 Fri May 11 16:10:54 2007 +++ llvm/lib/Transforms/Utils/LCSSA.cpp Sun Jun 3 01:26:14 2007 @@ -75,8 +75,8 @@ void getLoopValuesUsedOutsideLoop(Loop *L, SetVector &AffectedValues); - Value *GetValueForBlock(DominatorTree::Node *BB, Instruction *OrigInst, - std::map &Phis); + Value *GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *OrigInst, + std::map &Phis); /// inLoop - returns true if the given block is within the current loop const bool inLoop(BasicBlock* B) { @@ -146,16 +146,16 @@ ++NumLCSSA; // We are applying the transformation // Keep track of the blocks that have the value available already. - std::map Phis; + std::map Phis; - DominatorTree::Node *InstrNode = DT->getNode(Instr->getParent()); + DominatorTree::DomTreeNode *InstrNode = DT->getNode(Instr->getParent()); // Insert the LCSSA phi's into the exit blocks (dominated by the value), and // add them to the Phi's map. for (std::vector::const_iterator BBI = exitBlocks.begin(), BBE = exitBlocks.end(); BBI != BBE; ++BBI) { BasicBlock *BB = *BBI; - DominatorTree::Node *ExitBBNode = DT->getNode(BB); + DominatorTree::DomTreeNode *ExitBBNode = DT->getNode(BB); Value *&Phi = Phis[ExitBBNode]; if (!Phi && InstrNode->dominates(ExitBBNode)) { PHINode *PN = new PHINode(Instr->getType(), Instr->getName()+".lcssa", @@ -229,8 +229,8 @@ /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. -Value *LCSSA::GetValueForBlock(DominatorTree::Node *BB, Instruction *OrigInst, - std::map &Phis) { +Value *LCSSA::GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *OrigInst, + std::map &Phis) { // If there is no dominator info for this BB, it is unreachable. if (BB == 0) return UndefValue::get(OrigInst->getType()); @@ -239,7 +239,7 @@ Value *&V = Phis[BB]; if (V) return V; - DominatorTree::Node *IDom = BB->getIDom(); + DominatorTree::DomTreeNode *IDom = BB->getIDom(); // Otherwise, there are two cases: we either have to insert a PHI node or we // don't. We need to insert a PHI node if this block is not dominated by one Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.96 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.97 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.96 Sun May 6 08:37:16 2007 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Sun Jun 3 01:26:14 2007 @@ -778,15 +778,15 @@ } assert(NewBBIDom && "No immediate dominator found??"); } - DominatorTree::Node *NewBBIDomNode = DT->getNode(NewBBIDom); + DominatorTree::DomTreeNode *NewBBIDomNode = DT->getNode(NewBBIDom); // Create the new dominator tree node... and set the idom of NewBB. - DominatorTree::Node *NewBBNode = DT->createNewNode(NewBB, NewBBIDomNode); + DominatorTree::DomTreeNode *NewBBNode = DT->createNewNode(NewBB, NewBBIDomNode); // If NewBB strictly dominates other blocks, then it is now the immediate // dominator of NewBBSucc. Update the dominator tree as appropriate. if (NewBBDominatesNewBBSucc) { - DominatorTree::Node *NewBBSuccNode = DT->getNode(NewBBSucc); + DominatorTree::DomTreeNode *NewBBSuccNode = DT->getNode(NewBBSucc); DT->changeImmediateDominator(NewBBSuccNode, NewBBNode); } } From asl at math.spbu.ru Sun Jun 3 14:18:02 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 3 Jun 2007 14:18:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200706031918.l53JI2G6026406@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.115 -> 1.116 --- Log message: Check arguments & return types of main(). Abort in case of no match. --- Diffs of the changes: (+32 -0) ExecutionEngine.cpp | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.115 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.116 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.115 Thu May 24 10:03:18 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Sun Jun 3 14:17:35 2007 @@ -231,7 +231,39 @@ std::vector GVArgs; GenericValue GVArgc; GVArgc.IntVal = APInt(32, argv.size()); + + // Check main() type unsigned NumArgs = Fn->getFunctionType()->getNumParams(); + const FunctionType *FTy = Fn->getFunctionType(); + const Type* PPInt8Ty = PointerType::get(PointerType::get(Type::Int8Ty)); + switch (NumArgs) { + case 3: + if (FTy->getParamType(2) != PPInt8Ty) { + cerr << "Invalid type for third argument of main() supplied\n"; + abort(); + } + case 2: + if (FTy->getParamType(1) != PPInt8Ty) { + cerr << "Invalid type for second argument of main() supplied\n"; + abort(); + } + case 1: + if (FTy->getParamType(0) != Type::Int32Ty) { + cerr << "Invalid type for first argument of main() supplied\n"; + abort(); + } + case 0: + if (FTy->getReturnType() != Type::Int32Ty && + FTy->getReturnType() != Type::VoidTy) { + cerr << "Invalid return type of main() supplied\n"; + abort(); + } + break; + default: + cerr << "Invalid number of arguments of main() supplied\n"; + abort(); + } + if (NumArgs) { GVArgs.push_back(GVArgc); // Arg #0 = argc. if (NumArgs > 1) { From asl at math.spbu.ru Sun Jun 3 14:21:11 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 3 Jun 2007 14:21:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200706031921.l53JLBeW026543@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.116 -> 1.117 --- Log message: Add comments to fallsthrough cases. Also, this fixes PR1492: http://llvm.org/PR1492 --- Diffs of the changes: (+3 -0) ExecutionEngine.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.116 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.117 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.116 Sun Jun 3 14:17:35 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Sun Jun 3 14:20:49 2007 @@ -242,16 +242,19 @@ cerr << "Invalid type for third argument of main() supplied\n"; abort(); } + // FALLS THROUGH case 2: if (FTy->getParamType(1) != PPInt8Ty) { cerr << "Invalid type for second argument of main() supplied\n"; abort(); } + // FALLS THROUGH case 1: if (FTy->getParamType(0) != Type::Int32Ty) { cerr << "Invalid type for first argument of main() supplied\n"; abort(); } + // FALLS THROUGH case 0: if (FTy->getReturnType() != Type::Int32Ty && FTy->getReturnType() != Type::VoidTy) { From resistor at mac.com Sun Jun 3 17:02:36 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 3 Jun 2007 17:02:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp Message-ID: <200706032202.l53M2aOq030352@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GVNPRE.cpp updated: 1.13 -> 1.14 --- Log message: Don't use the custom comparator where it's not necessary. --- Diffs of the changes: (+22 -13) GVNPRE.cpp | 35 ++++++++++++++++++++++------------- 1 files changed, 22 insertions(+), 13 deletions(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.13 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.14 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.13 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Sun Jun 3 17:02:14 2007 @@ -73,7 +73,8 @@ // Helper fuctions // FIXME: eliminate or document these better - void dump(ValueTable& VN, std::set& s); + void dump(ValueTable& VN, std::set& s); + void dump_unique(ValueTable& VN, std::set& s); void clean(ValueTable VN, std::set& set); bool add(ValueTable& VN, std::set& MS, Value* V); Value* find_leader(ValueTable VN, std::set& vals, uint32_t v); @@ -90,7 +91,7 @@ DominatorTree::DomTreeNode* DI, std::set& currExps, std::set& currPhis, - std::set& currTemps, + std::set& currTemps, std::set& currAvail, std::map > availOut); @@ -250,11 +251,19 @@ } } -void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { - std::vector sorted; - topo_sort(VN, s, sorted); + +void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set& s) { DOUT << "{ "; - for (std::vector::iterator I = sorted.begin(), E = sorted.end(); + for (std::set::iterator I = s.begin(), E = s.end(); + I != E; ++I) { + DEBUG((*I)->dump()); + } + DOUT << "}\n\n"; +} + +void GVNPRE::dump_unique(GVNPRE::ValueTable& VN, std::set& s) { + DOUT << "{ "; + for (std::set::iterator I = s.begin(), E = s.end(); I != E; ++I) { DEBUG((*I)->dump()); } @@ -265,7 +274,7 @@ DominatorTree::DomTreeNode* DI, std::set& currExps, std::set& currPhis, - std::set& currTemps, + std::set& currTemps, std::set& currAvail, std::map > availOut) { @@ -297,7 +306,7 @@ currExps.insert(BO); currTemps.insert(BO); - + // Handle unsupported ops } else if (!BI->isTerminator()){ add(VN, MS, BI); @@ -315,7 +324,7 @@ std::map > generatedExpressions; std::map > generatedPhis; - std::map > generatedTemporaries; + std::map > generatedTemporaries; std::map > availableOut; std::map > anticipatedIn; @@ -330,7 +339,7 @@ // Get the sets to update for this block std::set& currExps = generatedExpressions[DI->getBlock()]; std::set& currPhis = generatedPhis[DI->getBlock()]; - std::set& currTemps = generatedTemporaries[DI->getBlock()]; + std::set& currTemps = generatedTemporaries[DI->getBlock()]; std::set& currAvail = availableOut[DI->getBlock()]; CalculateAvailOut(VN, maximalSet, *DI, currExps, currPhis, @@ -423,15 +432,15 @@ DOUT << "\n"; DOUT << "EXP_GEN: "; - dump(VN, generatedExpressions[I]); + dump_unique(VN, generatedExpressions[I]); DOUT << "\n"; DOUT << "ANTIC_IN: "; - dump(VN, anticipatedIn[I]); + dump_unique(VN, anticipatedIn[I]); DOUT << "\n"; DOUT << "AVAIL_OUT: "; - dump(VN, availableOut[I]); + dump_unique(VN, availableOut[I]); DOUT << "\n"; } From dpatel at apple.com Sun Jun 3 19:32:44 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 19:32:44 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h PostDominators.h Message-ID: <200706040032.l540WiqP000762@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Dominators.h updated: 1.84 -> 1.85 PostDominators.h updated: 1.22 -> 1.23 --- Log message: s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g --- Diffs of the changes: (+57 -53) Dominators.h | 106 ++++++++++++++++++++++++++++--------------------------- PostDominators.h | 4 +- 2 files changed, 57 insertions(+), 53 deletions(-) Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.84 llvm/include/llvm/Analysis/Dominators.h:1.85 --- llvm/include/llvm/Analysis/Dominators.h:1.84 Sun Jun 3 01:26:14 2007 +++ llvm/include/llvm/Analysis/Dominators.h Sun Jun 3 19:32:21 2007 @@ -56,12 +56,61 @@ bool isPostDominator() const { return IsPostDominators; } }; + +//===----------------------------------------------------------------------===// +// DomTreeNode - Dominator Tree Node + +class DomTreeNode { + friend class DominatorTree; + friend struct PostDominatorTree; + friend class DominatorTreeBase; + BasicBlock *TheBB; + DomTreeNode *IDom; + std::vector Children; +public: + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + + iterator begin() { return Children.begin(); } + iterator end() { return Children.end(); } + const_iterator begin() const { return Children.begin(); } + const_iterator end() const { return Children.end(); } + + inline BasicBlock *getBlock() const { return TheBB; } + inline DomTreeNode *getIDom() const { return IDom; } + inline const std::vector &getChildren() const { return Children; } + + /// properlyDominates - Returns true iff this dominates N and this != N. + /// Note that this is not a constant time operation! + /// + bool properlyDominates(const DomTreeNode *N) const { + const DomTreeNode *IDom; + if (this == 0 || N == 0) return false; + while ((IDom = N->getIDom()) != 0 && IDom != this) + N = IDom; // Walk up the tree + return IDom != 0; + } + + /// dominates - Returns true iff this dominates N. Note that this is not a + /// constant time operation! + /// + inline bool dominates(const DomTreeNode *N) const { + if (N == this) return true; // A node trivially dominates itself. + return properlyDominates(N); + } + +private: + inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {} + inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; } + + void setIDom(DomTreeNode *NewIDom); +}; + //===----------------------------------------------------------------------===// /// DominatorTree - Calculate the immediate dominator tree for a function. /// class DominatorTreeBase : public DominatorBase { public: - class DomTreeNode; protected: std::map DomTreeNodes; void reset(); @@ -88,52 +137,6 @@ std::map Info; public: - class DomTreeNode { - friend class DominatorTree; - friend struct PostDominatorTree; - friend class DominatorTreeBase; - BasicBlock *TheBB; - DomTreeNode *IDom; - std::vector Children; - public: - typedef std::vector::iterator iterator; - typedef std::vector::const_iterator const_iterator; - - iterator begin() { return Children.begin(); } - iterator end() { return Children.end(); } - const_iterator begin() const { return Children.begin(); } - const_iterator end() const { return Children.end(); } - - inline BasicBlock *getBlock() const { return TheBB; } - inline DomTreeNode *getIDom() const { return IDom; } - inline const std::vector &getChildren() const { return Children; } - - /// properlyDominates - Returns true iff this dominates N and this != N. - /// Note that this is not a constant time operation! - /// - bool properlyDominates(const DomTreeNode *N) const { - const DomTreeNode *IDom; - if (this == 0 || N == 0) return false; - while ((IDom = N->getIDom()) != 0 && IDom != this) - N = IDom; // Walk up the tree - return IDom != 0; - } - - /// dominates - Returns true iff this dominates N. Note that this is not a - /// constant time operation! - /// - inline bool dominates(const DomTreeNode *N) const { - if (N == this) return true; // A node trivially dominates itself. - return properlyDominates(N); - } - - private: - inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {} - inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; } - - void setIDom(DomTreeNode *NewIDom); - }; - public: DominatorTreeBase(intptr_t ID, bool isPostDom) : DominatorBase(ID, isPostDom) {} @@ -238,8 +241,8 @@ /// DominatorTree GraphTraits specialization so the DominatorTree can be /// iterable by generic graph iterators. /// -template <> struct GraphTraits { - typedef DominatorTree::DomTreeNode NodeType; +template <> struct GraphTraits { + typedef DomTreeNode NodeType; typedef NodeType::iterator ChildIteratorType; static NodeType *getEntryNode(NodeType *N) { @@ -254,7 +257,7 @@ }; template <> struct GraphTraits - : public GraphTraits { + : public GraphTraits { static NodeType *getEntryNode(DominatorTree *DT) { return DT->getRootNode(); } @@ -501,9 +504,10 @@ AU.setPreservesAll(); AU.addRequired(); } + private: const DomSetType &calculate(const DominatorTree &DT, - const DominatorTree::DomTreeNode *Node); + const DomTreeNode *Node); }; Index: llvm/include/llvm/Analysis/PostDominators.h diff -u llvm/include/llvm/Analysis/PostDominators.h:1.22 llvm/include/llvm/Analysis/PostDominators.h:1.23 --- llvm/include/llvm/Analysis/PostDominators.h:1.22 Sun Jun 3 01:26:14 2007 +++ llvm/include/llvm/Analysis/PostDominators.h Sun Jun 3 19:32:21 2007 @@ -87,7 +87,7 @@ Frontiers.clear(); PostDominatorTree &DT = getAnalysis(); Roots = DT.getRoots(); - if (const DominatorTree::DomTreeNode *Root = DT.getRootNode()) + if (const DomTreeNode *Root = DT.getRootNode()) calculate(DT, Root); return false; } @@ -99,7 +99,7 @@ private: const DomSetType &calculate(const PostDominatorTree &DT, - const DominatorTree::DomTreeNode *Node); + const DomTreeNode *Node); }; } // End llvm namespace From dpatel at apple.com Sun Jun 3 19:32:51 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 19:32:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp Message-ID: <200706040032.l540Wplh000768@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: PostDominators.cpp updated: 1.71 -> 1.72 --- Log message: s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g --- Diffs of the changes: (+7 -7) PostDominators.cpp | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/Analysis/PostDominators.cpp diff -u llvm/lib/Analysis/PostDominators.cpp:1.71 llvm/lib/Analysis/PostDominators.cpp:1.72 --- llvm/lib/Analysis/PostDominators.cpp:1.71 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Analysis/PostDominators.cpp Sun Jun 3 19:32:21 2007 @@ -188,7 +188,7 @@ } -DominatorTreeBase::DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) { +DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) { DomTreeNode *&BBNode = DomTreeNodes[BB]; if (BBNode) return BBNode; @@ -215,7 +215,7 @@ // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. - PostDominatorTree::DomTreeNode *node = getAnalysis().getNode(BB); + DomTreeNode *node = getAnalysis().getNode(BB); // If we are unreachable, we may not have an immediate dominator. if (!node) @@ -245,7 +245,7 @@ ETNode *&BBNode = Nodes[BB]; if (!BBNode) { ETNode *IDomNode = NULL; - PostDominatorTree::DomTreeNode *node = DT.getNode(BB); + DomTreeNode *node = DT.getNode(BB); if (node && node->getIDom()) IDomNode = getNodeForBlock(node->getIDom()->getBlock()); @@ -277,7 +277,7 @@ const DominanceFrontier::DomSetType & PostDominanceFrontier::calculate(const PostDominatorTree &DT, - const DominatorTree::DomTreeNode *Node) { + const DomTreeNode *Node) { // Loop over CFG successors to calculate DFlocal[Node] BasicBlock *BB = Node->getBlock(); DomSetType &S = Frontiers[BB]; // The new set to fill in... @@ -287,7 +287,7 @@ for (pred_iterator SI = pred_begin(BB), SE = pred_end(BB); SI != SE; ++SI) { // Does Node immediately dominate this predecessor? - DominatorTree::DomTreeNode *SINode = DT[*SI]; + DomTreeNode *SINode = DT[*SI]; if (SINode && SINode->getIDom() != Node) S.insert(*SI); } @@ -296,9 +296,9 @@ // Loop through and visit the nodes that Node immediately dominates (Node's // children in the IDomTree) // - for (PostDominatorTree::DomTreeNode::const_iterator + for (DomTreeNode::const_iterator NI = Node->begin(), NE = Node->end(); NI != NE; ++NI) { - DominatorTree::DomTreeNode *IDominee = *NI; + DomTreeNode *IDominee = *NI; const DomSetType &ChildDF = calculate(DT, IDominee); DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end(); From dpatel at apple.com Sun Jun 3 19:32:51 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 19:32:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp LCSSA.cpp LoopSimplify.cpp Message-ID: <200706040032.l540Wpsb000777@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.49 -> 1.50 LCSSA.cpp updated: 1.44 -> 1.45 LoopSimplify.cpp updated: 1.97 -> 1.98 --- Log message: s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g --- Diffs of the changes: (+15 -15) BreakCriticalEdges.cpp | 8 ++++---- LCSSA.cpp | 16 ++++++++-------- LoopSimplify.cpp | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.49 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.50 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.49 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Sun Jun 3 19:32:22 2007 @@ -203,20 +203,20 @@ // Should we update DominatorTree information? if (DominatorTree *DT = P->getAnalysisToUpdate()) { - DominatorTree::DomTreeNode *TINode = DT->getNode(TIBB); + DomTreeNode *TINode = DT->getNode(TIBB); // The new block is not the immediate dominator for any other nodes, but // TINode is the immediate dominator for the new node. // if (TINode) { // Don't break unreachable code! - DominatorTree::DomTreeNode *NewBBNode = DT->createNewNode(NewBB, TINode); - DominatorTree::DomTreeNode *DestBBNode = 0; + DomTreeNode *NewBBNode = DT->createNewNode(NewBB, TINode); + DomTreeNode *DestBBNode = 0; // If NewBBDominatesDestBB hasn't been computed yet, do so with DT. if (!OtherPreds.empty()) { DestBBNode = DT->getNode(DestBB); while (!OtherPreds.empty() && NewBBDominatesDestBB) { - if (DominatorTree::DomTreeNode *OPNode = DT->getNode(OtherPreds.back())) + if (DomTreeNode *OPNode = DT->getNode(OtherPreds.back())) NewBBDominatesDestBB = DestBBNode->dominates(OPNode); OtherPreds.pop_back(); } Index: llvm/lib/Transforms/Utils/LCSSA.cpp diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.44 llvm/lib/Transforms/Utils/LCSSA.cpp:1.45 --- llvm/lib/Transforms/Utils/LCSSA.cpp:1.44 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Utils/LCSSA.cpp Sun Jun 3 19:32:22 2007 @@ -75,8 +75,8 @@ void getLoopValuesUsedOutsideLoop(Loop *L, SetVector &AffectedValues); - Value *GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *OrigInst, - std::map &Phis); + Value *GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst, + std::map &Phis); /// inLoop - returns true if the given block is within the current loop const bool inLoop(BasicBlock* B) { @@ -146,16 +146,16 @@ ++NumLCSSA; // We are applying the transformation // Keep track of the blocks that have the value available already. - std::map Phis; + std::map Phis; - DominatorTree::DomTreeNode *InstrNode = DT->getNode(Instr->getParent()); + DomTreeNode *InstrNode = DT->getNode(Instr->getParent()); // Insert the LCSSA phi's into the exit blocks (dominated by the value), and // add them to the Phi's map. for (std::vector::const_iterator BBI = exitBlocks.begin(), BBE = exitBlocks.end(); BBI != BBE; ++BBI) { BasicBlock *BB = *BBI; - DominatorTree::DomTreeNode *ExitBBNode = DT->getNode(BB); + DomTreeNode *ExitBBNode = DT->getNode(BB); Value *&Phi = Phis[ExitBBNode]; if (!Phi && InstrNode->dominates(ExitBBNode)) { PHINode *PN = new PHINode(Instr->getType(), Instr->getName()+".lcssa", @@ -229,8 +229,8 @@ /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. -Value *LCSSA::GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *OrigInst, - std::map &Phis) { +Value *LCSSA::GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst, + std::map &Phis) { // If there is no dominator info for this BB, it is unreachable. if (BB == 0) return UndefValue::get(OrigInst->getType()); @@ -239,7 +239,7 @@ Value *&V = Phis[BB]; if (V) return V; - DominatorTree::DomTreeNode *IDom = BB->getIDom(); + DomTreeNode *IDom = BB->getIDom(); // Otherwise, there are two cases: we either have to insert a PHI node or we // don't. We need to insert a PHI node if this block is not dominated by one Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.97 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.98 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.97 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Sun Jun 3 19:32:22 2007 @@ -778,15 +778,15 @@ } assert(NewBBIDom && "No immediate dominator found??"); } - DominatorTree::DomTreeNode *NewBBIDomNode = DT->getNode(NewBBIDom); + DomTreeNode *NewBBIDomNode = DT->getNode(NewBBIDom); // Create the new dominator tree node... and set the idom of NewBB. - DominatorTree::DomTreeNode *NewBBNode = DT->createNewNode(NewBB, NewBBIDomNode); + DomTreeNode *NewBBNode = DT->createNewNode(NewBB, NewBBIDomNode); // If NewBB strictly dominates other blocks, then it is now the immediate // dominator of NewBBSucc. Update the dominator tree as appropriate. if (NewBBDominatesNewBBSucc) { - DominatorTree::DomTreeNode *NewBBSuccNode = DT->getNode(NewBBSucc); + DomTreeNode *NewBBSuccNode = DT->getNode(NewBBSucc); DT->changeImmediateDominator(NewBBSuccNode, NewBBNode); } } From dpatel at apple.com Sun Jun 3 19:32:54 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 19:32:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp GCSE.cpp GVNPRE.cpp LICM.cpp PredicateSimplifier.cpp Message-ID: <200706040032.l540WsEK000791@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.111 -> 1.112 GCSE.cpp updated: 1.58 -> 1.59 GVNPRE.cpp updated: 1.14 -> 1.15 LICM.cpp updated: 1.103 -> 1.104 PredicateSimplifier.cpp updated: 1.76 -> 1.77 --- Log message: s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g --- Diffs of the changes: (+26 -26) ADCE.cpp | 4 ++-- GCSE.cpp | 2 +- GVNPRE.cpp | 8 ++++---- LICM.cpp | 16 ++++++++-------- PredicateSimplifier.cpp | 22 +++++++++++----------- 5 files changed, 26 insertions(+), 26 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.111 llvm/lib/Transforms/Scalar/ADCE.cpp:1.112 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.111 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Sun Jun 3 19:32:21 2007 @@ -387,8 +387,8 @@ // postdominator that is alive, and the last postdominator that is // dead... // - PostDominatorTree::DomTreeNode *LastNode = DT[TI->getSuccessor(i)]; - PostDominatorTree::DomTreeNode *NextNode = 0; + DomTreeNode *LastNode = DT[TI->getSuccessor(i)]; + DomTreeNode *NextNode = 0; if (LastNode) { NextNode = LastNode->getIDom(); Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.58 llvm/lib/Transforms/Scalar/GCSE.cpp:1.59 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.58 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Sun Jun 3 19:32:21 2007 @@ -94,7 +94,7 @@ // Traverse the CFG of the function in dominator order, so that we see each // instruction after we see its operands. - for (df_iterator DI = df_begin(DT.getRootNode()), + for (df_iterator DI = df_begin(DT.getRootNode()), E = df_end(DT.getRootNode()); DI != E; ++DI) { BasicBlock *BB = DI->getBlock(); Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.14 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.15 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.14 Sun Jun 3 17:02:14 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Sun Jun 3 19:32:21 2007 @@ -88,7 +88,7 @@ // For a given block, calculate the generated expressions, temporaries, // and the AVAIL_OUT set void CalculateAvailOut(ValueTable& VN, std::set& MS, - DominatorTree::DomTreeNode* DI, + DomTreeNode* DI, std::set& currExps, std::set& currPhis, std::set& currTemps, @@ -271,7 +271,7 @@ } void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set& MS, - DominatorTree::DomTreeNode* DI, + DomTreeNode* DI, std::set& currExps, std::set& currPhis, std::set& currTemps, @@ -333,7 +333,7 @@ // First Phase of BuildSets - calculate AVAIL_OUT // Top-down walk of the dominator tree - for (df_iterator DI = df_begin(DT.getRootNode()), + for (df_iterator DI = df_begin(DT.getRootNode()), E = df_end(DT.getRootNode()); DI != E; ++DI) { // Get the sets to update for this block @@ -359,7 +359,7 @@ std::set anticOut; // Top-down walk of the postdominator tree - for (df_iterator PDI = + for (df_iterator PDI = df_begin(PDT.getRootNode()), E = df_end(DT.getRootNode()); PDI != E; ++PDI) { BasicBlock* BB = PDI->getBlock(); Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.103 llvm/lib/Transforms/Scalar/LICM.cpp:1.104 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.103 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Scalar/LICM.cpp Sun Jun 3 19:32:21 2007 @@ -107,7 +107,7 @@ /// visit uses before definitions, allowing us to sink a loop body in one /// pass without iteration. /// - void SinkRegion(DominatorTree::DomTreeNode *N); + void SinkRegion(DomTreeNode *N); /// HoistRegion - Walk the specified region of the CFG (defined by all /// blocks dominated by the specified block, and that are in the current @@ -115,7 +115,7 @@ /// visit definitions before uses, allowing us to hoist a loop body in one /// pass without iteration. /// - void HoistRegion(DominatorTree::DomTreeNode *N); + void HoistRegion(DomTreeNode *N); /// inSubLoop - Little predicate that returns true if the specified basic /// block is in a subloop of the current one, not the current one itself. @@ -140,8 +140,8 @@ if (BlockInLoop == LoopHeader) return true; - DominatorTree::DomTreeNode *BlockInLoopNode = DT->getNode(BlockInLoop); - DominatorTree::DomTreeNode *IDom = DT->getNode(ExitBlock); + DomTreeNode *BlockInLoopNode = DT->getNode(BlockInLoop); + DomTreeNode *IDom = DT->getNode(ExitBlock); // Because the exit block is not in the loop, we know we have to get _at // least_ its immediate dominator. @@ -281,7 +281,7 @@ /// uses before definitions, allowing us to sink a loop body in one pass without /// iteration. /// -void LICM::SinkRegion(DominatorTree::DomTreeNode *N) { +void LICM::SinkRegion(DomTreeNode *N) { assert(N != 0 && "Null dominator tree node?"); BasicBlock *BB = N->getBlock(); @@ -289,7 +289,7 @@ if (!CurLoop->contains(BB)) return; // We are processing blocks in reverse dfo, so process children first... - const std::vector &Children = N->getChildren(); + const std::vector &Children = N->getChildren(); for (unsigned i = 0, e = Children.size(); i != e; ++i) SinkRegion(Children[i]); @@ -318,7 +318,7 @@ /// first order w.r.t the DominatorTree. This allows us to visit definitions /// before uses, allowing us to hoist a loop body in one pass without iteration. /// -void LICM::HoistRegion(DominatorTree::DomTreeNode *N) { +void LICM::HoistRegion(DomTreeNode *N) { assert(N != 0 && "Null dominator tree node?"); BasicBlock *BB = N->getBlock(); @@ -340,7 +340,7 @@ hoist(I); } - const std::vector &Children = N->getChildren(); + const std::vector &Children = N->getChildren(); for (unsigned i = 0, e = Children.size(); i != e; ++i) HoistRegion(Children[i]); } Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.76 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.77 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.76 Sun Jun 3 01:26:14 2007 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Sun Jun 3 19:32:21 2007 @@ -1986,7 +1986,7 @@ UnreachableBlocks UB; ValueRanges *VR; - std::vector WorkList; + std::vector WorkList; public: static char ID; // Pass identification, replacement for typeid @@ -2012,14 +2012,14 @@ class VISIBILITY_HIDDEN Forwards : public InstVisitor { friend class InstVisitor; PredicateSimplifier *PS; - DominatorTree::DomTreeNode *DTNode; + DomTreeNode *DTNode; public: InequalityGraph &IG; UnreachableBlocks &UB; ValueRanges &VR; - Forwards(PredicateSimplifier *PS, DominatorTree::DomTreeNode *DTNode) + Forwards(PredicateSimplifier *PS, DomTreeNode *DTNode) : PS(PS), DTNode(DTNode), IG(*PS->IG), UB(PS->UB), VR(*PS->VR) {} void visitTerminatorInst(TerminatorInst &TI); @@ -2040,19 +2040,19 @@ // Used by terminator instructions to proceed from the current basic // block to the next. Verifies that "current" dominates "next", // then calls visitBasicBlock. - void proceedToSuccessors(DominatorTree::DomTreeNode *Current) { - for (DominatorTree::DomTreeNode::iterator I = Current->begin(), + void proceedToSuccessors(DomTreeNode *Current) { + for (DomTreeNode::iterator I = Current->begin(), E = Current->end(); I != E; ++I) { WorkList.push_back(*I); } } - void proceedToSuccessor(DominatorTree::DomTreeNode *Next) { + void proceedToSuccessor(DomTreeNode *Next) { WorkList.push_back(Next); } // Visits each instruction in the basic block. - void visitBasicBlock(DominatorTree::DomTreeNode *Node) { + void visitBasicBlock(DomTreeNode *Node) { BasicBlock *BB = Node->getBlock(); ETNode *ET = Forest->getNodeForBlock(BB); DOUT << "Entering Basic Block: " << BB->getName() @@ -2064,7 +2064,7 @@ // Tries to simplify each Instruction and add new properties to // the PropertySet. - void visitInstruction(Instruction *I, DominatorTree::DomTreeNode *DT, ETNode *ET) { + void visitInstruction(Instruction *I, DomTreeNode *DT, ETNode *ET) { DOUT << "Considering instruction " << *I << "\n"; DEBUG(IG->dump()); @@ -2132,7 +2132,7 @@ WorkList.push_back(DT->getRootNode()); do { - DominatorTree::DomTreeNode *DTNode = WorkList.back(); + DomTreeNode *DTNode = WorkList.back(); WorkList.pop_back(); if (!UB.isDead(DTNode->getBlock())) visitBasicBlock(DTNode); } while (!WorkList.empty()); @@ -2164,7 +2164,7 @@ return; } - for (DominatorTree::DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end(); + for (DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end(); I != E; ++I) { BasicBlock *Dest = (*I)->getBlock(); DOUT << "Branch thinking about %" << Dest->getName() @@ -2194,7 +2194,7 @@ // Set the EQProperty in each of the cases BBs, and the NEProperties // in the default BB. - for (DominatorTree::DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end(); + for (DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end(); I != E; ++I) { BasicBlock *BB = (*I)->getBlock(); DOUT << "Switch thinking about BB %" << BB->getName() From dpatel at apple.com Sun Jun 3 19:32:54 2007 From: dpatel at apple.com (Devang Patel) Date: Sun, 3 Jun 2007 19:32:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp Message-ID: <200706040032.l540WsBT000796@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Dominators.cpp updated: 1.103 -> 1.104 --- Log message: s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g --- Diffs of the changes: (+17 -17) Dominators.cpp | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) Index: llvm/lib/VMCore/Dominators.cpp diff -u llvm/lib/VMCore/Dominators.cpp:1.103 llvm/lib/VMCore/Dominators.cpp:1.104 --- llvm/lib/VMCore/Dominators.cpp:1.103 Sun Jun 3 01:26:14 2007 +++ llvm/lib/VMCore/Dominators.cpp Sun Jun 3 19:32:22 2007 @@ -311,7 +311,7 @@ RootNode = 0; } -void DominatorTreeBase::DomTreeNode::setIDom(DomTreeNode *NewIDom) { +void DomTreeNode::setIDom(DomTreeNode *NewIDom) { assert(IDom && "No immediate dominator?"); if (IDom != NewIDom) { std::vector::iterator I = @@ -327,7 +327,7 @@ } } -DominatorTreeBase::DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) { +DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) { DomTreeNode *&BBNode = DomTreeNodes[BB]; if (BBNode) return BBNode; @@ -342,7 +342,7 @@ } static std::ostream &operator<<(std::ostream &o, - const DominatorTreeBase::DomTreeNode *Node) { + const DomTreeNode *Node) { if (Node->getBlock()) WriteAsOperand(o, Node->getBlock(), false); else @@ -350,10 +350,10 @@ return o << "\n"; } -static void PrintDomTree(const DominatorTreeBase::DomTreeNode *N, std::ostream &o, +static void PrintDomTree(const DomTreeNode *N, std::ostream &o, unsigned Lev) { o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N; - for (DominatorTreeBase::DomTreeNode::const_iterator I = N->begin(), E = N->end(); + for (DomTreeNode::const_iterator I = N->begin(), E = N->end(); I != E; ++I) PrintDomTree(*I, o, Lev+1); } @@ -387,19 +387,19 @@ class DFCalculateWorkObject { public: DFCalculateWorkObject(BasicBlock *B, BasicBlock *P, - const DominatorTree::DomTreeNode *N, - const DominatorTree::DomTreeNode *PN) - : currentBB(B), parentBB(P), DomTreeNode(N), parentNode(PN) {} + const DomTreeNode *N, + const DomTreeNode *PN) + : currentBB(B), parentBB(P), Node(N), parentNode(PN) {} BasicBlock *currentBB; BasicBlock *parentBB; - const DominatorTree::DomTreeNode *DomTreeNode; - const DominatorTree::DomTreeNode *parentNode; + const DomTreeNode *Node; + const DomTreeNode *parentNode; }; } const DominanceFrontier::DomSetType & DominanceFrontier::calculate(const DominatorTree &DT, - const DominatorTree::DomTreeNode *Node) { + const DomTreeNode *Node) { BasicBlock *BB = Node->getBlock(); DomSetType *Result = NULL; @@ -413,8 +413,8 @@ BasicBlock *currentBB = currentW->currentBB; BasicBlock *parentBB = currentW->parentBB; - const DominatorTree::DomTreeNode *currentNode = currentW->DomTreeNode; - const DominatorTree::DomTreeNode *parentNode = currentW->parentNode; + const DomTreeNode *currentNode = currentW->Node; + const DomTreeNode *parentNode = currentW->parentNode; assert (currentBB && "Invalid work object. Missing current Basic Block"); assert (currentNode && "Invalid work object. Missing current Node"); DomSetType &S = Frontiers[currentBB]; @@ -436,9 +436,9 @@ // Loop through and visit the nodes that Node immediately dominates (Node's // children in the IDomTree) bool visitChild = false; - for (DominatorTree::DomTreeNode::const_iterator NI = currentNode->begin(), + for (DomTreeNode::const_iterator NI = currentNode->begin(), NE = currentNode->end(); NI != NE; ++NI) { - DominatorTree::DomTreeNode *IDominee = *NI; + DomTreeNode *IDominee = *NI; BasicBlock *childBB = IDominee->getBlock(); if (visited.count(childBB) == 0) { workList.push_back(DFCalculateWorkObject(childBB, currentBB, @@ -927,7 +927,7 @@ // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. - DominatorTree::DomTreeNode *node= getAnalysis().getNode(BB); + DomTreeNode *node= getAnalysis().getNode(BB); // If we are unreachable, we may not have an immediate dominator. if (!node || !node->getIDom()) @@ -951,7 +951,7 @@ Function *F = Root->getParent(); // Loop over all of the reachable blocks in the function... for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { - DominatorTree::DomTreeNode* node = DT.getNode(I); + DomTreeNode* node = DT.getNode(I); if (node && node->getIDom()) { // Reachable block. BasicBlock* ImmDom = node->getIDom()->getBlock(); ETNode *&BBNode = Nodes[I]; From cfr at adobe.com Fri Jun 1 16:43:12 2007 From: cfr at adobe.com (Chuck Rose III) Date: Fri, 1 Jun 2007 14:43:12 -0700 Subject: [llvm-commits] Patch for review-- for VStudio build breaks Message-ID: <680422C0AA225644931C2F6DD07200DD3EE799@namail5.corp.adobe.com> Hola LLVMers, I've attached a patch I've built against a newly sync'ed tree for the VStudio-related build breaks for your review. I do not have commit access, so I will need one of you to commit it once it's blessed. I've compiled it against MacOSX to check to see that everything still built ok on my other primary system, but I haven't checked it against a wider set of targets. Apologies if this isn't the right place to send this, I haven't done a patch before, but the instructions seemed to indicate that this was the procedure. Thanks, Chuck. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070601/040214f5/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: cfrvstudio.patch Type: application/octet-stream Size: 2240 bytes Desc: cfrvstudio.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070601/040214f5/attachment.obj