This is an archive of the discontinued LLVM Phabricator instance.

GVN-hoist: fix early exit logic
ClosedPublic

Authored by sebpop on Aug 4 2016, 1:12 PM.

Details

Summary

The patch splits a complex && if condition into easier to read and understand logic.
That wrong early exit condition was letting some instructions with not all operands available pass through when HoistingGeps was true.

The patch also adds an extra early exit for TerminatorInst that should not be added to the analysis in the first place: these are branch instructions, invoke, etc.
I found it strange that we were looking at this kind of instructions when running gdb on the testcase.

I'm testing this patch with 3stage bootstrap and test-suite.
I will commit after it passes, and reenable the pass by default.

Diff Detail

Repository
rL LLVM

Event Timeline

sebpop updated this revision to Diff 66845.Aug 4 2016, 1:12 PM
sebpop retitled this revision from to GVN-hoist: fix early exit logic.
sebpop updated this object.
sebpop added a reviewer: dberlin.
sebpop added subscribers: llvm-commits, hiraditya.
dberlin accepted this revision.Aug 4 2016, 1:34 PM
dberlin edited edge metadata.
dberlin added inline comments.
lib/Transforms/Scalar/GVNHoist.cpp
897 ↗(On Diff #66845)

I hope this is not a correctness fix :)

This revision is now accepted and ready to land.Aug 4 2016, 1:34 PM
sebpop added inline comments.Aug 4 2016, 1:44 PM
lib/Transforms/Scalar/GVNHoist.cpp
897 ↗(On Diff #66845)

Nop. This is a compilation time fix: as I was saying in the commit message, we should not try to analyze to hoist this kind of "scalar instructions".

This revision was automatically updated to reflect the committed changes.
sebpop added a comment.Aug 4 2016, 4:59 PM

When I tested the 3stage bootstrap was broken without my patch.
Patch passed test-suite and check-all on x86_64-linux.