Pointer-Integer Round Trip Remover
March 11, 2025 ยท View on GitHub
is an out-of-tree LLVM pass that collapses instances of pointer-integer round-trips into a single GEP (get element pointer) instruction.
Warning
This optimization cannot always be done. Certain strict semantics such as pointer provenance make this kind of thing illegal. However, we can get this translation to verify with physical pointers.
Building & Running
To build the pass:
export $LLVM_DIR=<path/to/llvm/19>
cmake .
make
To run:
$LLVM_DIR/bin/opt -load-pass-plugin libPtrIntRoundTripRemover.so --passes="ptr-int-round-trip-remover" -disable-output inputs/simple.ll