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

Function collect_gep_offsets

tools/transform.cpp:882–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

880}
881
882static pair<Value*, uint64_t> collect_gep_offsets(Value &v) {
883 Value *ptr = &v;
884 uint64_t offset = 0;
885
886 while (true) {
887 if (auto gep = dynamic_cast<GEP*>(ptr)) {
888 uint64_t off = gep->getMaxGEPOffset();
889 if (off != UINT64_MAX) {
890 ptr = &gep->getPtr();
891 offset += off;
892 continue;
893 }
894 }
895 break;
896 }
897
898 return { ptr, offset };
899}
900
901static unsigned returns_nonlocal(const Instr &inst,
902 set<pair<Value*, uint64_t>> &cache) {

Callers 1

returns_nonlocalFunction · 0.85

Calls 1

getMaxGEPOffsetMethod · 0.80

Tested by

no test coverage detected