Index: lib/Transforms/Utils/SimplifyCFG.cpp =================================================================== --- lib/Transforms/Utils/SimplifyCFG.cpp +++ lib/Transforms/Utils/SimplifyCFG.cpp @@ -357,6 +357,8 @@ return nullptr; } +namespace { + /// Given a chain of or (||) or and (&&) comparison of a value against a /// constant, this will try to recover the information required for a switch /// structure. @@ -392,7 +394,8 @@ /// it wasn't set before or if the new value is the same as the old one bool setValueOnce(Value *NewVal) { if(CompValue && CompValue != NewVal) return false; - return CompValue = NewVal; + CompValue = NewVal; + return (CompVal != nullptr); } /// Try to match Instruction "I" as a comparison against a constant and @@ -525,6 +528,8 @@ } }; +} + static void EraseTerminatorInstAndDCECond(TerminatorInst *TI) { Instruction *Cond = nullptr; if (SwitchInst *SI = dyn_cast(TI)) {