[llvm] 177a703 - [llvm-reduce] Actually skip invalid candidates in operands-to-args
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 29 09:16:53 PDT 2021
Author: Arthur Eubanks
Date: 2021-10-29T09:14:18-07:00
New Revision: 177a7037103666678d49e2e9aef5b184186d9ec2
URL: https://github.com/llvm/llvm-project/commit/177a7037103666678d49e2e9aef5b184186d9ec2
DIFF: https://github.com/llvm/llvm-project/commit/177a7037103666678d49e2e9aef5b184186d9ec2.diff
LOG: [llvm-reduce] Actually skip invalid candidates in operands-to-args
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
Added:
Modified:
llvm/test/tools/llvm-reduce/operands-to-args.ll
llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-reduce/operands-to-args.ll b/llvm/test/tools/llvm-reduce/operands-to-args.ll
index 3047579cbe606..508cbf7d70ce0 100644
--- a/llvm/test/tools/llvm-reduce/operands-to-args.ll
+++ b/llvm/test/tools/llvm-reduce/operands-to-args.ll
@@ -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
+}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
index d2bef3eeeeed2..d6738c1d89cdd 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
@@ -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()) {
More information about the llvm-commits
mailing list