This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Fix call guard difference with dbg
ClosedPublic

Authored by yechunliang on Sep 24 2019, 6:44 PM.

Details

Summary

GuardWideningWindow() in InstCombine pass is used to bypass looking for another guard, the initial value is "3" which does not consider the case with dbg.value, if dbg instructions exist, it will exceed the guard widening window and the another guard will be missed.

The purpose of this patch is to skip debug instructions while looking for the guard in the window, use getNextNonDebugInstruction instead of previous getNextNode.

Fix for https://bugs.llvm.org/show_bug.cgi?id=37714

Diff Detail

Event Timeline

yechunliang created this revision.Sep 24 2019, 6:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2019, 6:44 PM

We should just skip debug instructions while looking for the guard in the window. Just use getNextNonDebugInstruction instead of current getNextNode.

[InstCombine] Fix call guard difference with dbg

While using "opt -debugify-each", the dbg instructions will exceed GuardWideningWindow, so that the instructions will be different with and without "-debugify-each" after optimization. We should just skip debug instructions while looking for the guard in the window. Just use getNextNonDebugInstruction instead of current getNextNode.

We should just skip debug instructions while looking for the guard in the window. Just use getNextNonDebugInstruction instead of current getNextNode.

+1. Also needs a test?

+1 to a test.

davide requested changes to this revision.Sep 25 2019, 4:18 PM

yes, this needs a test.

This revision now requires changes to proceed.Sep 25 2019, 4:18 PM

thanks for review. add test case with --debugify-each based on previous call-guard.ll

Added one more RUN command line with "-debugify-each" in existed call-guard.ll, needn't duplicate another same test case file.

just added updated test, could some one help to review again? thanks.

apilipenko accepted this revision.Oct 28 2019, 3:37 PM

@apilipenko thanks for accepting, I have no submit permission, would you please also help me to submit this patch? thanks.

yechunliang edited the summary of this revision. (Show Details)Oct 29 2019, 6:46 PM

I'm committing this for you.

commit c32f0ff92f024a8af438fc8d85906e441b5a2682 (HEAD -> master, origin/master, origin/HEAD)
Author: Davide Italiano <ditaliano@apple.com>
Date:   Fri Nov 22 13:02:18 2019 -0800

    [InstCombine] Fix call guard difference with dbg
    
    Patch by Chris Ye!
    
    Differential Revision: https://reviews.llvm.org/D68004
This revision was not accepted when it landed; it landed in state Needs Review.Nov 22 2019, 1:39 PM
This revision was automatically updated to reflect the committed changes.