[PATCH] D22710: Add option to CodeExtractor for hoisting dominated static allocas

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 04:11:39 PDT 2016


silvas added a comment.

Another quick comment.


================
Comment at: /Users/rriddle/Desktop/llvm/llvm/lib/Transforms/Utils/CodeExtractor.cpp:732
@@ +731,3 @@
+      // Only take static allocas.
+      AllocaInst *AI = const_cast<AllocaInst*>(dyn_cast<AllocaInst>(inputs[I]));
+      if (AI && AI->isStaticAlloca() && !hasOutsideUses(Blocks, AI)) {
----------------
There seem to be very few uses of this pattern of const_cast combined with dyn_cast, and it smells a bit fishy to me. Is there some other preferred pattern in use in the codebase? Or is there another way to avoid the const_cast?


https://reviews.llvm.org/D22710





More information about the llvm-commits mailing list