def SIMD_vectorization_latency_pruning(config):
    """Perform latency-based pruning at the SIMD vectorization stage.

    We have already reordered the SIMD candidate loops in descending order.
    Therefore, if the last design evaluated is slower than the opt design found
    so far, there is no chance for the rest of candidates which has a smaller
    SIMD factor to beat the opt design.
    We will stop exploration for these loops and return.
    Otherwise, if the resource usage is legal, we have already found a design that
    achieves the least latency in the current group. For the other designs with
    a smaller SIMD factor, their latency is no less than the current design.
    We will stop exploration for these loops and return.
    However, there a chance that the designs with a smaller SIMD factor acheives
    the same latency but with less resource usage (for a comm bound design).
    At present, we ignore such cases.

    """
    last_design = config["monitor"]["last_design"]
    if last_design["latency"] == -1:
        # The current design is already slower than opt., stop exploration.
        return True
    else:
        # The current design is resource-legal, stop exploration.
        if not last_design["resource"]:
            return True
    return False