[llvm] r282320 - GlobalStatus: Don't walk use-lists of ConstantData

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 19:30:11 PDT 2016


Author: dexonsmith
Date: Fri Sep 23 21:30:11 2016
New Revision: 282320

URL: http://llvm.org/viewvc/llvm-project?rev=282320&view=rev
Log:
GlobalStatus: Don't walk use-lists of ConstantData

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.)

Modified:
    llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp

Modified: llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp?rev=282320&r1=282319&r2=282320&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp Fri Sep 23 21:30:11 2016
@@ -35,7 +35,7 @@ bool llvm::isSafeToDestroyConstant(const
   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())




More information about the llvm-commits mailing list