@@ -1187,8 +1187,8 @@ void InferAddressSpacesImpl::performPointerReplacement(
1187
1187
if (CurUser == NewV)
1188
1188
return ;
1189
1189
1190
- if ( auto *CurUserI = dyn_cast<Instruction>(CurUser);
1191
- CurUserI && CurUserI->getFunction () != F)
1190
+ auto *CurUserI = dyn_cast<Instruction>(CurUser);
1191
+ if (! CurUserI || CurUserI->getFunction () != F)
1192
1192
return ;
1193
1193
1194
1194
// Handle more complex cases like intrinsic that need to be remangled.
@@ -1202,10 +1202,7 @@ void InferAddressSpacesImpl::performPointerReplacement(
1202
1202
return ;
1203
1203
}
1204
1204
1205
- if (!isa<Instruction>(CurUser))
1206
- return ;
1207
-
1208
- if (ICmpInst *Cmp = dyn_cast<ICmpInst>(CurUser)) {
1205
+ if (ICmpInst *Cmp = dyn_cast<ICmpInst>(CurUserI)) {
1209
1206
// If we can infer that both pointers are in the same addrspace,
1210
1207
// transform e.g.
1211
1208
// %cmp = icmp eq float* %p, %q
@@ -1236,7 +1233,7 @@ void InferAddressSpacesImpl::performPointerReplacement(
1236
1233
}
1237
1234
}
1238
1235
1239
- if (AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(CurUser )) {
1236
+ if (AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(CurUserI )) {
1240
1237
unsigned NewAS = NewV->getType ()->getPointerAddressSpace ();
1241
1238
if (ASC->getDestAddressSpace () == NewAS) {
1242
1239
ASC->replaceAllUsesWith (NewV);
@@ -1264,8 +1261,8 @@ void InferAddressSpacesImpl::performPointerReplacement(
1264
1261
CurUser->replaceUsesOfWith (
1265
1262
V, new AddrSpaceCastInst (NewV, V->getType (), " " , InsertPos));
1266
1263
} else {
1267
- CurUser ->replaceUsesOfWith (V, ConstantExpr::getAddrSpaceCast (
1268
- cast<Constant>(NewV), V->getType ()));
1264
+ CurUserI ->replaceUsesOfWith (
1265
+ V, ConstantExpr::getAddrSpaceCast ( cast<Constant>(NewV), V->getType ()));
1269
1266
}
1270
1267
}
1271
1268
0 commit comments