[PATCH] D112766: [llvm-reduce] Actually skip invalid candidates in operands-to-args
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 28 15:53:16 PDT 2021
aeubanks created this revision.
aeubanks added a reviewer: Meinersbur.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This was checked while counting but not actually when doing the reduction, resulting in crashes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112766
Files:
llvm/test/tools/llvm-reduce/operands-to-args.ll
llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
Index: llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
===================================================================
--- llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
+++ llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
@@ -174,6 +174,8 @@
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()) {
Index: llvm/test/tools/llvm-reduce/operands-to-args.ll
===================================================================
--- llvm/test/tools/llvm-reduce/operands-to-args.ll
+++ llvm/test/tools/llvm-reduce/operands-to-args.ll
@@ -54,3 +54,19 @@
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
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112766.383185.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211028/48418681/attachment.bin>
More information about the llvm-commits
mailing list