Commit Graph

4 Commits

Author SHA1 Message Date
Sanjay Patel f75b5305f4 [ConstantFold] allow folding icmp of null and constexpr
I noticed that we were not folding expressions like this:
icmp ult (constexpr), null
in https://llvm.org/PR49355, so we end up with extremely large
icmp instructions as the constant expressions pile up on each other.

There is no potential to mis-fold an unsigned boundary condition
with a zero/null, so this is just falling through a crack in the
pattern matching.

The more general case of comparisons of non-zero constants and
constexpr are more tricky and may require the datalayout to know
how to cast to different types, etc. Negative tests verify that
we are only changing a subset of potential patterns.

Differential Revision: https://reviews.llvm.org/D98150
2021-03-08 08:53:59 -05:00
Sanjay Patel a093942c28 [ConstProp][JumpThreading] add more test coverage for potential nullptr folds; NFC
See D98150.
2021-03-08 08:53:59 -05:00
Sanjay Patel 962c6fda4d [JumpThreading] auto-generate complete test checks; NFC 2021-03-08 08:26:16 -05:00
Juneyoung Lee 1ea8465337 [JumpThreading] Merge/rename thread-two-bbsN.ll tests; NFC 2020-08-04 17:07:28 +09:00