Index: lib/Transforms/Scalar/LoopUnswitch.cpp =================================================================== --- lib/Transforms/Scalar/LoopUnswitch.cpp +++ lib/Transforms/Scalar/LoopUnswitch.cpp @@ -641,6 +641,10 @@ break; } } + } else { + // TrivialUnswitchCondition can only apply to BranchInst or SwitchInst. + // Anything else should return false immediately. + return false; } // If we didn't find a single unique LoopExit block, or if the loop exit block