================
@@ -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:
> 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.
If we go this route, we could simply have two paths in the front-end: one for
`-O0` (the original behavior), and one for `-On` (the desired behavior). That
would obviate the need for any of this code.
**Pros:** This should "Just Work(tm)" (to borrow a phrase from Todd Howard)!
And it's easier to extend to other constraint combos, like `"irm"`, and others
that may come up in the future.
**Cons:** This would "break" the use of `-O2 -mllvm -regalloc=fast`, but then
this PR doesn't support that either. We also lose the ability to test this in
the middle- and back-ends, so a lot of surgery would need to be done on the ASM
test files so that we get good coverage.
https://github.com/llvm/llvm-project/pull/181973
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits