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.<br>
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).<br><br>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.<br>
<br>Thanks for both replies.<br><br><br>