fix null pointer refinement condition
fixes failure in LLVM's Transforms/CorrelatedValuePropagation/phi-common-val.ll
MODIFY
ir/pointer.cpp
ir/pointer.cpp
@@ -471,8 +471,9 @@ expr Pointer::refined(const Pointer &other) const {
// TODO: this induces an infinite loop
//local &= block_refined(other);
- return expr::mkIf(isLocal(), move(local), *this == other) &&
- isBlockAlive().implies(other.isBlockAlive());
+ return expr::mkIf(isNull(), other.isNull(),
+ expr::mkIf(isLocal(), move(local), *this == other) &&
+ isBlockAlive().implies(other.isBlockAlive()));
}
expr Pointer::fninputRefined(const Pointer &other, set<expr> &undef,

ADD
tests/alive-tv/ptrcmp/refinement.srctgt.ll
+define i8* @src(i8* %in) {
+ %c = icmp eq i8* %in, null
+ %r = select i1 %c, i8* null, i8* %in
+ ret i8* %r
+}
+
+define i8* @tgt(i8* %in) {
+ ret i8* %in
+}

fix null pointer refinement condition
fixes failure in LLVM's Transforms/CorrelatedValuePropagation/phi-common-val.ll