This is an archive of the discontinued LLVM Phabricator instance.

[X86] When selecting sse_load_f32/f64 pattern, make sure there's only one use of every node all the way back to the root of the match
ClosedPublic

Authored by craig.topper on Aug 20 2017, 1:14 PM.

Details

Summary

With masked operations, its possible for the operation node like fadd, fsub, etc. to be used by multiple different vselects. Since the pattern matching will start at the vselect, we need to make sure the operation node itself is only used once before we can fold a load. Otherwise we'll end up folding the same load into multiple instructions.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 20 2017, 1:14 PM
craig.topper retitled this revision from [X86] When selecting sse_load_f32/f64 pattern, make sure there's only one use of every note all the way back to the root of the match to [X86] When selecting sse_load_f32/f64 pattern, make sure there's only one use of every node all the way back to the root of the match.
zvi added inline comments.Aug 21 2017, 12:57 AM
lib/Target/X86/X86ISelDAGToDAG.cpp
1541

The comment says it is not legal. Do you have an example for an *illegal* fold or should the wording be changed?

Reword comment.

This revision was automatically updated to reflect the committed changes.