[all-commits] [llvm/llvm-project] 495d3e: [MachineSink][RISCV] Only call isConstantPhysReg o...
Craig Topper via All-commits
all-commits at lists.llvm.org
Wed Jul 17 13:07:21 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 495d3ea989d4e97ce77ee73d6b35b171a7346019
https://github.com/llvm/llvm-project/commit/495d3ea989d4e97ce77ee73d6b35b171a7346019
Author: Craig Topper <craig.topper at sifive.com>
Date: 2024-07-17 (Wed, 17 Jul 2024)
Changed paths:
M llvm/lib/CodeGen/MachineSink.cpp
A llvm/test/CodeGen/RISCV/sink-and-fold-crash.mir
Log Message:
-----------
[MachineSink][RISCV] Only call isConstantPhysReg or isIgnorableUse for uses. (#99363)
The included test case contains X0 as a def register. X0 is considered a
constant register when it is a use. When its a def, it means to throw
away the result value.
If we treat it as a constant register here, we will execute the continue
and not assign `DefReg` to any register. This will cause a crash when
trying to get the register class for `DefReg` after the loop.
By only checking isConstantPhysReg for uses, we will reach the `return
false` a little further down and stop processing this instruction.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list