MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / copyUBFrom

Method copyUBFrom

ir/state.cpp:726–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726void State::copyUBFrom(const BasicBlock &bb) {
727 if (config::disallow_ub_exploitation)
728 return;
729
730 // Time-travel UB: anything that happens before a possibly non-returning call
731 // can be moved up to the entry of the BB.
732 const Value *before_call = nullptr;
733 for (auto &i : bb.instrs()) {
734 if (auto *call = dynamic_cast<const FnCall*>(&i)) {
735 if (!call->hasAttribute(FnAttrs::WillReturn))
736 break;
737 }
738 before_call = &i;
739 }
740 if (!before_call)
741 return;
742
743 auto src_val_I = src_state->values.find(before_call);
744 assert(src_val_I != src_state->values.end());
745 domain.UB.add(src_val_I->second.domain);
746}
747
748void State::copyUBFromBB(
749 const unordered_map<const BasicBlock*, BasicBlockInfo> &tgt_data) {

Callers

nothing calls this directly

Calls 5

findMethod · 0.80
instrsMethod · 0.45
hasAttributeMethod · 0.45
endMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected