Instructions that take immediate addresses sign-extend their operands, so cannot be used when we actually need zero extension. Use indirect addressing to avoid problems.
The functions in the test are a modified versions of the functions by the same names in large-constants.ll, with i64 types changed to i32.
Fixes #55061
The reasoning here seems strange. For example, suppose I write void f(int a) { ((char*)0x80000000)[a] = a; }. That has a base register, but sign-extension is wrong.
I guess you're trying to allow negative pointer offsets here, but I think SelectionDAG is throwing away the distinction you need here. (At the IR level, it's easy to distinguish between the base of a GEP and the offset.)