[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
Fri Oct 29 09:16:54 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG177a70371036: [llvm-reduce] Actually skip invalid candidates in operands-to-args (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112766/new/

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.383387.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211029/596085a2/attachment.bin>


More information about the llvm-commits mailing list