I need to extract the constant involved in a branch condition.
For instance, in the branch if(a > 10)
, 10 is what I want to extract.
I wonder how to do that using LLVM? The corresponding LLVM instruction for the above branch is
%cmp = icmp sgt i32 %2, 10
br i1 %cmp, label %if.then, label %if.else`.
It's easy to find the branch IR, but the constant is not in the IR.