[PATCH] D13606: [Introduction] Redundant load reduction with invariant intrinsics

Larisse Voufo via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 23:15:23 PDT 2015


lvoufo marked 11 inline comments as done.

================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:2640-2641
@@ +2639,4 @@
+  // Scan the block to process invariant intrinsics, tracing whatever
+  // call chain that can be traced.
+  // Without this, invariant intrinsics on global variables, can only be
+  // processed when the constructor calls are inlined.
----------------
The real reason why this version of processInvariantIntrinsics() is necessary is that EvaluateBlock() could exit before processing the invariant intrinsic call (and marking global variables 'writeonce'), e.g., if a call to a function declaration that we cannot constant fold occurs before the intrinsic call.

This processInvariantIntrinsics() complements Evaluator::EvaluateBlock() by pre-traversing the call-stack tree on the same Evaluator instance. The alternative would be to delay exits from Evaluator::EvaluateBlock() while remembering whether to exit with 'false' or 'true'; which would be a messier extension than separating the functions.

I'm rewriting this function with respect to other comments below anyway...




http://reviews.llvm.org/D13606





More information about the llvm-commits mailing list