Displaying 1 result from an estimated 1 matches for "throw_nullpointerexcept".
2015 Apr 23
5
[LLVMdev] RFC: implicit null checks in llvm
...h_trap
With the @llvm.(load|store)_with_trap intrinsics in place, we can
write an LLVM pass that folds null checks into nearby memory
operations on that same pointer. As an example, we can turn
// r0 is a local register
if (p != null) {
r0 += 5;
*(p + 16) = 42;
...
} else {
throw_NullPointerException();
unreachable;
}
into
// r0 is a local register
r0 += 5;
invoke @llvm_store_with_trap(p + 16, 42) to label %ok, unwind label %not_ok
not_ok:
%unused = landingpad .....
throw_NullPointerException();
unreachable;
ok:
...
A slight subtlety here is that the store to (p +...