This is an archive of the discontinued LLVM Phabricator instance.

[Instcombine] Code refactors for foldSelectOpOp; NFC
ClosedPublic

Authored by bcl5980 on Nov 30 2022, 10:25 PM.

Details

Summary

Reuse the code about find common operator.

Diff Detail

Event Timeline

bcl5980 created this revision.Nov 30 2022, 10:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2022, 10:25 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
bcl5980 requested review of this revision.Nov 30 2022, 10:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2022, 10:25 PM
RKSimon added inline comments.Dec 1 2022, 6:32 AM
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
317–378

Possibly don't put MatchOp up here as it isn't touched by getCommonOp - use local 'MatchOp' variables for the places which call getCommonOp instead.

bcl5980 updated this revision to Diff 479287.Dec 1 2022, 7:11 AM

address comment

RKSimon added inline comments.Dec 1 2022, 10:29 AM
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
374

Do you need to match both - given you've tested the intrinsic ID above and don't get the operands anymore - maybe drop the FII match (or but it inside an assertion).

376

if (Value *MatchOp = getCommonOp(TI, FI, true)) {

bcl5980 updated this revision to Diff 479505.Dec 1 2022, 7:11 PM

address comments.

RKSimon accepted this revision.Dec 2 2022, 3:31 AM

LGTM

This revision is now accepted and ready to land.Dec 2 2022, 3:31 AM
This revision was landed with ongoing or failed builds.Dec 2 2022, 6:27 AM
This revision was automatically updated to reflect the committed changes.