[llvm] [InstCombine] Allow folding casts into PNs if both from/to types are illegal (PR #171675)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 24 07:07:13 PST 2025


dtcxzyw wrote:

> I don’t think it’s possible to generalize this in shouldChangeType without preventing infinite loops, unless changing direction strategy.

https://github.com/llvm/llvm-project/compare/main...dtcxzyw:llvm-project:perf/instcombine-change-type seems to work.
I don't think this may cause infinite loops, as the underlying optimization must consume an explicit cast instruction. BTW, we have allowed bidirectional conversion for cases where both the from type and to type are legal. So it should be fine for desirable types as well.

https://github.com/llvm/llvm-project/pull/171675


More information about the llvm-commits mailing list