================
@@ -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 added this to the front-end and skipped the processing in this module and it 
generated good code. I think I'm going to get very very drunk. 😆 

```
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 55669c806bc6..4dffe606c445 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -2892,9 +2892,11 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
     // and 'm', such as "g" (which expands to "imr").
     const bool RegisterMemoryConstraints =
         OutputConstraint == "rm" || OutputConstraint == "mr";
+    bool OptLevelNone = CGM.getCodeGenOpts().OptimizationLevel == 0;
 
     if (IsScalarOrAggregate &&
-        (!Info.allowsMemory() || RegisterMemoryConstraints)) {
+        (!Info.allowsMemory() ||
+         (!OptLevelNone && RegisterMemoryConstraints))) {
       Constraints += "=" + OutputConstraint;
       ResultRegQualTys.push_back(QTy);
       ResultRegDests.push_back(Dest);
```

https://github.com/llvm/llvm-project/pull/181973
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to