[llvm-dev] Efficient way to identify an instruction
Alberto Barbaro via llvm-dev
llvm-dev at lists.llvm.org
Sat Jul 27 02:09:36 PDT 2019
Hi all,
I would like to understand if there is an efficient way to identify the
instruction that "created" a specific variable. For example,
define i32 @main() #0 {
%1 = alloca i32, align 4
%2 = alloca %struct._IO_FILE*, align 8
%3 = alloca [40 x i8], align 16
store i32 0, i32* %1, align 4
%4 = call %struct._IO_FILE* @fopen(i8* getelementptr inbounds ([51 x i8],
[51 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x
i8]* @.str.1, i32 0, i32 0))
store %struct._IO_FILE* %4, %struct._IO_FILE** %2, align 8
%5 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i32 0, i32 0
%6 = load %struct._IO_FILE*, %struct._IO_FILE** %2, align 8
%7 = call i64 @fread(i8* %5, i64 2, i64 1, %struct._IO_FILE* %6)
%8 = load %struct._IO_FILE*, %struct._IO_FILE** %2, align 8
%9 = call i32 @fclose(%struct._IO_FILE* %8)
%10 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%11 = load i8, i8* %10, align 16
*%12 = sext i8 %11 to i32*
%13 = icmp eq i32 %12, 66
br i1 %13, label %14, label %25
}
Having the reference I to the instruction in bold.Can i efficiently know
that the variable %11 was "created" by the %3 = alloca [40 x i8], align 16.
I understand that the word "created" is not the most appropriate...
Any suggestion?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190727/e9e17265/attachment.html>
More information about the llvm-dev
mailing list