[PATCH] D145416: [clang] model 'p' inline asm constraint as reading memory

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 15:53:33 PST 2023


jyknight added a comment.

Also, I note the doc says it's useful for `for “load address” and “push address” instructions` (note, "load address" means e.g. x86 "lea" instruction) -- which should NOT be dependent upon the value stored in the memory. The x86 backend actually uses a "Ts" constraint for `*lea<mode>` which is defined by `define_address_constraint`, documented <https://gcc.gnu.org/onlinedocs/gccint/Define-Constraints.html> as making a constraint that is basically equivalent to p (just with different limits as to what kinds of addresses are accepted.)

"p" and other define_address_constraints are also used a lot for "prefetch" kinds of instructions, which also should not be memory-value-dependent.

So, at least per that description, and usage within GCC, I think LLVM's previous behavior of allowing it to move past a store to the same address actually seems correct?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145416/new/

https://reviews.llvm.org/D145416



More information about the cfe-commits mailing list