Skip to content

Commit 4d2874c

Browse files
committed
Drop no-longer-necessary cast-stripping helper.
If it wasn't for inttoptr/ptrtoint, this probably could have been stripPointerCasts anyway. Given the sole existing user now only produces plain ConstantPtrAuth values anyway (unlike the previous dance with llvm.ptrauth global), I don't think this is needed anymore.
1 parent d178750 commit 4d2874c

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,37 +1595,8 @@ llvm::GlobalValue *ConstantEmitter::getCurrentAddrPrivate() {
15951595
return global;
15961596
}
15971597

1598-
static llvm::Constant *getUnfoldableValue(llvm::Constant *C) {
1599-
// Look through any constant expressions that might get folded
1600-
while (auto CE = dyn_cast<llvm::ConstantExpr>(C)) {
1601-
switch (CE->getOpcode()) {
1602-
// Simple type changes.
1603-
case llvm::Instruction::BitCast:
1604-
case llvm::Instruction::IntToPtr:
1605-
case llvm::Instruction::PtrToInt:
1606-
break;
1607-
1608-
// GEPs, if all the indices are zero.
1609-
case llvm::Instruction::GetElementPtr:
1610-
for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i)
1611-
if (!CE->getOperand(i)->isNullValue())
1612-
return C;
1613-
break;
1614-
1615-
default:
1616-
return C;
1617-
}
1618-
C = CE->getOperand(0);
1619-
}
1620-
return C;
1621-
}
1622-
16231598
void ConstantEmitter::registerCurrentAddrPrivate(llvm::Constant *signal,
16241599
llvm::GlobalValue *placeholder) {
1625-
// Strip anything from the signal value that might get folded into other
1626-
// constant expressions in the final initializer.
1627-
signal = getUnfoldableValue(signal);
1628-
16291600
assert(!PlaceholderAddresses.empty());
16301601
assert(PlaceholderAddresses.back().first == nullptr);
16311602
assert(PlaceholderAddresses.back().second == placeholder);

0 commit comments

Comments
 (0)