Ignore:
Timestamp:
Dec 12, 2018, 9:17:18 AM (5 months ago)
Author:
cameron
Message:

Contextual assertion simplifier from Jeremy Schwartz - initial check-in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_diff.cpp

    r6169 r6223  
    77#include "re_diff.h"
    88#include <re/re_cc.h>
     9#include <re/re_seq.h>
    910#include <re/re_name.h>
     11#include <re/re_empty_set.h>
    1012#include <llvm/Support/Casting.h>
    1113
     
    1416namespace re {
    1517
     18#include <re/re_empty_set.h>
     19   
    1620RE * makeDiff(RE * lh, RE * rh) {
    17     return new Diff(lh, rh);
     21   
     22    if (LLVM_UNLIKELY(isEmptySeq(lh) && isEmptySeq(rh))) {
     23        return makeEmptySet();
     24    } else if (LLVM_UNLIKELY(isEmptySet(rh))) {
     25        return lh;
     26    } else if (LLVM_UNLIKELY(isEmptySet(lh))) {
     27        return makeEmptySet();
     28    } else {
     29        return new Diff(lh, rh);
     30    }
    1831}
    19    
     32
    2033}
Note: See TracChangeset for help on using the changeset viewer.