This is an archive of the discontinued LLVM Phabricator instance.

[PGO] fix PGO use ICE when there are unreachable BBs
ClosedPublic

Authored by xur on Nov 30 2016, 1:30 PM.

Details

Summary

For -O0 there might be unreachable BBs, which breaks the assumption that all the BBs have an auxiliary data structure. In this patch, I change the interface for getBBInfo() so that a nullptr can be returned for the unreachable BBs (and the callers can ignore those BBs).

This fixes the bug reported
https://llvm.org/bugs/show_bug.cgi?id=31209

Diff Detail

Event Timeline

xur updated this revision to Diff 79802.Nov 30 2016, 1:30 PM
xur retitled this revision from to [PGO] fix PGO use ICE when there are unreachable BBs.
xur updated this object.
xur added reviewers: davidxl, vsk.
xur added subscribers: llvm-commits, xur, rob.lougher.
davidxl edited edge metadata.Nov 30 2016, 1:42 PM

I suggest adding a new interface 'findBBInfo' returns pointer (which can be null) and use it in context that can do null check. Other users of the getBBInfo won't change.

xur updated this revision to Diff 79815.Nov 30 2016, 2:28 PM
xur edited edge metadata.

Integrated David's suggestions.
Actually there are two more places need to be changed.

-Rong

xur added a comment.Nov 30 2016, 2:30 PM

to clarify my previous comments: I meant two more places needed to use the new interface. they were included in patch set 2 that just uploaded.

davidxl accepted this revision.Nov 30 2016, 4:13 PM
davidxl edited edge metadata.

lgtm

This revision is now accepted and ready to land.Nov 30 2016, 4:13 PM
This revision was automatically updated to reflect the committed changes.