-1

I am looping over the instructions in a basic block, and the instructions as well as the operands gives an empty name when doing val->getName().

I'm trying to implement available expressions analysis, so I need to figure out how to compare the two labels; but of course, SSA obscures that. Currently, compiler is on -o0 and disabled other optimizations. What are possible ways I can compare var names?

IE:

a = b + c
b = d + e

b = d + e should kill a = b + c, but because of SSA, comparing value obj of b in a = b + c and b in b = d + e is not equal. How can I successfully compare those?

Thanks!

Conanap
  • 155
  • 1
  • 11

1 Answers1

1

The variable names you see in the LLVM IR are for reader convenience. Those names won't exist. Every instruction is an object with other instructions as its operands. You can use instruction addresses to differentiate from other instructions.

DTharun
  • 746
  • 7
  • 16