Skip to content

Commit

Permalink
GlobalStatus: Don't walk use-lists of ConstantData
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dexonsmith committed Sep 24, 2016
1 parent e2e5490 commit c1ce9ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Transforms/Utils/GlobalStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit c1ce9ac

Please sign in to comment.