File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -2084,11 +2084,10 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
2084
2084
Value *Src = Visit (const_cast <Expr*>(E));
2085
2085
llvm::Type *SrcTy = Src->getType ();
2086
2086
llvm::Type *DstTy = ConvertType (DestTy);
2087
- if (SrcTy->isPtrOrPtrVectorTy () && DstTy->isPtrOrPtrVectorTy () &&
2088
- SrcTy->getPointerAddressSpace () != DstTy->getPointerAddressSpace ()) {
2089
- llvm_unreachable (" wrong cast for pointers in different address spaces"
2090
- " (must be an address space cast)!" );
2091
- }
2087
+ assert (
2088
+ (!SrcTy->isPtrOrPtrVectorTy () || !DstTy->isPtrOrPtrVectorTy () ||
2089
+ SrcTy->getPointerAddressSpace () == DstTy->getPointerAddressSpace ()) &&
2090
+ " Address-space cast must be used to convert address spaces" );
2092
2091
2093
2092
if (CGF.SanOpts .has (SanitizerKind::CFIUnrelatedCast)) {
2094
2093
if (auto *PT = DestTy->getAs <PointerType>()) {
You can’t perform that action at this time.
0 commit comments