Currently, when converting an i8 loaded value to an i1 IR value, the canonical pattern is:<div><br></div><div>%x.1 = and i8 %x, 1</div><div>%x.2 = icmp ne i8 %x, 0</div><div><br></div><div>This seems really cumbersome. The natural way to represent this is:</div>
<div><br></div><div>%x.2 = trunc i8 %x to i1</div><div><br></div><div>But for some reason instcombine canonicalizes it to the first pattern. I feel like the second pattern is easier to reason about, easier to match in further peep-hole optimizations, easier to fold with surrounding zext operations, and easier to teach codegen to be clever about and eliminate altogether given range metadata. Thoughts? I've attached the trivial change to the code, but the real question is: do we want to do this? Why or why not?</div>
<div><br></div><div>At the very least, it'll make opt IR smaller. ;]</div>