This is an archive of the discontinued LLVM Phabricator instance.

[IRSim] Treat Branch OperVals different from regular operands
ClosedPublic

Authored by AndrewLitteken on Dec 5 2022, 8:49 AM.

Details

Summary

Branch operands are different from regular instructions. They can have a mix of boolean values and branch instructions. This makes sure that branches are treated as more of a special case and makes sure that the successor blocks are always in the same order, and that they do not include the conditional argument.

Diff Detail

Event Timeline

AndrewLitteken created this revision.Dec 5 2022, 8:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 8:49 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
AndrewLitteken requested review of this revision.Dec 5 2022, 8:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 8:49 AM
paquette added inline comments.Dec 6 2022, 10:35 AM
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
102

This can use cast<>. Then you get an assertion on the wrong type for free.

https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates

114

I think this needs brackets around the isas otherwise the && will be evaluated first.

724–725

I think you can use cast<> for both of these.

855

could use a comment?

858

Why are these asserts after the if?

AndrewLitteken added inline comments.Dec 6 2022, 10:40 AM
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
858

If the sizes of the block information between the two branch instructions do not match, then we don't need to worry about whether the information contained in them is correct. This checks consistency between the two data structures concerning the same branch. I think this could go before the if statements, but I also don't know if it matters the order.

Updating based on comments, forgot to upload this diff several months ago

This revision is now accepted and ready to land.Mar 17 2023, 10:50 AM
This revision was landed with ongoing or failed builds.Mar 19 2023, 4:44 PM
This revision was automatically updated to reflect the committed changes.