[llvm-dev] sinking in LICM

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 10 12:42:52 PDT 2017


On 8/10/2017 12:32 PM, junbuml at codeaurora.org wrote:
> On 2017-08-10 14:55, Friedman, Eli wrote:
>> On 8/10/2017 11:34 AM, via llvm-dev wrote:
>>> Hi,
>>>
>>> In the IR below, %tmp.7 and %tmp.8 are not used in loop, so we can 
>>> sink them in exit blocks. However, LICM do not handle this case 
>>> because of the check in isNotUsedInLoop() which returns false when a 
>>> PHI node use is hooked from a block inside the loop. I'm not sure if 
>>> we really need to have this check even when the PHI is outside the 
>>> loop?
>>>
>>> Is there any problem I'm missing if we convert the above IR to the 
>>> IR below :
>>>
>>
>> I can't see any problem, except that we don't have code to split a
>> loop exit like that.
>
>
> Yes, we should add code to split the loop exit to support such cases. 
> Before that I wanted to understand why we currently have such check 
> for PHI uses in isNotUsedInLoop()? Is this a bug? or is there a case 
> we need to consider?
>

I think the only reason we check PHI nodes outside the loop in 
isNotUsedInLoop() is that we don't have code to split the loop exit.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-dev mailing list