diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 26f7cb1630a..62039f9048f 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1220,13 +1220,11 @@ bool GVN::processInstruction(Instruction* I, if (dep == MemoryDependenceAnalysis::None || dep == MemoryDependenceAnalysis::NonLocal) return false; - else if (CallInst* C = dyn_cast(dep)) { - if (!isa(C)) - return performReturnSlotOptzn(M, C, toErase); - } else if (!isa(dep)) - return false; - - return processMemCpy(M, cast(dep), toErase); + if (isa(dep)) + return processMemCpy(M, cast(dep), toErase); + if (CallInst* C = dyn_cast(dep)) + return performReturnSlotOptzn(M, C, toErase); + return false; } unsigned num = VN.lookup_or_add(I);