Skip to content

Commit 2362813

Browse files
committed
[ConstraintElim] Treat ConstantPointerNull as constant offset 0.
Treat ConstantPointerNull (null) as constant offset 0 in the constraint instead of a variable. This slightly reduces the number of variables. I was not able to find a test case where this actually caused any changes.
1 parent 6f0c52e commit 2362813

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ static Decomposition decompose(Value *V,
455455
if (Ty->isPointerTy() && !IsSigned) {
456456
if (auto *GEP = dyn_cast<GEPOperator>(V))
457457
return decomposeGEP(*GEP, Preconditions, IsSigned, DL);
458+
if (isa<ConstantPointerNull>(V))
459+
return int64_t(0);
460+
458461
return V;
459462
}
460463

0 commit comments

Comments
 (0)