This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Implement logical and/or operators
ClosedPublic

Authored by tbaeder on Dec 31 2022, 11:06 AM.

Diff Detail

Event Timeline

tbaeder created this revision.Dec 31 2022, 11:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 31 2022, 11:06 AM
tbaeder requested review of this revision.Dec 31 2022, 11:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 31 2022, 11:06 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane accepted this revision.Jan 3 2023, 7:18 AM
This revision is now accepted and ready to land.Jan 3 2023, 7:18 AM
shafik added inline comments.Jan 10 2023, 9:10 AM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
387
tbaeder marked an inline comment as done.Jan 10 2023, 10:38 PM

Assuming my understanding is correct, this LGTM!

clang/lib/AST/Interp/ByteCodeExprGen.cpp
376

Am I correct in understanding that the reason we don't need to emit a const bool for false is because visiting the RHS already pushes either true or false onto the stack because it's already been converted to a bool result?

tbaeder added inline comments.Jan 12 2023, 12:45 AM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
376

Both LHS and RHS push a bool result to the stack, but the jumpTruewill pop() the result of the LHS, so we need to push a true again if we want to use it later as the result of the binary operator.

aaron.ballman accepted this revision.Jan 12 2023, 6:27 AM
aaron.ballman added inline comments.
clang/lib/AST/Interp/ByteCodeExprGen.cpp
376

Thank you for the confirmation, that makes sense to me. LGTM!

This revision was landed with ongoing or failed builds.Jan 25 2023, 9:53 PM
This revision was automatically updated to reflect the committed changes.