R600: Fix segfault in R600TextureIntrinsicReplacer
authorTom Stellard <thomas.stellard@amd.com>
Thu, 5 Sep 2013 18:37:45 +0000 (18:37 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 5 Sep 2013 18:37:45 +0000 (18:37 +0000)
This pass was segfaulting when it ran into a non-intrinsic function
call.  Function calls are not supported, so now instead of segfaulting,
we will get an assertion failure with a nice error message.

I'm not sure how to test this using lit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190076 91177308-0d34-0410-b5e6-96231b3b80d8

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");