Child pages

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


IR representation of the example1.c, with phi-nodes presented in example1-opt.ll below. This can be created with command clang -S -emit-llvm ./example1.c -o /dev/stdout | opt -S -mem2reg -o exampleexample1-1-opt.ll. Notice that all the variables are stored in the registers, unlike in the example above, where stack memory was used. The result is otherwise exactly the same as the one seen in the example solution for the exercise 2, except that there is no optimizations done for the the code. For example, there still exists useless labels (label 5, label 13), and some dead code (line 18).