diff --git a/llvm/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp b/llvm/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp index 37d90596bd88..d4b8ec01c551 100644 --- a/llvm/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp +++ b/llvm/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp @@ -260,6 +260,9 @@ public: } void visitCallInst(CallInst &I) { + if (!I.getCalledFunction()) { + return; + } StringRef Name = I.getCalledFunction()->getName(); if (Name == "llvm.AMDGPU.tex") { ReplaceTexIntrinsic(I, false, TexSign, "llvm.R600.tex", "llvm.R600.texc");