[llvm] change contents of ScalarEvolution from private to protected (PR #83052)

William Moses via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 13:53:28 PDT 2024


================
@@ -0,0 +1,70 @@
+
+#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/LoopAnalysisManager.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+
+#include "llvm/IR/Function.h"
+
+#include "llvm/IR/Instructions.h"
+#include "llvm/Transforms/Utils/ValueMapper.h"
+#include <deque>
+
+// TODO note this doesn't go through [loop, unreachable], and we could get more
+// performance by doing this can consider doing some domtree magic potentially
+static inline llvm::SmallPtrSet<llvm::BasicBlock *, 4>
+getGuaranteedUnreachable(llvm::Function *F) {
----------------
wsmoses wrote:

The guaranteed unreachable stuff is basically finding blocks/paths which are guaranteed to result in unreachable. E.g. if you had something like

```
if (Condition) {
  a()
} else {
 b()
}
exit(); // aka unreachable
```

we can ignore this entire sub-cfg even if the individual blocks terminators are not unreachable (since any path through the block will necessarily result in an unreachable).

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


More information about the llvm-commits mailing list