how to avoid llvm to optimize variable

Hi all,

For debugging purpose, I would like to create temporary local variables that I want to keep ‘live’ for a routine execution. They will be set to a value at routine entrance and I they will never be used.

Is there a way to avoid llvm to optimize them away when mem2reg is performed ?

Thanks for your answer

Seb

If you access the alloca’ed variables with volatile loads and stores, then I think mem2reg will be unable to promote them to SSA registers. – John T.