[PATCH] D43457: [Evaluator] Improve evaluation of load/store

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 8 06:38:02 PST 2018


tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM with some minor comments below.



================
Comment at: include/llvm/Analysis/ConstantFolding.h:150
 
+Constant *ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy,
+                                         const DataLayout &DL);
----------------
document


================
Comment at: lib/Transforms/Utils/Evaluator.cpp:202
+      GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0));
+      if (GV && GV->hasDefinitiveInitializer())
+        return ConstantFoldLoadThroughBitcast(
----------------
The two opcode cases are both doing the same checks (is it a global variable with a definitive initializer), but the checking is structured differently. Suggest structuring the checks the same way for both opcodes.


https://reviews.llvm.org/D43457





More information about the llvm-commits mailing list