[PATCH] SimplifyCFG: don't remove unreachable defaults from switch instructions; exploit them instead!
David Majnemer
david.majnemer at gmail.com
Thu Dec 4 15:26:04 PST 2014
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3228
@@ -3236,3 +3227,3 @@
// If NumCases overflowed, then all possible values jump to the successor.
- if (NumCases->isNullValue() && SI->getNumCases() != 0)
+ if (NumCases->isNullValue() && ContiguousCases->size() != 0)
Cmp = ConstantInt::getTrue(SI->getContext());
----------------
`!ContiguousCases->empty()`
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3247
@@ +3246,3 @@
+ }
+ while (TrueWeight > UINT_MAX || FalseWeight > UINT_MAX) {
+ TrueWeight /= 2;
----------------
I'd go with `UINT32_MAX` to match the casts bellow.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:4202
@@ -4197,3 +4201,3 @@
SI->getDefaultDest()->removePredecessor(SI->getParent(),
- true/*DontDeleteUselessPHIs*/);
+ true /*DontDeleteUselessPHIs*/);
} else {
----------------
/*DontDeleteUselessPHIs=*/true
http://reviews.llvm.org/D6471
More information about the llvm-commits
mailing list