Summary: - Bottom-lift abstract memory domain to express unreachable node - Two cases to make a node unreachable + constant: when an evaluation result of condition expression is bottom or false, e.g., "prune(0)". + alias: when the same structure e is compared to itself with "<", ">", and "!=", e.g., "prune(e < e)". - Add test for the new prune (prune_constant.c, prune_alias.c) - Debug the semantics of comparison Reviewed By: mbouaziz Differential Revision: D4938055 fbshipit-source-id: d0fadf0master
parent
b4b32f8d3e
commit
7212890846
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
void prune_alias_le_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x <= x) {
|
||||
a[0] = 0;
|
||||
} else {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_ge_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x >= x) {
|
||||
a[0] = 0;
|
||||
} else {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_eq_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x == x) {
|
||||
a[0] = 0;
|
||||
} else {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_lt_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x < x) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_gt_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x > x) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_ne_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x != x) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_not_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (!(x == x)) {
|
||||
a[1] = 0;
|
||||
}
|
||||
|
||||
if (!(x <= x)) {
|
||||
a[1] = 0;
|
||||
}
|
||||
|
||||
if (!(x >= x)) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_and_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x == x && x != x) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_or_Ok(int x, int y) {
|
||||
int a[1];
|
||||
|
||||
if (x != x || y != y) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_alias_exp_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x + 1 != x + 1) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void FP_prune_alias_exp_Ok(int x) {
|
||||
int a[1];
|
||||
|
||||
if (x + 1 != 1 + x) {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
void prune_constant_true_Ok() {
|
||||
int a[1];
|
||||
|
||||
if (1) {
|
||||
a[0] = 0;
|
||||
} else {
|
||||
a[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_constant_false_Ok() {
|
||||
int a[1];
|
||||
|
||||
if (0) {
|
||||
a[1] = 0;
|
||||
} else {
|
||||
a[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void prune_constant_value_Ok(int x) {
|
||||
int a[1];
|
||||
if (-1 < x && x < 1) {
|
||||
if (x) {
|
||||
a[1] = 0;
|
||||
} else {
|
||||
a[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue