After successfully commuting an instruction to be compatible with the current VGPR MSB mode, update CurrentMode with the commuted instruction's mode requirements. This locks in the mode bits the commuted instruction relies on, preventing later instructions from piggybacking and corrupting those bits. Without this fix, a subsequent instruction needing a different mode could piggyback onto the preceding s_set_vgpr_msb and change mode bits that the commuted instruction depends on. For example, a nullopt src1 position (treated as 0) could be overwritten to a different value, causing incorrect register encoding for the commuted instruction. The fix still allows compatible piggybacking - instructions that only add new mode bits without changing existing ones can still piggyback.
The LLVM Compiler Infrastructure ================================ This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments. LLVM is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. Please see the documentation provided in docs/ for further assistance with LLVM, and in particular docs/GettingStarted.rst for getting started with LLVM and docs/README.txt for an overview of LLVM's documentation setup. If you are writing a package for LLVM, see docs/Packaging.rst for our suggestions.