This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix t2BF_LabelPseudo.isTerminator
Needs ReviewPublic

Authored by lenary on Apr 14 2023, 5:25 AM.

Details

Summary

This pseudo represents a label definition, so it doesn't finish a basic
block (and it must not be duplicated, and it doesn't insert any
instructions).

This was found with a downstream run with EXPENSIVE_CHECKS enabled, where
this pseudo is introduced and used.

Diff Detail

Event Timeline

lenary created this revision.Apr 14 2023, 5:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 5:25 AM
lenary requested review of this revision.Apr 14 2023, 5:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 5:25 AM
lenary edited the summary of this revision. (Show Details)Apr 14 2023, 5:27 AM
lenary added reviewers: simonwallis2, stuij.

I hadn't realized these were upstream. They probably needn't be without the rest of the pass. I believe internally these they are both terminators and non-terminators. In that they can be generated between two non terminators or between two terminators. That obviously doesnt make sense, and I think the whole thing probably needs to be rewritten. Thats not been very high priority though.

I hadn't realized these were upstream. They probably needn't be without the rest of the pass. I believe internally these they are both terminators and non-terminators. In that they can be generated between two non terminators or between two terminators. That obviously doesnt make sense, and I think the whole thing probably needs to be rewritten. Thats not been very high priority though.

Yeah, understanding this Pseudo is really only possible with the downstream code, and we only got the EXPENSIVE_CHECKS failures downstream, but I realised this code is upstream which is why I put the fix upstream. If you have a better idea for the patch, feel free to commandeer it, or have someone like @simonwallis2 do so.

This patch certainly seems like an improvement, but I'm not sure what happens if the pseudo is in a terminator position but isn't marked as a terminator. Providing that doesn't go wrong I have no objections. Either way in the long run it should probably be cleaned up to perhaps be a pair of different pseudos.

Either way in the long run it should probably be cleaned up to perhaps be a pair of different pseudos.

There are other solutions that have been added to LLVM, like preInstrSymbol and postInstrSymbol, which might be more apt now, depending on the intended semantics (though, this should still be right, based on the code that's upstream for how these are emitted. I don't have access to the downstream code any more, so I can no longer verify, and on the same basis, I likely need someone from Arm to commandeer this patch from me anyway.