Index: lib/Transforms/Utils/AddDiscriminators.cpp =================================================================== --- lib/Transforms/Utils/AddDiscriminators.cpp +++ lib/Transforms/Utils/AddDiscriminators.cpp @@ -232,15 +232,18 @@ for (BasicBlock &B : F) { LocationSet CallLocations; for (auto &I : B.getInstList()) { - CallInst *Current = dyn_cast(&I); // We bypass intrinsic calls for the following two reasons: // 1) We want to avoid a non-deterministic assigment of // discriminators. // 2) We want to minimize the number of base discriminators used. - if (!Current || isa(&I)) + if (isa(I)) { + if (isa(I)) + continue; + } + else if(!isa(I)) continue; - DILocation *CurrentDIL = Current->getDebugLoc(); + DILocation *CurrentDIL = I.getDebugLoc(); if (!CurrentDIL) continue; Location L = @@ -255,7 +258,7 @@ << CurrentDIL->getLine() << ":" << CurrentDIL->getColumn() << ":" << Discriminator << " " << I << "\n"); } else { - Current->setDebugLoc(NewDIL.getValue()); + I.setDebugLoc(NewDIL.getValue()); Changed = true; } }