[llvm] [SLP] NFC. Use InstructionsState::valid if users just want to know whether VL has same opcode. (PR #120217)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 07:10:02 PST 2025


alexey-bataev wrote:

> > getMainOp and getAltOp should assert if the state is invalid
> 
> Cannot. `TreeEntry` will use `InstructionsState::getMainOp` and `InstructionsState::getAltOp`. But the `InstructionsState` may be invalid (`newTreeEntry` may get an invalid `InstructionsState`).

It must be fixed. TreeEntry shall check if the state is valid and only after using getMainOp and getAltOp. Otherwise, use nullptr

https://github.com/llvm/llvm-project/pull/120217


More information about the llvm-commits mailing list