[all-commits] [llvm/llvm-project] 2ee080: [CIR] Add cir.ptr_mask

Adam Smith via All-commits all-commits at lists.llvm.org
Wed Sep 16 14:13:06 PDT 2026


  Branch: refs/heads/users/adams381/cir-ptr-mask
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ee0804468597900f4e2f9cdcd264436bbf78ade
      https://github.com/llvm/llvm-project/commit/2ee0804468597900f4e2f9cdcd264436bbf78ade
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-09-16 (Wed, 16 Sep 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
    A clang/test/CIR/IR/invalid-ptr-mask.cir
    A clang/test/CIR/IR/ptr-mask.cir
    A clang/test/CIR/Lowering/ptr-mask.cir

  Log Message:
  -----------
  [CIR] Add cir.ptr_mask

`cir.ptr_mask` ANDs a pointer with an integer mask and gives back a
pointer, lowering to llvm.intr.ptrmask.  Paired with `cir.ptr_stride` it
rounds a pointer up to an alignment the way classic's
emitRoundPointerUpToAlignment does, without the round trip through an
integer that would lose provenance.

llvm.ptrmask needs the mask at exactly the target's pointer index width,
so the lowering extends or truncates it first.  GEP takes an index of
any width, so `cir.ptr_stride` never needed this.

Assisted-by: Cursor / claude-opus-5



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list