[LLVMdev] Illegal node introduced by DAGCombiner after legal phase

Borja Ferrer borja.ferav at gmail.com
Mon Aug 27 09:53:20 PDT 2012


Although I'm working on an out of tree target, this bug also happens for
the MSP430 target since we both share the limitation that shifts have to be
done in one bit at a time, that's why we need custom lowering.
Micah, I don't have commit access to fix it but the shl is getting
generated in line 1770 of DAGCombiner.cpp (inside the visitMUL function)
(fold (mul x, (1 << c)) -> x << c).

But there's something more about the design of how this works, if the
dagcombiner can potentially add illegal nodes after legalization, some of
these illegal nodes are going to be "cheaper" (shl vs mul) than not
performing the combine at all so maybe the custom lowering code could be
run again to catch these cases. I haven't thought too much about this, but
leaving a (mul x, 2) around doesn't sound too right.

Thanks for both replies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120827/8e2be56d/attachment.html>


More information about the llvm-dev mailing list