Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ private IIcfgElement buildCodeBlock(final Statement[] codeblock, final IIcfgElem
mRemovedAssumeTrueStatements++;
continue;
}
if (st instanceof final Label laSt && BoogieUtils.isAuxiliaryLabel(laSt)) {
if (st instanceof final Label laSt && canLabelBeRemoved(laSt)) {
final int gotoTarget = mGotoTargetCounter.getOrDefault(laSt.getName(), 0);
if (gotoTarget == 0) {
// not target of a goto
Expand Down Expand Up @@ -812,6 +812,11 @@ private IIcfgElement buildCodeBlock(final Statement[] codeblock, final IIcfgElem
return currentLocation;
}

private boolean canLabelBeRemoved(final Label label) {
return mServices.getPreferenceProvider(Activator.PLUGIN_ID).getBoolean(
IcfgPreferenceInitializer.LABEL_REMOVE_UNNECESSARY_LABELS) || BoogieUtils.isAuxiliaryLabel(label);
}

private BoogieIcfgLocation buildIf(final BoogieIcfgLocation currentLocation, final IfStatement st) {
mConditionalStarts.add(currentLocation);
final IIcfgElement thenPart = buildCodeBlock(st.getThenPart(), currentLocation, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ public boolean isConcurrencySafe() {
public static final String LABEL_SIMPLIFY = "Simplify code blocks";
public static final String LABEL_CNF = "Convert code blocks to CNF";
public static final String LABEL_REMOVE_GOTO_EDGES = "Remove goto edges from ICFG";
public static final String LABEL_REMOVE_UNNECESSARY_LABELS = "Remove unnecessary labels from ICFG";
private static final String DESC_REMOVE_UNNECESSARY_LABELS =
"If this option is enabled, any label that has no corresponding goto, or whose goto appears only on the line preceding the label, is removed and not preserved in the ICFG. "
+ "Otherwise, this optimization is only applied for auxiliary labels.";
public static final String LABEL_DUMP_TO_FILE = "Dump SMT script to file";
public static final String LABEL_COMPRESS_SMT_DUMP_FILE = "Compress dumped SMT script";
public static final String DESC_COMPRESS_SMT_DUMP_FILE = "Compress the written .smt2 script with GZip";
Expand Down Expand Up @@ -144,6 +148,8 @@ protected UltimatePreferenceItem<?>[] initDefaultPreferences() {
new UltimatePreferenceItem<>(LABEL_CONTEXT_SWITCH_ONLY_AT_ATOMIC_BOUNDARIES,
DEF_CONTEXT_SWITCH_ONLY_AT_ATOMIC_BOUNDARIES, PreferenceType.Boolean),
new UltimatePreferenceItem<>(LABEL_REMOVE_GOTO_EDGES, false, PreferenceType.Boolean),
new UltimatePreferenceItem<>(LABEL_REMOVE_UNNECESSARY_LABELS, true, DESC_REMOVE_UNNECESSARY_LABELS,
PreferenceType.Boolean),
new UltimatePreferenceItem<>(LABEL_SIMPLIFY, false, PreferenceType.Boolean),
new UltimatePreferenceItem<>(LABEL_CNF, false, PreferenceType.Boolean),
new UltimatePreferenceItem<>(LABEL_SIMPLE_PARTIAL_SKOLEMIZATION, DEF_SIMPLE_PARTIAL_SKOLEMIZATION,
Expand Down