This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAGBuilder] Respect getBooleanContents in copies to VRegs
AbandonedPublic

Authored by tlively on Jan 7 2019, 10:02 PM.

Details

Reviewers
dschuff
aheejin
Summary

Fixes https://bugs.llvm.org/show_bug.cgi?id=40172. See
test/CodeGen/WebAssembly/bug-40172.ll for an explanation. The changes
to X86 codegen are unfortunate if they are unnecessary, and I'd be
happy to accept feedback on how to make this fix less disruptive.

Diff Detail

Event Timeline

tlively created this revision.Jan 7 2019, 10:02 PM
craig.topper added a subscriber: craig.topper.EditedJan 7 2019, 10:31 PM

Is the zext/cmp optimization in WebAssemblyFastISel::zeroExtendToI32 really valid? Do other targets do that? If that had instead emitted an And with i1 like X86 does. The any_extend wouldn't have been an issue.

nikic added a subscriber: nikic.Jan 8 2019, 12:16 AM

Is the zext/cmp optimization in WebAssemblyFastISel::zeroExtendToI32 really valid? Do other targets do that? If that had instead emitted an And with i1 like X86 does. The any_extend wouldn't have been an issue.

The FastISel optimization is correct as long as the CmpInst is also lowered by FastISel. I will have to think more about whether that is a valid assumption. But that FastISel logic does not actually affect the bug in question. See the continued discussion on the bug itself.

One question I have about this is whether BooleanContents should apply to *all* i1 values, which is what this patch assumes, or whether it should only apply to certain i1 values that are logically Boolean because they are the result of a setcc or similar. If BooleanContents should only apply to some i1s, this fix is overly conservative.

tlively abandoned this revision.Jan 8 2019, 2:42 PM

This is superseded by D56457.