Before 871556a494552c0f503eec17055f075bcd859937, we would return
TCC_Expensive for non-speculatable CTTZ/CTLZ, but the patch removed the
exit. I am not sure if that was intentional, but it seems now we also
treat un-speculatable CTLZ/CTTZ as non-expensive.
See the change in the test case. The current speculation limit in
SimplifyCFG is set so that a single expensive instruction can be
speculated, but in test9_loop and expensive and a cheap instruction
needs speculating, pushing it over the limit.
Note that currently the X86 backend considers CTTZ/CTLZ as cheap to speculate
on architectures like haswell or skylake, where it is actually quite expensive.
But that is a separate issue.
I think we would view this as a regression based on https://bugs.llvm.org/PR46203 / 2328cab16ccd8f17fee782c29fb844662c089fbb
Do we need to adjust the isCheapToSpeculateXXXX APIs to acknowledge the zero-is-undef parameter of the intrinsic?