[LLVMdev] Implicit def after printf call

Jeffrey Poznanovic jdp at cray.com
Sun Apr 29 14:41:51 PDT 2007


Hello all,

I'm seeing some unexpected behavior with codegen.  Can anyone shed some 
light on the llvm-generated ASM comment "#IMPLICIT DEF %eax"?  I found a 
note somewhere saying that it describes "registers that are live on input
to the function."

Here are the relevant llvm instructions from my testcase (which look
correct):

%r3844 = call i32 (i8*, ...)* @printf( i8* getelementptr (i8* bitcast 
([663 x i64]* @"initialized$$$CFE_id_786aaaf0_08b61fc9" to i8*), i64 1512));
%r3858 = volatile load i32* bitcast ([1 x i64]* @bGotUsr1Signal to i32*); 
%r3859 = icmp eq i32 %r3858, 0          ; <i1> [#uses=1]


Here's the x86-64 ASM code that gets generated (which doesn't look
correct):

...
call (printf)
#IMPLICIT_DEF %eax
testl %eax, %eax



Wouldn't the call to printf clobber EAX's contents before its use?  Could
the volatile load be causing this problem?

Does this look like a bug (and should it be posted on llvmbugs)?  Or, perhaps
I am missing something?  Any help would be most appreciated!

Regards,

Jeff



More information about the llvm-dev mailing list