]> granicus.if.org Git - llvm/commitdiff
GlobalStatus: Don't walk use-lists of ConstantData
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 24 Sep 2016 02:30:11 +0000 (02:30 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 24 Sep 2016 02:30:11 +0000 (02:30 +0000)
Return early from llvm::isSafeToDestroyConstant() whenever the value
`isa<ConstantData>()`.  These constants are shared across the
LLVMContext.  We never really want to delete them here, and walking
their use-lists can be very expensive.

(This is motivated by an eventual goal of removing use-lists entirely
from ConstantData.)

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

lib/Transforms/Utils/GlobalStatus.cpp

index 266be41fbeadd3a1c515872fd14c3a90782299a1..a5ddee3c70cbec4a29242c14371559d8f71db57e 100644 (file)
@@ -35,7 +35,7 @@ bool llvm::isSafeToDestroyConstant(const Constant *C) {
   if (isa<GlobalValue>(C))
     return false;
 
-  if (isa<ConstantInt>(C) || isa<ConstantFP>(C))
+  if (isa<ConstantData>(C))
     return false;
 
   for (const User *U : C->users())