hfinkel added a comment. Do you have a test case? I don't understand from your description what's happening. Do you have a target intrinsic with an ID in the wrong range (i.e., not > FIRST_TARGET_MEMORY_OPCODE)? https://reviews.llvm.org/D41083