Skip to content

[clang][CGExprScalar] Remove no-op ptr-to-ptr bitcast (NFC) #72072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions clang/lib/CodeGen/CGExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2224,18 +2224,8 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
return Visit(const_cast<Expr*>(E));

case CK_NoOp: {
llvm::Value *V = CE->changesVolatileQualification()
? EmitLoadOfLValue(CE)
: Visit(const_cast<Expr *>(E));
if (V) {
// CK_NoOp can model a pointer qualification conversion, which can remove
// an array bound and change the IR type.
// FIXME: Once pointee types are removed from IR, remove this.
llvm::Type *T = ConvertType(DestTy);
if (T != V->getType())
V = Builder.CreateBitCast(V, T);
}
return V;
return CE->changesVolatileQualification() ? EmitLoadOfLValue(CE)
: Visit(const_cast<Expr *>(E));
}

case CK_BaseToDerived: {
Expand Down