The Analysis Target

In order to provide a robust analysis target without an overwhelming parsing task, we will use a restricted subset of LLVM intermediate code (aka Bitcode). This subset only includes the following pseudoinstructions:

  • alloca
  • getelementpointer
  • load
  • store
  • ret
  • icmp
  • br
  • add
  • sub
  • div
  • mul
  • phi
  • call
  • define

Additionally, your analysis should accomodate programs with both global and local variable allocations. You may assume that all variables are of scalar integer type.

Example 1: You should be able to handle this example.
define i32 @main(i32 %argc) {
        %noArgs = icmp eq i32 %argc, 1
        br i1 %noArgs, label %lbl_t, label %lbl_f
lbl_t:
        %varT = add i32 1, 0
        br label %end
lbl_f:
        %varF = add i32 2, 0
        br label %end
end:
        %var = phi i32 [%varT, %lbl_t], [%varF, %lbl_f]
        ret i32 %var
}