[llvm] r190076 - R600: Fix segfault in R600TextureIntrinsicReplacer

Tom Stellard thomas.stellard at amd.com
Thu Sep 5 11:37:45 PDT 2013


Author: tstellar
Date: Thu Sep  5 13:37:45 2013
New Revision: 190076

URL: http://llvm.org/viewvc/llvm-project?rev=190076&view=rev
Log:
R600: Fix segfault in R600TextureIntrinsicReplacer

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.

Modified:
    llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp

Modified: llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp?rev=190076&r1=190075&r2=190076&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp (original)
+++ llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp Thu Sep  5 13:37:45 2013
@@ -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");





More information about the llvm-commits mailing list