[llvm] r262995 - [WebAssembly] Update comments about irreducible control flow.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 20:17:36 PST 2016
Author: djg
Date: Tue Mar 8 22:17:36 2016
New Revision: 262995
URL: http://llvm.org/viewvc/llvm-project?rev=262995&view=rev
Log:
[WebAssembly] Update comments about irreducible control flow.
Modified:
llvm/trunk/lib/Target/WebAssembly/README.txt
llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
Modified: llvm/trunk/lib/Target/WebAssembly/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/README.txt?rev=262995&r1=262994&r2=262995&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/README.txt (original)
+++ llvm/trunk/lib/Target/WebAssembly/README.txt Tue Mar 8 22:17:36 2016
@@ -22,14 +22,6 @@ turn red if not. Once most of these pass
test suite. The tests can be run locally using:
https://github.com/WebAssembly/waterfall/blob/master/src/compile_torture_tests.py
-Interesting work that remains to be done:
-* Write a pass to restructurize irreducible control flow. This needs to be done
- before register allocation to be efficient, because it may duplicate basic
- blocks and WebAssembly performs register allocation at a whole-function
- level. Note that LLVM's GPU code has such a pass, but it linearizes control
- flow (e.g. both sides of branches execute and are masked) which is undesirable
- for WebAssembly.
-
//===---------------------------------------------------------------------===//
Br, br_if, and br_table instructions can support having a value on the
@@ -112,3 +104,12 @@ just let that value be the exit value of
needing an explicit return operation.
//===---------------------------------------------------------------------===//
+
+Many cases of irreducible control flow could be transformed more optimally
+than via the transform in WebAssemblyFixIrreducibleControlFlow.cpp.
+
+It may also be worthwhile to do transforms before register coloring,
+particularly when duplicating code, to allow register coloring to be aware of
+the duplication.
+
+//===---------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp?rev=262995&r1=262994&r2=262995&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp Tue Mar 8 22:17:36 2016
@@ -13,6 +13,10 @@
/// loops; they appear as CFG cycles that are not recorded in MachineLoopInfo
/// due to being unnatural.
///
+/// Note that LLVM has a generic pass that lowers irreducible control flow, but
+/// it linearizes control flow, turning diamonds into two triangles, which is
+/// both unnecessary and undesirable for WebAssembly.
+///
/// TODO: The transformation implemented here handles all irreducible control
/// flow, without exponential code-size expansion, though it does so by creating
/// inefficient code in many cases. Ideally, we should add other
More information about the llvm-commits
mailing list