aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorFabian Ritter <fabian.ritter@amd.com>2025-03-18 12:30:20 +0100
committerGitHub <noreply@github.com>2025-03-18 12:30:20 +0100
commit332f0603635d06986d6d3c8c9ba4fee04c7cab18 (patch)
treec2a2e3c029f60f41d35a78b0197b647d09105ef3 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent9cf46fb2303627fd2c74ed88dcd9f3f8cbfe0c93 (diff)
downloadllvm-332f0603635d06986d6d3c8c9ba4fee04c7cab18.zip
llvm-332f0603635d06986d6d3c8c9ba4fee04c7cab18.tar.gz
llvm-332f0603635d06986d6d3c8c9ba4fee04c7cab18.tar.bz2
[SeparateConstOffsetFromGEP] Don't set unsound inbounds flag (#130616)
The language reference says about inbounds geps that "if the getelementptr has any non-zero indices[...] [t]he base pointer has an in bounds address of the allocated object that it is based on [and] [d]uring the successive addition of offsets to the address, the resulting pointer must remain in bounds of the allocated object at each step." If (gep inbounds p, (a + 5)) is translated to (gep [inbounds] (gep p, a), 5) with p pointing to the beginning of an object and a=-4, as the example in the comments suggests, that's the case for neither of the resulting geps. Therefore, we need to clear the inbounds flag for both geps. We might want to use ValueTracking to check if a is known to be non-negative to preserve the inbounds flags. For the AMDGPU tests with scratch instructions, removing the unsound inbounds flag means that AMDGPUDAGToDAGISel::isFlatScratchBaseLegal sees no NUW flag at the pointer add, which prevents generation of scratch instructions with immediate offsets. For SWDEV-516125.
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions