[all-commits] [llvm/llvm-project] 7f35a2: [MLIR][EmitC] Add optional pure attribute to CastO...

Andrzej Warzyński via All-commits all-commits at lists.llvm.org
Tue Jun 16 01:32:07 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f35a2a81d73f6e764e9603c9c538421cc6fc51e
      https://github.com/llvm/llvm-project/commit/7f35a2a81d73f6e764e9603c9c538421cc6fc51e
  Author: Andrzej Warzyński <andrzej.warzynski at arm.com>
  Date:   2026-06-16 (Tue, 16 Jun 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
    M mlir/lib/Dialect/EmitC/IR/EmitC.cpp
    A mlir/test/Dialect/EmitC/canonicalize.mlir

  Log Message:
  -----------
  [MLIR][EmitC] Add optional pure attribute to CastOp (#202749)

In general, C++ cast expressions cannot always be assumed to be pure: they may
invoke user-defined conversions or be affected by floating-point environment
settings. However, in many practical cases, such as integer casts without
operator overloading, the cast is pure and can be treated as speculatable and
side-effect-free. For such cases, the newly added `pure` attribute may be used.

When `pure` attribute is set, `getSpeculatability()` returns `Speculatable` and
`getEffects()` reports no effects. It is UB if the `pure` attribute is set and
the actual conversion is not pure, e.g. when the user-defined conversion has
memory effects.



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