[PATCH] D156365: [FuncSpec][NFC] Remove SSA copy intrinsics in the unittests.

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 00:41:06 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2e00eba232c1: [FuncSpec][NFC] Remove SSA copy intrinsics in the unittests. (authored by labrinea).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156365

Files:
  llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp


Index: llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp
===================================================================
--- llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp
+++ llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp
@@ -23,6 +23,19 @@
 
 namespace llvm {
 
+static void removeSSACopy(Function &F) {
+  for (BasicBlock &BB : F) {
+    for (Instruction &Inst : llvm::make_early_inc_range(BB)) {
+      if (auto *II = dyn_cast<IntrinsicInst>(&Inst)) {
+        if (II->getIntrinsicID() != Intrinsic::ssa_copy)
+          continue;
+        Inst.replaceAllUsesWith(II->getOperand(0));
+        Inst.eraseFromParent();
+      }
+    }
+  }
+}
+
 class FunctionSpecializationTest : public testing::Test {
 protected:
   LLVMContext Ctx;
@@ -77,6 +90,8 @@
       Solver->markOverdefined(&Arg);
     Solver->solveWhileResolvedUndefsIn(*M);
 
+    removeSSACopy(*F);
+
     return FunctionSpecializer(*Solver, *M, &FAM, GetBFI, GetTLI, GetTTI,
                                GetAC);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156365.544633.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230727/f81fb8e1/attachment.bin>


More information about the llvm-commits mailing list