[llvm-commits] [llvm] r67934 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/TargetLowering.cpp test/CodeGen/X86/tailcall-i1.ll test/CodeGen/X86/tailcall-structret.ll

Duncan Sands baldrick at free.fr
Sat Mar 28 03:50:08 PDT 2009


Hi Arnold,

> +  if(NumOps >= 5&&

missing space before &&

> +      Ret.getOperand(1).getOpcode()==ISD::MERGE_VALUES &&

missing spaces around ==

> +      Ret.getOperand(1).getOperand(0) == SDValue(TheCall, 0))
> +    return true;

I've no idea whether the above logic is the right way (tm) to do this,
but it looks rather fragile.

> +  if ((NumOps == 1 &&
> +        (Ret.getOperand(0) == SDValue(TheCall,1) ||
> +         Ret.getOperand(0) == SDValue(TheCall,0))) ||
> +      (NumOps == 3 &&
> +       Ret.getOperand(1).getOpcode() == ISD::ANY_EXTEND && 
> +       Ret.getOperand(1).getNumOperands()>0 &&
> +       Ret.getOperand(1).getOperand(0).getOpcode() == ISD::TRUNCATE &&
> +       Ret.getOperand(1).getOperand(0).getNumOperands()>0 &&
> +       Ret.getOperand(1).getOperand(0).getOperand(0) == SDValue(TheCall, 0)) ||
> +      (NumOps > 1 &&
> +       Ret.getOperand(0) == SDValue(TheCall,
> +         TheCall->getNumValues()-1) &&
> +       Ret.getOperand(1) == SDValue(TheCall,0)))
> +    return true;
> +  return false;

This also looks fragile.  Perhaps you could make a more generic
way of not worrying about harmless instructions.

Ciao,

Duncan.

> +}
> 
> Added: llvm/trunk/test/CodeGen/X86/tailcall-i1.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall-i1.ll?rev=67934&view=auto
> 
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/tailcall-i1.ll (added)
> +++ llvm/trunk/test/CodeGen/X86/tailcall-i1.ll Sat Mar 28 03:33:27 2009
> @@ -0,0 +1,6 @@
> +; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep TAILCALL
> +define fastcc i1 @i1test(i32, i32, i32, i32) {
> +  entry:
> +  %4 = tail call fastcc i1 @i1test( i32 %0, i32 %1, i32 %2, i32 %3)
> +  ret i1 %4
> +}
> 
> Added: llvm/trunk/test/CodeGen/X86/tailcall-structret.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall-structret.ll?rev=67934&view=auto
> 
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/tailcall-structret.ll (added)
> +++ llvm/trunk/test/CodeGen/X86/tailcall-structret.ll Sat Mar 28 03:33:27 2009
> @@ -0,0 +1,6 @@
> +; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep TAILCALL
> +define fastcc { { i8*, i8* }*, i8*} @init({ { i8*, i8* }*, i8*}, i32) {
> +entry:
> +      %2 = tail call fastcc { { i8*, i8* }*, i8* } @init({ { i8*, i8*}*, i8*} %0, i32 %1)
> +      ret { { i8*, i8* }*, i8*} %2
> +}
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 




More information about the llvm-commits mailing list