transpile: Flip comparison operators when negating in CFG#1773
Conversation
|
I think we need to have a discussion before landing this. Two arguments against it:
|
|
If a small change could mean that the transpiler produces better code without the refactorer, I think that's still a bonus. But your first point is true. I just don't know how faithful the transpiler already tries to be. In this particular case, the negations already happen because the relooper has done some significant changes to the structure of the code, such as translating |
|
I flagged this one as well in our internal c2rust discussion. I'm not super in favor, but if the others like it we can land it. |
|
This seems like a lateral move: The code is a bit simpler and more idiomatic, but it's also a bit farther from what the C was doing, which may then make it harder to cross-reference against the C code during later liftings. That said, I don't know if it makes cross-referencing the original C that much harder. The part that's more confusing is that we're inverting the control flow (e.g. Also, we're already doing this for So I guess I'm mildly in favor of this. It produces cleaner code, and the drawback to it seems pretty minor. |
Produces cleaner code, with relatively small changes.