This is an archive of the discontinued LLVM Phabricator instance.

[X86] Remove extra getOperand(0) call from recently introduced store(extract_element(vtrunc)) to truncated store combine.
ClosedPublic

Authored by craig.topper on Aug 23 2020, 11:29 PM.

Details

Summary

The IsExtractedElement already called getOperand(0) so Extract
here is the source vector. We shouldn't call getOperand(0). This
worked for the original test cases because the result was a
bitcast so the getOperand(0) accidently peeked through the bitcast
which is what we wanted.

In the failing case here, the operand turns out to be undef so
the getOperand(0) asserts because undef has no operands.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25184

Diff Detail

Event Timeline

craig.topper created this revision.Aug 23 2020, 11:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2020, 11:29 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
craig.topper requested review of this revision.Aug 23 2020, 11:29 PM

@spatel Does this look ok to you? I think @RKSimon is on vacation.

spatel accepted this revision.Aug 25 2020, 12:39 PM

LGTM

This revision is now accepted and ready to land.Aug 25 2020, 12:39 PM
spatel added inline comments.Aug 25 2020, 12:41 PM
llvm/test/CodeGen/X86/oss-fuzz-25184.ll
15–17

Might want to avoid the undefs here to make the test less fragile. These reducer tests tends to wiggle when we improve undef handling.

craig.topper added inline comments.Aug 25 2020, 4:02 PM
llvm/test/CodeGen/X86/oss-fuzz-25184.ll
15–17

Unfortunately, the undefs seem to be necessary to get into the scenario that triggered the assert that caught the issue.