From: Sergey Andreenko Date: Tue, 22 Oct 2019 23:53:03 +0000 (-0700) Subject: Priority of the '&&' operation is higher than that of the '||' operation (dotnet... X-Git-Tag: submit/tizen/20210909.063632~11030^2~278 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f651f660138105dfdc7eb78c7e1145af384ba4f3;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Priority of the '&&' operation is higher than that of the '||' operation (dotnet/coreclr#27367) It is a noway assert that was added before 2010, so that is hard to say what was the idea here. However, the code before and the examples after show that there is no difference between `GT_EQ` and `GT_NE` and in both cases `c(omparand)` must be the first child of the compare node `t`. Exisiting comments that confirm that it should be ((a &&b ) || c). /* t1:c1==0 t2:c2==0 ==> Branch to BX if either value is 0 /* t1:c1!=0 t2:c2!=0 ==> Branch to BX if either value is non-0 Commit migrated from https://github.com/dotnet/coreclr/commit/71fe5c4796cd01fa62e202aab2ebc180d0e4a799 --- diff --git a/src/coreclr/src/jit/optimizer.cpp b/src/coreclr/src/jit/optimizer.cpp index 15aa566f7d6..169c9ad6400 100644 --- a/src/coreclr/src/jit/optimizer.cpp +++ b/src/coreclr/src/jit/optimizer.cpp @@ -8919,8 +8919,8 @@ void Compiler::optOptimizeBools() continue; } - noway_assert(t1->gtOper == GT_EQ || t1->gtOper == GT_NE && t1->AsOp()->gtOp1 == c1); - noway_assert(t2->gtOper == GT_EQ || t2->gtOper == GT_NE && t2->AsOp()->gtOp1 == c2); + noway_assert(t1->OperIs(GT_EQ, GT_NE) && t1->AsOp()->gtOp1 == c1); + noway_assert(t2->OperIs(GT_EQ, GT_NE) && t2->AsOp()->gtOp1 == c2); // Leave out floats where the bit-representation is more complicated // - there are two representations for 0.