[PATCH] D122582: StackMap: Fix assertion on undef operands for anyregc

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 11:40:53 PDT 2022


dantrushin added a comment.

I'm sorry, I perhaps wasn't clear - English is not my native language. Let me try again.

First, StackMaps are used to communicate some (opaque to compiler) state to runtime.
Among other things, STATEPOINT passes set of pointers which need relocation to GC.
0xFEFEFEFE is a special sentinel value which means dead pointer. Now you just passing garbage to GC. (Theoretically this might be OK, practically I don't think so)

Second, current LLVM implementation supports passing pointers only in callee saved registers in StackMaps. If assigned by RA to other register, it must be spilled and that spill location must be recorded in StackMap instead.
This is what `FixupStatepointCallerSaved` pass does. Now you encode forbidden register in StackMap. Runtime will crash or behave strangely

Third, runtime might have enough knowledge of StackMap contents to wish to validate data types in it.
This is why 64-bit sentinel constant is used. And 64 bit constants are encoded via constant pool indexing. Now it will blow up.

PATCHPOINT is special pseudo with fancy encoding requirements. With `anyregcc` convention it requires function return value and arguments to be encoded in StackMap as well.
Obviously, it has different encoding requirements for THAT part.

I don't know if you really use PATHPOINT instruction or simply fixing some artificial test, but we use STATEPOINT instructions as described and you just broke it.

And, by the way, you test case does not make any sens to me. Is it correct to have a `dead` DEF with `undef` USE?  What that would mean?


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

https://reviews.llvm.org/D122582



More information about the llvm-commits mailing list