koriakin added a comment. The only instance of creating a global variable during SelectionDAG phase I found is in LowerToTLSEmulatedModel, and it rather unceremoniously const_cast<>s the module. I'll keep digging... Repository: rL LLVM http://reviews.llvm.org/D19407