[llvm] [InstSimplify] Fold `getelementptr inbounds null, idx -> null` (PR #130742)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 09:26:49 PDT 2025


dtcxzyw wrote:

> We've found that this also breaks SDL2, specifically somewhere in [SDL_render_gles2.c](https://github.com/libsdl-org/SDL/blob/release-2.32.x/src/render/opengles2/SDL_render_gles2.c). Unfortunately I haven't been able to narrow down the failure yet, I didn't see any obvious use of calculating offsets from nullptr or anything like that. The fix in #137851 didn't work for it.

https://github.com/libsdl-org/SDL/blob/8b7a088efc1ebf5c2e53ab40fdff48e6c05f0d82/src/render/opengles2/SDL_render_gles2.c#L1203
https://github.com/libsdl-org/SDL/blob/8b7a088efc1ebf5c2e53ab40fdff48e6c05f0d82/src/render/opengles2/SDL_render_gles2.c#L1275
https://github.com/libsdl-org/SDL/blob/8b7a088efc1ebf5c2e53ab40fdff48e6c05f0d82/src/render/opengles2/SDL_render_gles2.c#L978

Can you change `SDL_Vertex *verts = (SDL_Vertex *)(((Uint8 *)vertices) + cmd->data.draw.first);` into `SDL_Vertex *verts = (SDL_Vertex *)(((uintptr_t)vertices) + cmd->data.draw.first);`?


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


More information about the llvm-commits mailing list