Two changes:
- Make some cases that conditionally returned unconditional.
- In cases of Op0 != 0 || Op1 != 0 its better check Op1 first as its more likely to be a constant due to canonicalization (so faster to get knownbits of).
Paths
| Differential D149419
[ValueTracking] Slight refactor to avoid unnecessary work; NFC ClosedPublic Authored by goldstein.w.n on Apr 27 2023, 11:22 PM.
Details Summary Two changes:
Diff Detail
Event TimelineComment Actions
I'm not sure this is right: If Op1 is constant, then isKnownNonZero will in practice always return true, because the zero cases get folded away. So we do the call on Op0 anyway.
Comment Actions
Hmm? In something like the Or case if we have or A, 12, isKnownNonZero(Op1) || isKnownOpZero(Op0) will return true after just finding the constant 12. If you flip the order Comment Actions
Oh yeah, you're right. Ignore what I said there. I was thinking of the && case, not the || case. This revision is now accepted and ready to land.Apr 28 2023, 2:51 PM Closed by commit rG424b10d6cc05: [ValueTracking] Slight refactor to avoid unnecessary work; NFC (authored by goldstein.w.n). · Explain WhyApr 30 2023, 8:08 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 517803 llvm/lib/Analysis/ValueTracking.cpp
|
This one should probably also be changed to return directly?