[all-commits] [llvm/llvm-project] db6bee: [RISCV] Fix miscompile in SExtWRemoval due to earl...
Philip Reames via All-commits
all-commits at lists.llvm.org
Wed Feb 8 11:46:02 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: db6bee5fec0d7fdfc18005c5c5ccd15f1ede945d
https://github.com/llvm/llvm-project/commit/db6bee5fec0d7fdfc18005c5c5ccd15f1ede945d
Author: Philip Reames <preames at rivosinc.com>
Date: 2023-02-08 (Wed, 08 Feb 2023)
Changed paths:
M llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
M llvm/test/CodeGen/RISCV/sextw-removal.ll
Log Message:
-----------
[RISCV] Fix miscompile in SExtWRemoval due to early return ignoring other sources
This code is walking back through a worklist of sources. All of the sources need to be sign extending for the result to be true. We had a case which returned rather than continued, which causes a miscompile when another source was not sign extended. The flawed logic was introduced in Dec 22, by change 844430bcc377.
This was recently exposed in a stage2 build of llvm-tablegen when we switched from using llvm::Optional to std::optional. The stars aligned in just the wrong way, and we started actively miscompiling idiomatic optional usage. std::optional<uint32_t> appears to use the top 32 bits of the word on RV64 for its tag.
Differential Revision: https://reviews.llvm.org/D143594
More information about the All-commits
mailing list