================
@@ -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;
----------------
nickdesaulniers wrote:
> We would still need a way to wedge in loads and stores though
hmm...
The whole point of the CallBrPrepare pass was that SelectionDAGISel could not
modify BasicBlocks other than the one it was currently iterating; so we likely
can't insert loads in successor blocks for callbr during ISEL.
---
Spitballing other ideas here, since I can focus more time here now...
Perhaps modifying the front end then to only produce "m" when "rm" appear in
sources but `TM->getOptLevel() == CodeGenOptLevel::None` is perhaps also a way
to avoid transforming the instructions. Then the middle end could fold
redundant loads and kill dead stores.
---
Perhaps ultimately if we _must_ transform from "rm" to "m", we have machinery
under utils/ that are well tested, then we make use of those here.
https://github.com/llvm/llvm-project/pull/181973
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits