[llvm-commits] [llvm] r120398 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyLibCalls.cpp test/Transforms/SimplifyLibCalls/Puts.ll

Duncan Sands baldrick at free.fr
Tue Nov 30 02:41:34 PST 2010


Hi Anders,

> +struct PutsOpt : public LibCallOptimization {
> +  virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<>  &B) {
> +    // Require one fixed pointer argument and an integer/void result.

is it correct to allow puts with a void result?  Mightn't this be a sign that
it is not the puts library function, but something else?

> +define void @foo() {
> +entry:
> +; CHECK: call i32 @putchar(i32 10)
> +  %call = call i32 @puts(i8* getelementptr inbounds ([1 x i8]* @.str, i32 0, i32 0))
> +  ret void
> +}

Since %call is not used, this doesn't check the code that converts the
result of the call.

Ciao,

Duncan.



More information about the llvm-commits mailing list