This is an archive of the discontinued LLVM Phabricator instance.

Relax assert when setting access functions with invariant base pointers
ClosedPublic

Authored by grosser on Jan 17 2017, 3:08 AM.

Details

Summary

Instead of forbidding such access functions completely, we verify that their
base pointer has been hoisted and only assert in case the base pointer was
not hoisted.

I was trying for a little while to get a test case that ensures the assert is
correctly fired in case of invariant load hoisting being disabled, but I could
not find a good way to do so, as llvm-lit immediately aborts if a command
yields a non-zero return value. As we do not generally test our asserts,
not having a test case here seems OK.

Suggested-by: Michael Kruse <llvm@meinersbur.de>

Diff Detail

Repository
rL LLVM

Event Timeline

grosser created this revision.Jan 17 2017, 3:08 AM
Meinersbur accepted this revision.Jan 17 2017, 4:03 AM
Meinersbur added inline comments.
lib/Analysis/ScopInfo.cpp
1081–1082 ↗(On Diff #84648)

This comment now seems detached from the asset in line 1101 due to all the empty lines inserted.

1088 ↗(On Diff #84648)

Unrelated new line

1095 ↗(On Diff #84648)

When assertions are off, the compiler will warn about EqClass being unused. There are are function calls which are not going to be optimized away.

Did you consider to put #ifndef NDEBUG around this?

This revision is now accepted and ready to land.Jan 17 2017, 4:03 AM
This revision was automatically updated to reflect the committed changes.
grosser marked 2 inline comments as done.
grosser marked an inline comment as done.Jan 17 2017, 4:12 AM

Thank you for the fast review. I addressed your last comments and committed.

lib/Analysis/ScopInfo.cpp
1081–1082 ↗(On Diff #84648)

I will move this down.

1088 ↗(On Diff #84648)

I will drop this.

1095 ↗(On Diff #84648)

This is a NDEBUG region (which you introduced). It is just rather large and so not easily visible in the patch.