Thank you for the response. I am aware of DebugInfo. This is what i am using at the moment. So far it seems that after running mem2reg i get the correct line/col for the remaining Store and Load instructions. At least in the inputs i’ve tried (Cuda kernels).
I was wondering whether its possible to do better than that. For instance not only get a start line/col but also end line/col for a given Load/Store. Or even just an end line only. I’ve thought of looking up the lines of subsequent instructions and pick the closest one to the line of the load/store and use that value (-1) as the end line. However i think this is not robust enough as (modulo any other complications) multiple LoadInst might belong to the same read statement and the stament might span multiple lines, plus there may be whitespaces between that statement and the next.
I’ve thought of looking up libTooling as well but then again, im still not sure how to associate IR values with their AST statement.