================
@@ -329,10 +330,35 @@ static Address applyNonVirtualAndVirtualOffset(
           loc, addr, baseValueTy, nonVirtualOffset.getQuantity(),
           assumeNotNull);
     }
+  } else {
+    baseOffset = virtualOffset;
+  }
+
+  // Apply the base offset.  cir.ptr_stride adjusts by a number of elements,
+  // not bytes.  So the pointer must be cast to a byte pointer and back.
+
+  mlir::Value ptr = addr.getPointer();
+  mlir::Type charPtrType = cgf.cgm.UInt8PtrTy;
+  mlir::Value charPtr =
+      cgf.getBuilder().createCast(cir::CastKind::bitcast, ptr, charPtrType);
----------------
xlauko wrote:

```suggestion
  mlir::Value charPtr = cgf.getBuilder().createBitcast(ptr, charPtrType);
```

https://github.com/llvm/llvm-project/pull/156521
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to