Skip to content

Commit

Permalink
[clang][CGExprConstant] Remove no-op ptr-to-ptr bitcast (NFC)
Browse files Browse the repository at this point in the history
Remove a call to `getPointerCast` which is effectively does a no-op ptr-to-ptr
bitcast.

Opaque ptr clean-up effort.
  • Loading branch information
JOE1994 committed Nov 23, 2023
1 parent 4b1fe09 commit d8c4080
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions clang/lib/CodeGen/CGExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1861,10 +1861,7 @@ class ConstantLValueEmitter : public ConstStmtVisitor<ConstantLValueEmitter,
if (!hasNonZeroOffset())
return C;

llvm::Type *origPtrTy = C->getType();
C = llvm::ConstantExpr::getGetElementPtr(CGM.Int8Ty, C, getOffset());
C = llvm::ConstantExpr::getPointerCast(C, origPtrTy);
return C;
return llvm::ConstantExpr::getGetElementPtr(CGM.Int8Ty, C, getOffset());
}
};

Expand Down

0 comments on commit d8c4080

Please sign in to comment.