diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp index b499279c696..5a85a047bec 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -125,13 +125,17 @@ static bool MarkAliveBlocks(BasicBlock *BB,          }        } -      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. | 

