[LLVMdev] Is 'Implicit def' bug fixed in LLVM 2.0?

Chris Lattner sabre at nondot.org
Sat May 26 00:29:36 PDT 2007


On Fri, 25 May 2007, Seung Jae Lee wrote:
> I remember that Jeffrey Poznanovic posted ths issue about 'Implicit def' 
> on Apr. 29 and Chris Lattner mentioned it seemed to be a bug.

Ok, I don't recall the bug but:

> I am using ver 1.9 and also found 'Implicit def' while using codegen for 
> the code follows:

The implicit def instruction often comes from use of the 'undef' value. 
In your case, that comes from this function

> int %c_fs() {
> entry:
>        ret int undef
> }
>

So your real question seems to be why the llvm optimizer reduces c_fs to 
undef.   The answer is because your code is not computing a defined value:

> int c_fs(){
>    int i, sum;
>    for (i=0; i<10; i++)
>      sum +=  f(i);
>    return sum;
> }

Try initializing 'sum' to zero.

-Chris

> #ifdef LINUX
> #include <stdio.h>
> #include <stdlib.h>
>
> int c_f(int);
> int c_fs();
>
> int main (int argc, char* argv[]) {
>    int j;
>    j = c_fs();
>
>    printf ("%i\n",j);
>    printf ("You got it\n");
>
> }
> #endif
> -------------------------------------------------------------
> The code above was converted to LLVM assembly as follows:
>
> -------------------------------------------------------------
> implementation   ; Functions:
>
> int %c_f(int %x1) {
> entry:
>        ret int %x1
> }
>
> -------------------------------------------------------------
>
> You can see 'int undef' at the end of this assembly which is shown as 'Implicit def' in target specific assembly code.
>
> I just wonder if this is fixed in the newer version.
> Have a good weekend.
>
> Thanks,
> Seung J. Lee
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list