[clang] a8690ba - [CGExpr] Perform bitcast unconditionally
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 23 07:40:03 PDT 2022
Author: Nikita Popov
Date: 2022-03-23T15:39:39+01:00
New Revision: a8690ba9d0147bbca8d9031ef1596c4de025e6ed
URL: https://github.com/llvm/llvm-project/commit/a8690ba9d0147bbca8d9031ef1596c4de025e6ed
DIFF: https://github.com/llvm/llvm-project/commit/a8690ba9d0147bbca8d9031ef1596c4de025e6ed.diff
LOG: [CGExpr] Perform bitcast unconditionally
The way the check is written is not compatible with opaque
pointers -- while we don't need to change the IR pointer type,
we do need to change the element type stored in the Address.
Added:
Modified:
clang/lib/CodeGen/CGExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 2ee62f97399ac..45059cafabb58 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2750,8 +2750,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
llvm::Type *VarTy = getTypes().ConvertTypeForMem(VD->getType());
auto *PTy = llvm::PointerType::get(
VarTy, getContext().getTargetAddressSpace(VD->getType()));
- if (PTy != Addr.getType())
- Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy);
+ Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy);
} else {
// Should we be using the alignment of the constant pointer we emitted?
CharUnits Alignment =
More information about the cfe-commits
mailing list