[llvm] Fix stack layout for frames larger than 2gb (PR #84114)

Wesley Wiser via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 19:19:38 PDT 2024


wesleywiser wrote:

@RKSimon thanks for the ping! I've been away last week and haven't had a ton of time to look deeply at it. The crux of the issue is that with my changes, we correctly calculate the offset to various stack locals as being larger than will fit in a 32-bit displacement:

```
MOV8mi $rsp, 1, $noreg, 4294967167, $noreg, 42 :: (store (s8) into %ir.3)
```

If my understanding of x86_64 displacements is correct, then the verification failure is entirely valid as this can't be represented by the displacement. I'm not sure what the right way to fix this is. I think I could change the Prologue/Epilogue Inserter to insert an `lea` to calculate the right address and then perform the `mov`. 

Is there an existing way to handle this? It seems like this kind of situation could occur in many different parts of x86_64 codegen. 


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


More information about the llvm-commits mailing list