[llvm] r212844 - [FastISel] Make isInTailCallPosition independent of SelectionDAG.

Juergen Ributzka juergen at apple.com
Tue Jul 15 17:13:44 PDT 2014


Yup, fixed it in r213108.
-Juergen

On Jul 15, 2014, at 3:33 PM, Eric Christopher <echristo at gmail.com> wrote:

>> +bool isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM,
>> +                          const TargetLoweringBase &TLI);
>> 
> 
> You can get to target lowering via the target machine so you don't
> need to pass it in here (or you can go the other way since TLI has a
> reference to the target machine at the moment).
> 
> -eric
> 
>> /// Test if given that the input instruction is in the tail call position if the
>> /// return type or any attributes of the function will inhibit tail call
>> 
>> Modified: llvm/trunk/lib/CodeGen/Analysis.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Analysis.cpp?rev=212844&r1=212843&r2=212844&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/Analysis.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/Analysis.cpp Fri Jul 11 15:50:47 2014
>> @@ -475,7 +475,8 @@ static bool nextRealType(SmallVectorImpl
>> /// between it and the return.
>> ///
>> /// This function only tests target-independent requirements.
>> -bool llvm::isInTailCallPosition(ImmutableCallSite CS, const SelectionDAG &DAG) {
>> +bool llvm::isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM,
>> +                                const TargetLoweringBase &TLI) {
>>   const Instruction *I = CS.getInstruction();
>>   const BasicBlock *ExitBB = I->getParent();
>>   const TerminatorInst *Term = ExitBB->getTerminator();
>> @@ -490,8 +491,7 @@ bool llvm::isInTailCallPosition(Immutabl
>>   // longjmp on x86), it can end up causing miscompilation that has not
>>   // been fully understood.
>>   if (!Ret &&
>> -      (!DAG.getTarget().Options.GuaranteedTailCallOpt ||
>> -       !isa<UnreachableInst>(Term)))
>> +      (!TM.Options.GuaranteedTailCallOpt || !isa<UnreachableInst>(Term)))
>>     return false;
>> 
>>   // If I will have a chain, make sure no other instruction that will have a
>> @@ -509,8 +509,7 @@ bool llvm::isInTailCallPosition(Immutabl
>>         return false;
>>     }
>> 
>> -  return returnTypeIsEligibleForTailCall(ExitBB->getParent(), I, Ret,
>> -                                         *DAG.getTarget().getTargetLowering());
>> +  return returnTypeIsEligibleForTailCall(ExitBB->getParent(), I, Ret, TLI);
>> }
>> 
>> bool llvm::returnTypeIsEligibleForTailCall(const Function *F,
>> 
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=212844&r1=212843&r2=212844&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Jul 11 15:50:47 2014
>> @@ -5490,7 +5490,7 @@ void SelectionDAGBuilder::LowerCallTo(Im
>> 
>>   // Check if target-independent constraints permit a tail call here.
>>   // Target-dependent constraints are checked within TLI->LowerCallTo.
>> -  if (isTailCall && !isInTailCallPosition(CS, DAG))
>> +  if (isTailCall && !isInTailCallPosition(CS, DAG.getTarget(), *TLI))
>>     isTailCall = false;
>> 
>>   TargetLowering::CallLoweringInfo CLI(DAG);
>> 
>> 
>> _______________________________________________
>> 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