[RISCV][ISel] Fold extensions when all the users can consume them
This patch allows the combines that fold extensions in binary operations to have more than one use. The approach here is pretty conservative: if all the users of an extension can fold the extension, then the folding is done, otherwise we don't fold. This is the first step towards avoiding the one-use limitation. As a result, we make a decision to fold/don't fold for a web of instructions. An instruction is part of the web of instructions as soon as it consumes an extension that needs to be folded for all its users. Because of how SDISel works a web of instructions can be visited over and over. More precisely, if the folding happens, it happens for the whole web and that's the end of it, but if the folding fails, the whole web may be revisited when another member of the web is visited. To avoid a compile time explosion in pathological cases, we bail out earlier for webs that are bigger than a given threshold (arbitrarily set at 18 for now.) This size can be changed using `--riscv-lower-ext-max-web-size=<maxWebSize>`. At the current time, I didn't see a better scheme for that. Assuming we want to stick with doing that in SDISel. Differential Revision: https://reviews.llvm.org/D133739
Loading
Please sign in to comment