[llvm-dev] Dump LLVM StoreInst

Zhou Zhizhong via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 9 20:37:52 PST 2018


Hi Davide,

Thanks for the useful tips, I’ll dive into LICM and ScalarEvolution to get more insights.

From what I have done yesterday, I inserted the lable name of this for loop into a std::stack, so when its successor jumps to the start of the loop, my stored stack can detect this and break out of the loop, now I’m considering to add a Counter to control the loop times to reach the lowest fixed point, but the problem would be how many times should I set, and that’s related with the value of my variables(that’s why I ask this question). If the affected values remain unchanged somewhat, then I should stop the loop and get the final result.

Anyway, I’ll see the analysis code first.

Thanks,
Ethan

> On 10 Mar 2018, at 09:47, Davide Italiano <davide at freebsd.org> wrote:
> 
> On Fri, Mar 9, 2018 at 9:18 AM, Zhou Zhizhong via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> Hi,
>> 
>> I’m writing a loop-free LLVM pass, my thought is to track if the value inside the loop is changed, so I look up the Instruction StoreInst first and try to get its value in a set. I checked getValueOperand(), getValueName() in the API document but unfortunately they failed the compilation.
>> 
> 
> If you want to check for loop invariance, LICM has logic for doing
> what you want. To track the evolution of a variable inside a loop,
> there's already an
> analysis, ScalarEvolution. In general, I'd recommend to check how loop
> passes in LLVM perform this kind of analysis before writing your own.
> 
> -- 
> Davide
> 
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare



More information about the llvm-dev mailing list