This is basically D108837 but for jump threading. Free instructions should be ignored for the threading decision. JumpThreading already skips some free instructions (like pointer bitcasts), but does not skip various free intrinsics -- in fact, it currently gives them a fairly large cost of 2.
Details
Diff Detail
Unit Tests
Event Timeline
If desired, I could reduce this patch to just the TCC_Free check though.
Yes, please.
This LG.
I can see why it may be good to migrate to proper TTI costs here,
but the main question that raises are:
- in -Oz, should we be checking codesize cost?
- Changing heuristics will obviously affect optimization power. What does this does to the budget? Should we increase it to retain most of the current optimization power?
This caused compiler crash when building Chromium. See https://bugs.chromium.org/p/chromium/issues/detail?id=1252762#c8 for a reproducer, and the top of that bug for the stack dump.
I've reverted in 4604695d7c20e72b551a1a5224f3de877cb41bd3 in the meantime.
@hans Do I understand correctly that this change was mistakenly reverted and can be reapplied now that the DSE issue is fixed?
Yes, it looks like the DSE change was the real issue. Sorry for the noise. I'll re-apply this one unless you beat me to it.
clang-tidy: warning: invalid case style for parameter 'TTI_' [readability-identifier-naming]
not useful
clang-tidy: warning: invalid case style for parameter 'LVI_' [readability-identifier-naming]
not useful