[llvm-commits] [llvm] r73253 - /llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp

Chris Lattner sabre at nondot.org
Fri Jun 12 14:01:07 PDT 2009


Author: lattner
Date: Fri Jun 12 16:01:07 2009
New Revision: 73253

URL: http://llvm.org/viewvc/llvm-project?rev=73253&view=rev
Log:
second half of fix for PR4366: don't zap store to null of 
non-default addrspaces.

Modified:
    llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=73253&r1=73252&r2=73253&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Fri Jun 12 16:01:07 2009
@@ -125,13 +125,17 @@
         }
       }
       
-      if (StoreInst *SI = dyn_cast<StoreInst>(BBI))
-        if (isa<ConstantPointerNull>(SI->getOperand(1)) ||
-            isa<UndefValue>(SI->getOperand(1))) {
+      if (StoreInst *SI = dyn_cast<StoreInst>(BBI)) {
+        Value *Ptr = SI->getOperand(1);
+        
+        if (isa<UndefValue>(Ptr) ||
+            (isa<ConstantPointerNull>(Ptr) &&
+             cast<PointerType>(Ptr->getType())->getAddressSpace() == 0)) {
           ChangeToUnreachable(SI);
           Changed = true;
           break;
         }
+      }
     }
 
     // Turn invokes that call 'nounwind' functions into ordinary calls.





More information about the llvm-commits mailing list