This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Don't use Builder.getTrue/False in foldICmpDivConstant
Needs ReviewPublic

Authored by craig.topper on Sep 28 2017, 3:15 PM.

Details

Reviewers
spatel
Summary

Builder.getTrue/False assumes a scalar comparison, but this code supports vector compares.

I'm having trouble proving that this code isn't dead due to InstSimplify so I don't have a test case. But it looked obviously wrong.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 28 2017, 3:15 PM
davide resigned from this revision.Sep 28 2017, 3:35 PM
davide added a subscriber: simon.f.whittaker.

I don't think I'm qualified to review this patch.

spatel edited edge metadata.Sep 29 2017, 11:37 AM

This looks similar to a block of code we have for foldOrOfICmps(). We can fold some cases to constants (so InstSimplify should get those), but some cases just become different compares.

Can we assert instead? In foldOrOfICmps(), it looks like:

assert(!RHSC->isMaxValue(false) && "Missed icmp simplification");
davide removed a reviewer: davide.Sep 29 2017, 12:24 PM