[PATCH] D37230: Set hasSideEffects=0 for TargetOpcode::BUNDLE

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 26 10:59:54 PST 2017


bjope added a comment.

A BUNDLE instruction is supposed to describe the combined properties of the bundled instructions (at least when it comes to machine operands). Properties like hasSideEffects/mayLoad/mayStore are static, so we can't update those properties for the BUNDLE instruction depending on the properties of the bundled instructions. So maybe it is a good idea to have the defensive approach of letting the BUNDLE instruction have hasSideEffects=1.

Afaik some machine intruction analyses/passes does not look inside the bundle (e.g. iterating using a MachineInstrBundleIterator).
If we set hasSideEffects=0 on the BUNDLE instruction, then that information can't be trusted anyway in case one of the bundled instructions has hasSideEffects=1. Or otherwise I think we need to avoid bundling of instructions with hasSideEffects=1.
If a pass/analysis is smart enough to look inside the BUNDLE, then I guess it can check if all of the bundled instructions has hasSideEffects=0 and ignore the hasSideEffects=1 on the BUNDLE instruction.

Maybe we need to update documentation related to the BUNDLE instruction to describe this better.


https://reviews.llvm.org/D37230





More information about the llvm-commits mailing list