[PATCH] D55601: [bugpoint] Add ability to reduce to zero elements

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 12 07:25:19 PST 2018


modocache created this revision.
modocache added reviewers: MatzeB, silvas, davide, reames.

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
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D55601

Files:
  test/BugPoint/func-attrs-none.ll
  test/BugPoint/func-attrs-zero.ll
  tools/bugpoint/CrashDebugger.cpp
  tools/bugpoint/ListReducer.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55601.177854.patch
Type: text/x-patch
Size: 6593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181212/67931cf6/attachment.bin>


More information about the llvm-commits mailing list