This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeVectorOps] Pass the post-UpdateNodeOperands version of the Node to the LowerOperation/PromoteNode/ExpandNode calls
AbandonedPublic

Authored by craig.topper on Dec 24 2019, 2:37 PM.

Details

Summary

Its possible though very unlikely that the UpdateNodeOperands call that is made after legalizing operands will CSE to an existing node. When this happens we end up with Result pointing to a different node than Op. When this happens, in order to make sure the legalized operands propagate correctly, we need to use Result in the LowerOperation, ExpandNode, or PromoteNode calls made later.

While this fix works, I think this may result in Result being legalized twice because we aren't registering it in the LegalizedNodes map as itself. Maybe another option is to specifically detect this case and recursively call LegalizeOp on the node, then just call TranslateLegalizeResults to register it for Op?

Diff Detail

Event Timeline

craig.topper created this revision.Dec 24 2019, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 24 2019, 2:37 PM

Update a debug message as well.

efriedma added inline comments.Dec 29 2019, 9:59 PM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
270

Same issue here?

295

Same issue here?

475

Looks like we got this right in the other calls to LowerOperation, just not this one. Odd.

craig.topper abandoned this revision.Jan 6 2020, 3:27 PM