Subsections

3 tcecc

1 Disappearing code

Tcecc is using the efficient LLVM compiler framework for its optimizations. Sometimes LLVM is too aggressive and removes code that you might not intend to get removed. This happens in case you write your output to a global variable which you might dump only in the simulator and never read it in your program nor e.g. print it with printf(). In this case LLVM sees writes to a global variable which is never read by the program, thus thinks the computation producing the written value is useless and removes it as dead code.

A solution to the problem is to always mark the global ``output/verification'' variables as 'volatile' which means that the content of the variable should be always written to the memory. Thus, LLVM has to assume that there might be other readers of the same variable that are just not visible in the current program.



Pekka Jääskeläinen 2018-03-12