[llvm] [ExtendLifetimes] Implement llvm.fake.use to extend variable lifetimes (PR #86149)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 04:39:36 PDT 2024


================
@@ -2151,6 +2151,15 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
     }
     return true;
   }
+  case Intrinsic::fake_use: {
+    SmallVector<llvm::SrcOp, 4> VRegs;
+    for (const auto &Arg : CI.args())
+      for (auto VReg : getOrCreateVRegs(*Arg))
+        VRegs.push_back(VReg);
+    MIRBuilder.buildInstr(TargetOpcode::FAKE_USE, std::nullopt, VRegs,
+                          MachineInstr::copyFlagsFromInstruction(CI));
----------------
arsenm wrote:

This won't have any flags, so no point in using copyFlagsFromInstruction

https://github.com/llvm/llvm-project/pull/86149


More information about the llvm-commits mailing list