Skip to content

Commit f3059e2

Browse files
committed
GlobalOpt: Drop code for handling pointer bitcasts
I got confused and must have closed the wrong revision for https://reviews.llvm.org/D149291
1 parent 5f4d96e commit f3059e2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/Transforms/IPO/GlobalOpt.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,6 @@ static bool AllUsesOfValueWillTrapIfNull(const Value *V,
663663
if (II->getCalledOperand() != V) {
664664
return false; // Not calling the ptr
665665
}
666-
} else if (const BitCastInst *CI = dyn_cast<BitCastInst>(U)) {
667-
if (!AllUsesOfValueWillTrapIfNull(CI, PHIs)) return false;
668666
} else if (const AddrSpaceCastInst *CI = dyn_cast<AddrSpaceCastInst>(U)) {
669667
if (!AllUsesOfValueWillTrapIfNull(CI, PHIs))
670668
return false;
@@ -780,10 +778,9 @@ static bool OptimizeAwayTrappingUsesOfValue(Value *V, Constant *NewV) {
780778
UI = V->user_begin();
781779
}
782780
}
783-
} else if (CastInst *CI = dyn_cast<CastInst>(I)) {
784-
Changed |= OptimizeAwayTrappingUsesOfValue(CI,
785-
ConstantExpr::getCast(CI->getOpcode(),
786-
NewV, CI->getType()));
781+
} else if (AddrSpaceCastInst *CI = dyn_cast<AddrSpaceCastInst>(I)) {
782+
Changed |= OptimizeAwayTrappingUsesOfValue(
783+
CI, ConstantExpr::getAddrSpaceCast(NewV, CI->getType()));
787784
if (CI->use_empty()) {
788785
Changed = true;
789786
CI->eraseFromParent();

0 commit comments

Comments
 (0)