@@ -1172,30 +1172,24 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2) {
1172
1172
}
1173
1173
1174
1174
if (const BlockAddress *BA = dyn_cast<BlockAddress>(V1)) {
1175
- // Now we know that the RHS is a BlockAddress or simple
1176
- // constant (which, since the types must match, means that it is a
1177
- // ConstantPointerNull).
1175
+ // Now we know that the RHS is a BlockAddress or simple constant.
1178
1176
if (const BlockAddress *BA2 = dyn_cast<BlockAddress>(V2)) {
1179
1177
// Block address in another function can't equal this one, but block
1180
1178
// addresses in the current function might be the same if blocks are
1181
1179
// empty.
1182
1180
if (BA2->getFunction () != BA->getFunction ())
1183
1181
return ICmpInst::ICMP_NE;
1184
- } else {
1185
- // Block addresses aren't null.
1186
- assert (isa<ConstantPointerNull>(V2) && " Canonicalization guarantee!" );
1182
+ } else if (isa<ConstantPointerNull>(V2)) {
1187
1183
return ICmpInst::ICMP_NE;
1188
1184
}
1189
1185
} else if (const GlobalValue *GV = dyn_cast<GlobalValue>(V1)) {
1190
1186
// Now we know that the RHS is a GlobalValue, BlockAddress or simple
1191
- // constant (which, since the types must match, means that it's a
1192
- // ConstantPointerNull).
1187
+ // constant.
1193
1188
if (const GlobalValue *GV2 = dyn_cast<GlobalValue>(V2)) {
1194
1189
return areGlobalsPotentiallyEqual (GV, GV2);
1195
1190
} else if (isa<BlockAddress>(V2)) {
1196
1191
return ICmpInst::ICMP_NE; // Globals never equal labels.
1197
- } else {
1198
- assert (isa<ConstantPointerNull>(V2) && " Canonicalization guarantee!" );
1192
+ } else if (isa<ConstantPointerNull>(V2)) {
1199
1193
// GlobalVals can never be null unless they have external weak linkage.
1200
1194
// We don't try to evaluate aliases here.
1201
1195
// NOTE: We should not be doing this constant folding if null pointer
0 commit comments