[llvm-dev] Loop Invariants Detection questions

Thomas RUBIANO via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 20 14:57:17 PST 2017


Yes, in fact I was not searching for that bur more dependence between
instructions.
And we can have that by recursively search on operands. I didn't know that
thank to the SSA form, operands give us the associated assignment
instructions then the potentially dependence tree.

Thank you for your help Eli :)

On Fri, Jan 20, 2017 at 7:23 PM, Friedman, Eli <efriedma at codeaurora.org>
wrote:

> On 1/20/2017 4:43 AM, Thomas RUBIANO wrote:
>
>> Thank you again Eli,
>>
>> I would like to know if it's not better to use DependenceAnalysis to know
>> which instruction depends on others…
>> I'm running this pass on a simple example:
>>>> while.body:                                       ; preds = %while.cond
>>   %1 = load i32, i32* %y, align 4 ← I1
>>   %2 = load i32, i32* %y, align 4
>>   %mul = mul nsw i32 %1, %2 ← I2
>>   store i32 %mul, i32* %z, align 4
>>   %3 = load i32, i32* %z, align 4
>>   call void @use(i32 %3)
>>   %4 = load i32, i32* %x, align 4
>>   %5 = load i32, i32* %x, align 4
>>   %add = add nsw i32 %4, %5
>>   store i32 %add, i32* %y, align 4
>>   %6 = load i32, i32* %y, align 4
>>   call void @use(i32 %6)
>>   %7 = load i32, i32* %x2, align 4
>>   store i32 %7, i32* %x, align 4
>>   %8 = load i32, i32* %x, align 4
>>   call void @use(i32 %8)
>>   br label %while.cond
>>>>
>> and here, for instance, I'm expecting to have a dependence between
>> %1 = load i32, i32* %y, align 4 → I1
>> … ↓ …
>> %mul = mul nsw i32 %1, %2 → I2
>>
>> simply because the %mul uses %1 as input.
>>
>> But when I dump the dependence "depends(I1,I2,true)" I have nothing… null.
>> Did I forget something?
>>
>
> DependenceAnalysis computes whether the memory accesses in two
> instructions overlap.  A multiply doesn't access memory, therefore the
> memory accesses don't overlap.
>
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>


-- 
 RUBIANO Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170120/7076b9ce/attachment.html>


More information about the llvm-dev mailing list