This is an archive of the discontinued LLVM Phabricator instance.

Check overflows in RTCs and bail accordingly
ClosedPublic

Authored by jdoerfert on May 11 2016, 6:24 AM.

Details

Summary
We utilize assumptions on the input to model IR in polyhedral world.
To verify these assumptions we version the code and guard it with a
runtime-check (RTC). However, since the RTCs are themselves generated
from the polyhedral representation we generate them under the same
assumptions that they should verify. In other words, the guarantees
that we try to provide with the RTCs do not hold for the RTCs
themselves. To this end it is necessary to employ a different check
for the RTCs that will verify the assumptions did hold for them too.

Diff Detail

Repository
rL LLVM

Event Timeline

jdoerfert updated this revision to Diff 56896.May 11 2016, 6:24 AM
jdoerfert retitled this revision from to Check overflows in RTCs and bail accordingly.
jdoerfert added reviewers: grosser, Meinersbur.
jdoerfert updated this object.
jdoerfert added a subscriber: Restricted Project.

This fixes 1 of the 4 runtime errors in the SPEC benchmarks for an unprofitable run. Additionally, support for truncate operations will cause an overflow in the RTCs in one of the LLVM-TS tests (MultiSource/Benchmarks/Fhourstones-3.1, function: transtore) for an unprofitable run.

grosser edited edge metadata.May 11 2016, 12:28 PM

Hi Johannes,

this patch LGTM. Did you check if this results in major performance slowdowns?

It might also be a good idea to add an option that allows to generate RTCs not-at-all, run-time-checks-only, everywhere. Even though the everywhere option is currently probably still too costly, it might be useful in testing.

Best,
Tobias

include/polly/CodeGen/IslExprBuilder.h
138 ↗(On Diff #56896)

tacking -> tracking

140 ↗(On Diff #56896)

the tracking is enabled ...

lib/CodeGen/IslExprBuilder.cpp
35 ↗(On Diff #56896)

This seems overly complicated. Any reason to not write:

  // Ignore calls that do not change the current state.
         ​  if (Enable)
	​    OverflowState = Builder.getFalse();
	​  else
	​    OverflowState = nullptr;
jdoerfert updated this revision to Diff 57031.May 12 2016, 7:12 AM
jdoerfert edited edge metadata.

Updated according to comments, added cmd line option to override overflow tracking

jdoerfert marked 3 inline comments as done.May 12 2016, 7:13 AM
This revision was automatically updated to reflect the committed changes.