Skip to content

Commit e65cabb

Browse files
committed
[ConstantFolding] Remove some typed pointer handling (NFC)
No need to insert a bitcast.
1 parent 6f653d9 commit e65cabb

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,18 +1001,8 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
10011001
}
10021002

10031003
// Create a GEP.
1004-
Constant *C = ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs,
1005-
InBounds, InRangeIndex);
1006-
assert(
1007-
cast<PointerType>(C->getType())->isOpaqueOrPointeeTypeMatches(ElemTy) &&
1008-
"Computed GetElementPtr has unexpected type!");
1009-
1010-
// If we ended up indexing a member with a type that doesn't match
1011-
// the type of what the original indices indexed, add a cast.
1012-
if (C->getType() != ResTy)
1013-
C = FoldBitCast(C, ResTy, DL);
1014-
1015-
return C;
1004+
return ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, InBounds,
1005+
InRangeIndex);
10161006
}
10171007

10181008
/// Attempt to constant fold an instruction with the

0 commit comments

Comments
 (0)