This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Fix compound assign operator types
ClosedPublic

Authored by tbaeder on Jan 22 2023, 10:16 PM.

Details

Summary
Just like we do (or will do) for floating types, we need to take into
acocunt that the LHSComputationType, ResultType and type of the
expression (what we ultimately store) might be different.

Do this by emitting cast ops before and after doing the computation.

This fixes the test failures introduced by
490e8214fca48824beda8b508d6d6bbbf3d8d9a7 on big endian machines.

Diff Detail

Event Timeline

tbaeder created this revision.Jan 22 2023, 10:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2023, 10:16 PM
tbaeder requested review of this revision.Jan 22 2023, 10:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2023, 10:16 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

The casts emitted are similar to https://reviews.llvm.org/D140377 now.

tbaeder updated this revision to Diff 491238.Jan 22 2023, 10:49 PM

I know it hasn't been a week yet, but can someone take a look at this? It would unblock pushing more of the approved patches.

shafik accepted this revision.Jan 24 2023, 11:21 AM

LGTM

This revision is now accepted and ready to land.Jan 24 2023, 11:21 AM
This revision was landed with ongoing or failed builds.Jan 25 2023, 1:12 AM
This revision was automatically updated to reflect the committed changes.

Hi @tbaeder, I was looking for commits that mentions "fix" "assertion" or "crash" in the title, that are part of the main branch but not backported to release/16.x to be eventually released as clang-16.
I wonder what's the status of this and the related patches given that the commit that the summary mentions (490e8214fca48824beda8b508d6d6bbbf3d8d9a7) is present in release/16.x. I can also see that quite a few revert commits are also related to Interp.
It's probably the case that the mentioned change was removed from clang-16 by f6ea1af9a4b71d27de2dde629224af1220c5c85b.

Could you please confirm that the changes around Interp are consistent and no patches are missing from the release/16.x just to be sure?

All the interpreter work is experimental so it doesn't really need to be in the release branch. This should all be fine, thanks for asking.