llvm-project
676ccb68 - [CIR] Lower __builtin_assume_dereferenceable (#197262)

Commit
137 days ago
[CIR] Lower __builtin_assume_dereferenceable (#197262) `__builtin_assume_dereferenceable` was reported NYI by ClangIR. It's heavily exercised by libcxx via `__memory/valid_range.h`, so most of `<algorithm>` currently fails to compile under `-fclangir`. Adds a `cir.assume_dereferenceable` op (pointer + pointer-sized integer), emits it from CIRGenBuiltin, and lowers it to ``` call void @llvm.assume(i1 true) [ "dereferenceable"(ptr, i64) ] ``` which is what classic Clang's `Builder.CreateDereferenceableAssumption` produces. The size operand is widened/narrowed to `intptr_t` at the CIRGen layer to match classic CodeGen's `IntPtrTy` conversion. Tests cover the dynamic-size, constant-size, and narrow-integer-size cases against CIR, CIR->LLVM, and OGCG.
Author
Parents
Loading