Skip to content

Commit

Permalink
[llvm-reduce] Actually skip invalid candidates in operands-to-args
Browse files Browse the repository at this point in the history
This was checked while counting but not actually when doing the reduction, resulting in crashes.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D112766
  • Loading branch information
aeubanks committed Oct 29, 2021
1 parent 2d83392 commit 177a703
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions llvm/test/tools/llvm-reduce/operands-to-args.ll
Expand Up @@ -54,3 +54,19 @@ entry:
ret void
}


; Make sure to skip functions with non-direct call users
declare void @e(i8*)

; INTERESTING-LABEL: define void @g() {
define void @g() {
call void @e(i8* bitcast (void (i8**)* @f to i8*))
ret void
}

; INTERESTING-LABEL: define void @f(i8** %a) {
define void @f(i8** %a) {
%1 = load i8*, i8** %a
%2 = bitcast i8* %1 to i32*
ret void
}
2 changes: 2 additions & 0 deletions llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
Expand Up @@ -174,6 +174,8 @@ static void substituteOperandWithArgument(Function *OldF,
static void reduceOperandsToArgs(Oracle &O, Module &Program) {
SmallVector<Use *> OperandsToReduce;
for (Function &F : make_early_inc_range(Program.functions())) {
if (!canReplaceFunction(&F))
continue;
OperandsToReduce.clear();
for (Instruction &I : instructions(&F)) {
for (Use &Op : I.operands()) {
Expand Down

0 comments on commit 177a703

Please sign in to comment.