R600: Fix segfault in R600TextureIntrinsicReplacer
[oota-llvm.git] / lib / Target / R600 / R600TextureIntrinsicsReplacer.cpp
index 37d90596bd88150f74ad85d265b2930cb9617679..d4b8ec01c5512906e013467e3844ed80f9ba838f 100644 (file)
@@ -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");