[all-commits] [llvm/llvm-project] 6eb8c3: [RISCV] Fix a latent miscompile in doPeepholeMaske...
Philip Reames via All-commits
all-commits at lists.llvm.org
Fri Jun 16 16:52:56 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6eb8c35d845d2e4698df9ec4ecb103933b018087
https://github.com/llvm/llvm-project/commit/6eb8c35d845d2e4698df9ec4ecb103933b018087
Author: Philip Reames <preames at rivosinc.com>
Date: 2023-06-16 (Fri, 16 Jun 2023)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Log Message:
-----------
[RISCV] Fix a latent miscompile in doPeepholeMaskedRVV
The code was using the tail policy being "agnostic" to select a instruction whose semantics were "undefined". This was almost always fine (as the pass through operand was usually implicit_def), but could in theory lead to a miscompile. I don't actually have a test case as it requires a later transform to exploit the wrong tail policy state, and I couldn't easily figure out to get vsetvli insertion to miscompile given the wrong state. This was spotted by inspection, and it may be a miscompile in theory only at the moment.
Note that this may cause regressions if there are instructions for which we either don't have a _TU pseudo form, or the _TU pseudo form is missing a policy operand. When I was first looking at this, I saw exactly that, and D153067 exists to add the missing policy operand I noticed.
As a later follow up, I want to always force the use of _TU, but it seemed good to fix the bug, then driven the _TU transition in a separate patch.
Differential Revision: https://reviews.llvm.org/D153070
More information about the All-commits
mailing list