I want to check if a call site CallBase, lies in a block which is in a block that is conditionally reached, say
define i32 @foo(i1 %condition) {
entry:
br i1 %condition, label %true_block, label %false_block
true_block:
%call_true = call i32 @bar()
br label %exit_block
false_block:
%call_false = call i32 @baz()
br label %exit_block
exit_block:
%result = phi i32 [ %call_true, %true_block ], [ %call_false, %false_block ]
ret i32 %result
}
Here bar() and baz() are conditionally reached, so yes for those two call sites, but say if the entry had a call called foo() it would not be conditional.
Is there an API that can tell me this, if not what are the algorithmic steps I need to write to check it, I suspect I would need Dominator Information as well, I appreciate any help. Thanks!