aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authormacurtis-amd <macurtis@amd.com>2025-07-16 06:37:08 -0500
committerGitHub <noreply@github.com>2025-07-16 06:37:08 -0500
commit402b989693a0d5d17be6bf996bce52cf3ca73886 (patch)
treee4bf3ff6c0e7ca5c5e681203a9cb84e3cf029fd0 /clang/lib/Frontend/InitPreprocessor.cpp
parent3b8a18c27a1e70895feac15d48b3a6122e6b377f (diff)
downloadllvm-402b989693a0d5d17be6bf996bce52cf3ca73886.zip
llvm-402b989693a0d5d17be6bf996bce52cf3ca73886.tar.gz
llvm-402b989693a0d5d17be6bf996bce52cf3ca73886.tar.bz2
AMDGPU: Fix assert when multi operands to update after folding imm (#148205)
In the original motivating test case, [FoldList](https://github.com/llvm/llvm-project/blob/d8a2141ff98ee35cd1886f536ccc3548b012820b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp#L1764) had entries: ``` #0: UseMI: %224:sreg_32 = S_OR_B32 %219.sub0:sreg_64, %219.sub1:sreg_64, implicit-def dead $scc UseOpNo: 1 #1: UseMI: %224:sreg_32 = S_OR_B32 %219.sub0:sreg_64, %219.sub1:sreg_64, implicit-def dead $scc UseOpNo: 2 ``` After calling [updateOperand(#0)](https://github.com/llvm/llvm-project/blob/d8a2141ff98ee35cd1886f536ccc3548b012820b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp#L1773), [tryConstantFoldOp(#0.UseMI)](https://github.com/llvm/llvm-project/blob/d8a2141ff98ee35cd1886f536ccc3548b012820b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp#L1786) removed operand 1, and entry #&#8203;1.UseOpNo was no longer valid, resulting in an [assert](https://github.com/llvm/llvm-project/blob/4a35214bddbb67f9597a500d48ab8c4fb25af150/llvm/include/llvm/ADT/ArrayRef.h#L452). This change defers constant folding until all operands have been updated so that UseOpNo values remain stable.
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions