diff options
author | drh <> | 2025-06-30 11:04:55 +0000 |
---|---|---|
committer | drh <> | 2025-06-30 11:04:55 +0000 |
commit | e2e81e69830bd25ff82bb8ac60d039a8e0efe971 (patch) | |
tree | 734c9f36d831d293f133f7d9e1da39174bada516 /src/expr.c | |
parent | e24f20a4f5a6d26cdaece58eff77619a4ee757b9 (diff) | |
download | sqlite-e2e81e69830bd25ff82bb8ac60d039a8e0efe971.tar.gz sqlite-e2e81e69830bd25ff82bb8ac60d039a8e0efe971.zip |
Slightly smaller and faster version of the previous check-in.
FossilOrigin-Name: f6e6fd02f4ad49c390a2d3c9626d57f9b2fff1f67eb361b30074cc1f5121810e
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/expr.c b/src/expr.c index de729ea62..a2df740af 100644 --- a/src/expr.c +++ b/src/expr.c @@ -6137,20 +6137,12 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ break; } case TK_IS: - case TK_ISNOT: { + case TK_ISNOT: testcase( pExpr->op==TK_IS ); testcase( pExpr->op==TK_ISNOT ); - if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; op = (pExpr->op==TK_IS) ? TK_NE : TK_EQ; - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, dest, SQLITE_NULLEQ, - ExprHasProperty(pExpr,EP_Commuted)); - testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); - testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); - break; - } + jumpIfNull = SQLITE_NULLEQ; + /* no break */ deliberate_fall_through case TK_LT: case TK_LE: case TK_GT: @@ -6159,16 +6151,26 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ case TK_EQ: { int addrIsNull; if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; - addrIsNull = exprComputeOperands(pParse, pExpr, - &r1, &r2, ®Free1, ®Free2); + if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){ + addrIsNull = exprComputeOperands(pParse, pExpr, + &r1, &r2, ®Free1, ®Free2); + }else{ + r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); + addrIsNull = 0; + } codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted)); assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); - assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); - assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); + assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); + VdbeCoverageIf(v, op==OP_Eq && jumpIfNull==SQLITE_NULLEQ); + VdbeCoverageIf(v, op==OP_Eq && jumpIfNull!=SQLITE_NULLEQ); + assert(TK_NE==OP_Ne); testcase(op==OP_Ne); + VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); + VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); testcase( regFree1==0 ); testcase( regFree2==0 ); if( addrIsNull ){ |