This is an archive of the discontinued LLVM Phabricator instance.

[bugpoint] Add ability to reduce to zero elements
Needs RevisionPublic

Authored by modocache on Dec 12 2018, 7:25 AM.

Details

Summary

Depends on https://reviews.llvm.org/D55216.

https://reviews.llvm.org/D55216 implemented reducing function attributes
in bugpoint. However, these attributes are only reduced down to a single
element, so even in the case where function attributes were irrelevant
to the crash being reduced, there would still be one arbitrary attribute
left after the program had been reduced. For example, take the following
program, tested with the bugpoint-crashcalls pass:

define i32 @bar() #0 {
  ret i32 12
}

define i32 @foo() #0 {
  %1 = call i32 @bar()
  ret i32 %1
}

attributes #0 = { "one" "two" "three" }

This program would be "reduced" to having just one attribute:

define i32 @bar() #0 {
  ret i32 12
}

define i32 @foo() #0 {
  %1 = call i32 @bar()
  ret i32 %1
}

attributes #0 = { "two" }

However, clearly the attribute is irrelevant, and so a fully reduced
program would have no attributes.

Implememting reduction to zero attributes required changing ListReducer.
It now takes a "reduction limit" parameter in its initializer. When
given a limit of zero, it attempts to reduce down to zero attributes.
This results in a fully reduced program such as the one below (and such
as is tested in this commit's tests):

define i32 @bar() {
  ret i32 12
}

define i32 @foo() {
  %1 = call i32 @bar()
  ret i32 %1
}

Diff Detail

Event Timeline

modocache created this revision.Dec 12 2018, 7:25 AM

A question. Why do we need a 1 limit at all? Wouldn't reducing any list to zero when 1 element is required to produce the failure fail to reduce? I'm wondering if what we want is essentially a base case for the reducer that tries removing the last element, and if it fails, backing off to the single element case.

reames requested changes to this revision.Mar 15 2019, 11:51 AM

Per previous comment (just getting out of review queue)

This revision now requires changes to proceed.Mar 15 2019, 11:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2019, 11:51 AM
silvas resigned from this revision.Mar 25 2020, 6:34 PM