[PATCH] D52707: Switch optimization in IR for known maximum switch values

Ayonam Ray via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 21 14:48:20 PDT 2018


ayonam marked 9 inline comments as done.
ayonam added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:4884
+                         DefaultResultsList, DL, TTI))
+      return false;
+
----------------
hans wrote:
> What's happening here? Why do we need to find a constant value on the phi node?
> 
> We'll need to update any phi node in the default block when adding the new case, but there's no need for it to be constant.
It should just be a Value and not a Constant.  I had a test case that had a constant on the PHI node and hence I had coded thus.

I tried changing this to a Value and realized that there isn't a method that gives me all the Values that are created in a given Case block.  There is a method that returns all constants that are created in a Case block.  Would you know of any other method that would return me the Values?  Or else I will have to write one of my own.




https://reviews.llvm.org/D52707





More information about the llvm-commits mailing list