scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 39b40b941b5658db5728d641191e8eaa632e8671
parent 1058d554d1451fa1d7b1f09ca9d6b8cfeb7e18ed
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  6 Jan 2025 09:01:09 +0100

cc2: Change order of branches in logicexpr()

All the branches should go to false in case of false, what means
that the normal control flow will go to the case 1 without branching.

Diffstat:
Msrc/cmd/scc-cc/cc2/sethi.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cmd/scc-cc/cc2/sethi.c b/src/cmd/scc-cc/cc2/sethi.c @@ -80,13 +80,13 @@ logicexpr(Node *np) zero = constnode(NULL, 0, tp); one = constnode(NULL, 1, tp); - p = assignnode(tp, tmpnode(tp, tmpsym), zero); - prestmt(labelstmt(p, false)); + p = assignnode(tp, tmpnode(tp, tmpsym), one); + prestmt(labelstmt(p, true)); prestmt(branchnode(NULL, phi)); - p = assignnode(tp, tmpnode(tp, tmpsym), one); - prestmt(labelstmt(p, true)); + p = assignnode(tp, tmpnode(tp, tmpsym), zero); + prestmt(labelstmt(p, false)); prestmt(labelstmt(NULL, phi)); delstmt(np);