[clang] [llvm] [CIR] Add TBAA support for scalar loads and stores (PR #246079)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 06:52:25 PST 2026


================
@@ -313,7 +325,7 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr,
   // Otherwise, use the alignment of the type.
   return makeNaturalAddressForPointer(
       emitScalarExpr(expr), expr->getType()->getPointeeType(), CharUnits(),
-      /*forPointeeType=*/true, baseInfo);
+      /*forPointeeType=*/true, baseInfo, tbaaInfo);
----------------
xlauko wrote:

Classic has a `p +/- n` case here that keeps the base pointer's TBAA. Without it, `*(&u->i + 0)` on a union gets an `int` tag instead of char, and a union pun returns a wrong value at -O2. Could you port `emitPointerArithmetic`?

https://github.com/llvm/llvm-project/pull/246079


More information about the cfe-commits mailing list