[clang] [llvm] [inlineasm] Add special support for "rm" inline asm constraints (PR #181973)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 00:59:31 PDT 2026


================
@@ -207,28 +636,83 @@ static bool processCallBrInst(Function &F, CallBrInst *CBR, DominatorTree *DT) {
   return Changed;
 }
 
-static SmallVector<CallBrInst *, 2> findCallBrs(Function &F) {
-  SmallVector<CallBrInst *, 2> CBRs;
-  for (BasicBlock &BB : F)
-    if (auto *CBR = dyn_cast<CallBrInst>(BB.getTerminator()))
-      if (!CBR->getType()->isVoidTy() && !CBR->use_empty())
-        CBRs.push_back(CBR);
-  return CBRs;
-}
-
-static bool runImpl(Function &F, ArrayRef<CallBrInst *> CBRs,
-                    DominatorTree *DT) {
+static bool runImpl(Function &F, ArrayRef<CallBase *> IAs, DominatorTree *DT,
+                    const TargetMachine *TM) {
   bool Changed = false;
+  bool isOptLevelNone = TM->getOptLevel() == CodeGenOptLevel::None;
----------------
bwendling wrote:

> I think it might be a much much much smaller incision to use `TM->getOptLevel()` in `getConstraintPiority` used by `TargetLowering::getConstraintPreferences`, which in turn is used by BOTH ISEL frameworks.

This is an interesting idea, and I think it could help in some ways. We would still need a way to wedge in loads and stores though, which is of course the cause of rewriting the various `CallBase` instructions. That is unless `FastISel` has the ability to do that for us.

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


More information about the cfe-commits mailing list