================
@@ -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:
The approach of rewriting inline asms (`call`, `callbr`) is getting messy;
having to handle them separately and differently between the two subclasses of
`CallBase` appears messy _and_ error prone. I'm hesitant to accept that this
is the best approach. (I think it's important that this PR prototyped this
approach, which gave me a better sense for how difficult/complicated doing this
BEFORE ISEL would be).
So this `TM->getOptLevel()` is what I didn't know existed. 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.
See also:
330fa7d2a4e0cfbb4b078c9f0ec83f176c331afa
So the idea is that _today_ we basically have a switch statement that returns a
relative ordering of preferences when we see `"irm"` constraints. Today we pick
`"r"`, which _may fail_ (I.e. experience unrecoverable register exhaustion) in
fastregalloc. But I think the proper, smallest, lowest risk fix is to peek at
`TM->getOptLevel()` and return a different relative ordering that prefers `"m"`
when `TM->getOptLevel() == CodeGenOptLevel::None`.
https://github.com/llvm/llvm-project/pull/181973
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits