Have the front-end use the `nounwind` attribute on atomic libcalls. This prevents us from seeing `invoke __atomic_load` in MSAN, which is problematic as it has no successor for instrumentation to be added.
__libatomic_load might come at the end of the function, with no succeeding BB
Not exactly. It may come at the end of a BB.
We should probably fix it in clang by adding nounwind to libatomic calls, and ignore invokes here.
Check if the function already exists.
This needs a clang test, and better move it to a separate change.
Better explicitly check that this an invoke and not call. Call always has a next instruction.
And move this check to the parent function to apply regular call instrumentation to the unrecognized call.
It has a successor. Two successors, actually.
you've already checked it with assert(isa<CallInst>) - which could be changed to isTerminator(), and this could be simplified to NextIRB(CB.getNextNode()).