<div dir="ltr">Hi, all.<div>I am currently trying to find LoadInst, which are not dependent external values (e.g., arguments or Global variable).<br><br></div><div>```</div><div>int f(int x) {<br>        for (int i = 0; i < 1000; i++) {<br>                x += x * i;<br>        }<br>        return x;<br>}<br>```</div><div><br></div><div>For example, in the above code,  `x` is from argument, and `i` is not.</div><div><br></div><div>```<br>define i32 @f(i32 %x) #0 {<br>entry:<br>  %x.addr = alloca i32, align 4<br>  %i = alloca i32, align 4<br>  store i32 %x, i32* %x.addr, align 4<br>  store i32 0, i32* %i, align 4<br>  br label %for.cond<br><br>for.cond:                                         ; preds = %for.inc, %entry<br>  %0 = load i32, i32* %i, align 4<br>  %cmp = icmp slt i32 %0, 1000<br>  br i1 %cmp, label %for.body, label %for.end<br><br>for.body:                                         ; preds = %for.cond<br>  %1 = load i32, i32* %x.addr, align 4<br>  %2 = load i32, i32* %i, align 4<br>  %mul = mul nsw i32 %1, %2<br>  %3 = load i32, i32* %x.addr, align 4<br>  %add = add nsw i32 %3, %mul<br>  store i32 %add, i32* %x.addr, align 4<br>  br label %for.inc<br><br>for.inc:                                          ; preds = %for.body<br>  %4 = load i32, i32* %i, align 4<br>  %inc = add nsw i32 %4, 1<br>  store i32 %inc, i32* %i, align 4<br>  br label %for.cond<br><br>for.end:                                          ; preds = %for.cond<br>  %5 = load i32, i32* %x.addr, align 4<br>  ret i32 %5<br>}<br>```</div><div><br></div><div>As I can see above, it needs to handle store and load.</div><div>I think I can do simple dataflow analysis to do that.</div><div>But I wonder whether there is a standard, mature way in LLVM.</div><div><br></div><div>```</div><div>// -fsanitize=dataflow </div><div>  store i16 %21, i16* %2<br>  store i32 %inc, i32* %i, align 4<br></div><div>```</div><div>I thought that this analysis should be implemented in DataFlowSanitizer.</div><div>But, it still propagates taint symbol to `i`. </div><div><br></div><div>Is there any standard way to do this?</div><div>Thank you.<br><br></div><div>Best,</div><div>Insu Yun.</div></div>