← Back to Pull requests

Encode DemandedBits #787

Merged
manasij7479 merged 19 files (68 lines) on Oct 01, 2020 14:34 UTC
View on GitHub
manasij7479 manasij7479 commented on Sep 23, 2020 17:41 UTC
Author

No description provided by author.

Diff: 68 lines (+59 / -9) across 19 files Reviewer: regehr Review duration: 11332m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.57) × (1 − Review Confidence (0.92)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 68 lines diff across 19 files
0.57
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.92 · 5 substantive comment(s)
0.92
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
91%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.253
Mass File Touch mass_file_touch
0.080
Real PR Conversation Timeline
15 items
regehr regehr commented on Sep 24, 2020 20:03 UTC
Contributor

of course this needs test cases. probably you can reuse our existing demanded bits test cases by adding a new run line to them and turning on alive double checking in the new run lines, right?

manasij7479 manasij7479 commented on Sep 30, 2020 00:41 UTC
Author

Turned on alive2 flags for the demanded bits tests, except for the 2 test cases which involve phi.

regehr regehr commented on code on Sep 30, 2020 19:34 UTC
Code Review
lib/Infer/AliveDriver.cpp:1
@@ -777,6 +791,26 @@ souper::AliveDriver::translateDataflowFacts(const souper::Inst* I,
   }
 }
 
+bool
+souper::AliveDriver::translateDemandedBits(const souper::Inst* I,
+                     IR::Function& F,
+                     souper::AliveDriver::Cache& ExprCache) {
+  FunctionBuilder Builder(F);
+
+  auto DemandedBits = IsLHS ? I->DemandedBits : LHS->DemandedBits;
+
+  if (DemandedBits.isAllOnesValue() || DemandedBits.getBitWidth() != I-> Width) {

this second clause, what is it doing?

regehr regehr commented on code on Sep 30, 2020 19:34 UTC
Code Review
lib/Infer/AliveDriver.cpp:1
@@ -777,6 +791,26 @@ souper::AliveDriver::translateDataflowFacts(const souper::Inst* I,
   }
 }
 
+bool

if this function cannot fail, please make it return void

regehr regehr commented on code on Sep 30, 2020 19:36 UTC
Code Review
test/Dataflow/demanded-bits10-invalid.opt:1
@@ -1,6 +1,6 @@
 
 
-; RUN: %souper-check %s > %t 2>&1
+; RUN: %souper-check -souper-use-alive %s > %t 2>&1

I think in this instance (and a bunch of others) you've made alive testing better, but you have made testing of the klee backend worse, because you're changing the query

instead of removing the existing souper-check invocation, I think you should make this test case (and the others) contain two RUN: lines, one of which targets one backend, the other of which targets the other one

regehr regehr commented on Sep 30, 2020 19:36 UTC
Contributor

looks good other than 3 minor comments I just left

zhengyang92 zhengyang92 commented on code on Sep 30, 2020 19:41 UTC
Code Review
lib/Infer/AliveDriver.cpp:1
@@ -777,6 +791,26 @@ souper::AliveDriver::translateDataflowFacts(const souper::Inst* I,
   }
 }
 
+bool
+souper::AliveDriver::translateDemandedBits(const souper::Inst* I,
+                     IR::Function& F,
+                     souper::AliveDriver::Cache& ExprCache) {
+  FunctionBuilder Builder(F);
+
+  auto DemandedBits = IsLHS ? I->DemandedBits : LHS->DemandedBits;
+
+  if (DemandedBits.isAllOnesValue() || DemandedBits.getBitWidth() != I-> Width) {

Is there any other not-initialized-properly cases?

regehr regehr commented on code on Sep 30, 2020 19:52 UTC
Code Review
lib/Infer/AliveDriver.cpp:1
@@ -777,6 +791,26 @@ souper::AliveDriver::translateDataflowFacts(const souper::Inst* I,
   }
 }
 
+bool
+souper::AliveDriver::translateDemandedBits(const souper::Inst* I,
+                     IR::Function& F,
+                     souper::AliveDriver::Cache& ExprCache) {
+  FunctionBuilder Builder(F);
+
+  auto DemandedBits = IsLHS ? I->DemandedBits : LHS->DemandedBits;
+
+  if (DemandedBits.isAllOnesValue() || DemandedBits.getBitWidth() != I-> Width) {

this should definitely be an assertion or an error check, not regular code

manasij7479 manasij7479 commented on Sep 30, 2020 20:15 UTC
Author

Fixed

regehr regehr commented on code on Oct 01, 2020 02:50 UTC
Code Review
test/Dataflow/demanded-bits5-invalid.opt:1
@@ -1,6 +1,6 @@
 
 
-; RUN: %souper-check -infer-rhs -souper-only-infer-iN %s > %t 2>&1
+; RUN: %souper-check -souper-double-check -infer-rhs -souper-only-infer-iN %s > %t 2>&1

please don't delete the existing RUN: lines unless there's a good reason to do so

regehr regehr commented on code on Oct 01, 2020 02:50 UTC
Code Review
test/Dataflow/demanded-bits6.opt:1
@@ -1,8 +1,11 @@
 
 
+; RUN: %souper-check -souper-use-alive %s > %t 2>&1
+; RUN: %FileCheck %s < %t
 ; RUN: %souper-check %s > %t 2>&1
 ; RUN: %FileCheck %s < %t
 
+

look for an eliminate spurious white space changes in your patch, there are a few others

manasij7479 manasij7479 commented on code on Oct 01, 2020 07:58 UTC
Code Review
test/Dataflow/demanded-bits5-invalid.opt:1
@@ -1,6 +1,6 @@
 
 
-; RUN: %souper-check -infer-rhs -souper-only-infer-iN %s > %t 2>&1
+; RUN: %souper-check -souper-double-check -infer-rhs -souper-only-infer-iN %s > %t 2>&1

double check just adds an extra check, not replacing anything existing.
If this test succeeds, the previous one would have succeeded.

manasij7479 manasij7479 commented on code on Oct 01, 2020 08:03 UTC
Code Review
test/Dataflow/demanded-bits6.opt:1
@@ -1,8 +1,11 @@
 
 
+; RUN: %souper-check -souper-use-alive %s > %t 2>&1
+; RUN: %FileCheck %s < %t
 ; RUN: %souper-check %s > %t 2>&1
 ; RUN: %FileCheck %s < %t
 
+

fixed

regehr regehr commented on Oct 01, 2020 14:34 UTC
Contributor

thanks!

Reviewers
Assignees
manasij7479 manasij7479
Labels
risk: low confidence: 91.9% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 56.9% (MEDIUM) · Higher = larger blast radius
56.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 91.9% · Lower = rushed or shallow review
91.9%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 4.6% · Safe to merge
4.6%
Repository