[llvm-branch-commits] [llvm] [SDAG] Introduce inbounds flag for pointer arithmetic (PR #131862)

Eli Friedman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 18 14:47:52 PDT 2025


efriedma-quic wrote:

This seems semantically ambiguous.

In GlobalISel, you have G_PTR_ADD, and inbounds on that has an obvious meaning; G_PTR_ADD has basically the same semantics as getelementptr.  But in SelectionDAG, we don't have that; we just have a plain ISD::ADD.  How do you tell which operand is the pointer?  The obvious heuristic is outright wrong: you can't assume a value is being used as a pointer just because its value is equal to the address of some variable.

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


More information about the llvm-branch-commits mailing list