Commit 4ab214c
JIT: fix profile likelihood and overflow UB in optimizebools
Fix two issues in optOptimizeBoolsUpdateTrees and GetIntersection:
1. The !sameTarget branch likelihood formula was computing
(1-p1) + p1*p2_false = 1 - p1*p2_true, but the correct
probability of reaching B2's true target is
(1-p1) * p2_true (B1 falls through, then B2 jumps).
Also fixed the misleading comment.
2. The normalize lambda in GetIntersection could overflow
when cns == SSIZE_T_MAX and cmp == GT_GT (signed overflow
is UB in C++). Added an explicit guard and made the lambda
return bool to signal failure.
3. Updated a stale comment referencing the nonexistent
GTF_BOOLEAN flag in optIsBoolComp.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d751cbe commit 4ab214c
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
| 451 | + | |
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
455 | 459 | | |
456 | 460 | | |
457 | 461 | | |
458 | 462 | | |
459 | 463 | | |
460 | 464 | | |
| 465 | + | |
461 | 466 | | |
462 | 467 | | |
463 | 468 | | |
464 | | - | |
| 469 | + | |
465 | 470 | | |
466 | | - | |
467 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
468 | 475 | | |
469 | 476 | | |
470 | 477 | | |
| |||
1234 | 1241 | | |
1235 | 1242 | | |
1236 | 1243 | | |
1237 | | - | |
1238 | | - | |
| 1244 | + | |
| 1245 | + | |
1239 | 1246 | | |
1240 | 1247 | | |
1241 | 1248 | | |
| |||
1244 | 1251 | | |
1245 | 1252 | | |
1246 | 1253 | | |
1247 | | - | |
| 1254 | + | |
1248 | 1255 | | |
1249 | 1256 | | |
1250 | 1257 | | |
| |||
1412 | 1419 | | |
1413 | 1420 | | |
1414 | 1421 | | |
1415 | | - | |
| 1422 | + | |
1416 | 1423 | | |
1417 | | - | |
| 1424 | + | |
1418 | 1425 | | |
1419 | 1426 | | |
1420 | 1427 | | |
| |||
0 commit comments