This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Add a helper function for creating a boolean constant based on the target's boolean content
ClosedPublic

Authored by craig.topper on Feb 7 2018, 11:49 AM.

Details

Summary

This has been split off from D42948 where I was trying to add vector support to SimplifySetCC.

Many in SimplifySetCC and FoldSetCC try to create true or false constants. Some of them query getBooleanContents to figure out whether to use all ones or just 1 for true. But many places do not check and just use 1 without ensuring the VT has an i1 scalar type. Note sure if those places only trigger before type legalization so they only see an i1
type?

To cleanup the inconsistency and reduce some duplicated code, this patch adds a getBoolConstant method to SelectionDAG that takes are of querying getBooleanContents and doing the right thing.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Feb 7 2018, 11:49 AM
spatel accepted this revision.Feb 8 2018, 7:09 AM

LGTM. Thanks for the cleanup!

This revision is now accepted and ready to land.Feb 8 2018, 7:09 AM
This revision was automatically updated to reflect the committed changes.