This is the solution to one of the projects from my Graduate Compiler Class
This implements loop invariant code motion for LLVM ver 3.5 or so as an importable module. Obviously, LLVM already has Loop Invariant CM implemented, so it also disables that pass. The files printCode.cpp and loopInv.cpp in the lib/loopInv directory were provided as skeletons, but the implementation code inside is mine.
Note: This may be the solution to someone's actual homework, so I'll not make it too easy by mentioning the course or problem number.