This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Use a more generic name for the selects created by SpeculativelyExecuteBB to prevent long names from being created
ClosedPublic

Authored by craig.topper on Oct 30 2017, 6:16 PM.

Details

Summary

Currently the selects are created with the names of their inputs concatenated together. It's possible to get cases that chain these selects together resulting in long names due to multiple levels of concatenation. Our internal branch of llvm managed to generate names over 100000 characters in length on a particular test due to an extreme compounding of the names.

This patch changes the name to a generic name that is not dependent on its inputs. I'm open to other suggestions.

As a small demonstration, here is what is currently in the output IR for merge-cond-stores-2.ll before this patch

%1 = select i1 %tobool, i32 %0, i32 %or
%.or4 = select i1 %tobool2, i32 %1, i32 %or4
%.or4.or9 = select i1 %tobool7, i32 %.or4, i32 %or9
%.or4.or9.or14 = select i1 %tobool12, i32 %.or4.or9, i32 %or14
%.or4.or9.or14.or19 = select i1 %tobool17, i32 %.or4.or9.or14, i32 %or19
%.or4.or9.or14.or19.or24 = select i1 %tobool22, i32 %.or4.or9.or14.or19, i32 %or24
%.or4.or9.or14.or19.or24.or29 = select i1 %tobool27, i32 %.or4.or9.or14.or19.or24, i32 %or29
%.or4.or9.or14.or19.or24.or29.or34 = select i1 %tobool32, i32 %.or4.or9.or14.or19.or24.or29, i32 %or34
%.or4.or9.or14.or19.or24.or29.or34.or39 = select i1 %tobool37, i32 %.or4.or9.or14.or19.or24.or29.or34, i32 %or39
%.or4.or9.or14.or19.or24.or29.or34.or39.or44 = select i1 %tobool42, i32 %.or4.or9.or14.or19.or24.or29.or34.or39, i32 %or44
%.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49 = select i1 %tobool47, i32 %.or4.or9.or14.or19.or24.or29.or34.or39.or44, i32 %or49
%.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54 = select i1 %tobool52, i32 %.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49, i32 %or54
%.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59 = select i1 %tobool57, i32 %.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54, i32 %or59
%.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59.or64 = select i1 %tobool62, i32 %.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59, i32 %or64
%.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59.or64.or69 = select i1 %tobool67, i32 %.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59.or64, i32 %or69
%.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59.or64.or69.or74 = select i1 %tobool72, i32 %.or4.or9.or14.or19.or24.or29.or34.or39.or44.or49.or54.or59.or64.or69, i32 %or74

Diff Detail

Event Timeline

craig.topper created this revision.Oct 30 2017, 6:16 PM
spatel accepted this revision.Oct 31 2017, 9:07 AM

The code change looks obviously correct, so LGTM.

I'd suggest regenerating the checks in the tests using utils/update_test_checks.py. We really don't want those to be affected by cosmetic name changes, right?

This revision is now accepted and ready to land.Oct 31 2017, 9:07 AM
This revision was automatically updated to reflect the committed changes.