aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorYingwei Zheng <dtcxzyw2333@gmail.com>2025-06-04 17:48:01 +0800
committerGitHub <noreply@github.com>2025-06-04 17:48:01 +0800
commite2c698c7e836306f1a25c67597ae9e25a1fcc575 (patch)
tree355eb84be2cb8c5ac107a4ddb1bae8e9deba8aa2 /clang/lib/CodeGen/CodeGenModule.cpp
parent9ba332f9963561bb5ac6933266afe38eb8fde8cd (diff)
downloadllvm-e2c698c7e836306f1a25c67597ae9e25a1fcc575.zip
llvm-e2c698c7e836306f1a25c67597ae9e25a1fcc575.tar.gz
llvm-e2c698c7e836306f1a25c67597ae9e25a1fcc575.tar.bz2
[InstCombine] Fix miscompilation in `sinkNotIntoLogicalOp` (#142727)
Consider the following case: ``` define i1 @src(i8 %x) { %cmp = icmp slt i8 %x, -1 %not1 = xor i1 %cmp, true %or = or i1 %cmp, %not1 %not2 = xor i1 %or, true ret i1 %not2 } ``` `sinkNotIntoLogicalOp(%or)` calls `freelyInvert(%cmp, /*IgnoredUser=*/%or)` first. However, as `%cmp` is also used by `Op1 = %not1`, the RHS of `%or` is set to `%cmp.not = xor i1 %cmp, true`. Thus `Op1` is out of date in the second call to `freelyInvert`. Similarly, the second call may change `Op0`. According to the analysis above, I decided to avoid this fold when one of the operands is also a user of the other. Closes https://github.com/llvm/llvm-project/issues/142518.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions