Repository navigation
Conversation
…sk, or count expr2tags_Unop_DC now takes the operation. Unary operations whose result is a boolean, or a mask or count computed from the operand's bits (CmpNEZ*, CmpwNEZ*, 32to1, 64to1, Clz*, Ctz*, PopCount*, GetMSBs*), give the result tag 0, as binary comparisons do. All other unary operations return the tag of the operand, as before. The operand's tag is passed to MC_(helperc_RETURN_0) rather than discarded. Returning a constant tag would let VEX remove the operand's tag expression as dead code, along with any merge it performed. For example, in 'char lt = (a < b)' the merge of a and b would be lost.
The new option controls what happens when DynComp reaches the default case for a binary, ternary, or quaternary VEX operation that it does not handle. "panic" (the default) stops, as before. "warn" prints a warning once per operation and approximates the operation by merging its operands' tags.
expr2tags_Unop_DC now lists every unary operation, like the binary, ternary, and quaternary functions do, and an operation that DynComp does not handle reaches the default case. That case uses report_unhandled_op_DC, so --dyncomp-unhandled-ops=warn approximates an unhandled unary operation by returning its operand's tag.
This was referenced Oct 10, 2026
…perands Comparisons merge their operands' tags with a dirty call, so VEX cannot remove the merge when a later operation discards the comparison's tag. Unary operations that give tag 0 anchor their operand's tag with a dirty MC_(helperc_TAG_NOP) call (except in the dataflow modes) and return constant 0, replacing MC_(helperc_RETURN_0). Iop_32to1 and Iop_64to1 return the operand's tag again, because they also extract data bits. Iop_Cnt* and Iop_Cls* give tag 0. Add a regression test, dyncomp-unop-tag0-test.sh.
In warn mode, do not merge operands that appear to be rounding modes, shift amounts, or lane indices; treat boolean-valued ops as comparisons; and treat other ops as non-interactions in units and comparisons modes. Also realign and clarify the --help text.
Member
Author
|
@coderabbitai review |
✅ Action performedReview finished.
|
…omp-unop-all-cases
…unop-all-cases # Conflicts: # valgrind/fjalar/kvasir/dyncomp_translate.c
…unary operation codespecs#85 replaced report_unhandled_op_DC by approximate_unhandled_op_DC, which handled only binary, ternary, and quaternary operations. An unhandled unary operation still returns the tag of its operand.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request depends on #85 and #86, and it contains their commits. Please merge #85 and #86 first. After that, this pull request's diff shows only its own change.
Before this pull request, the list of unary operations in
expr2tags_Unop_DCwas only a comment. The binary, ternary, and quaternary functions instead switch on the operation and handle an operation that they do not know in thedefaultcase. This pull request makes the unary function consistent with them. It covers all 283 unary operations inVEX/priv/ir_defs.c(typeOfPrimop):Not,Neg, conversions,32to1,64to1, ...).The
defaultcase callsapproximate_unhandled_op_DC(from #85), which this pull request extends to unary operations. With--dyncomp-unhandled-ops=warn, an unhandled unary operation returns its operand's tag.The comment list contained two binary operations (
Iop_MulHi8Sx16andIop_MulHi8Ux16). They are not unary cases.This is one of three pull requests split from #83.