[PATCH] D60793: [Evaluator] Walk initial elements when handling load through bitcast

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 00:44:58 PDT 2019


evgeny777 added a comment.

I wonder if it's possible to stop using `MutatedMemory` for checks in `ComputeLoadResult` and instead start using separate map which can also be filled 
in `EvaluateBlock`. In this new map you can use bitcast (or even first operand of bitcast) as a key.

Also please strip your patch from unrelated changes for now to make it easier to read.



================
Comment at: lib/Transforms/Utils/Evaluator.cpp:233
     case Instruction::GetElementPtr:
-      if (auto *I = getInitializer(CE->getOperand(0)))
-        return ConstantFoldLoadThroughGEPConstantExpr(I, CE);
+      if (auto *Val = getInitializer(CE->getOperand(0)))
+        return ConstantFoldLoadThroughGEPConstantExpr(Val, CE);
----------------
This seems to be an unrelated change


================
Comment at: lib/Transforms/Utils/Evaluator.cpp:373
+
+          auto castValTy = [this, Val, &Ptr](Constant *P) -> Constant * {
+            Type *Ty = cast<PointerType>(P->getType())->getElementType();
----------------
May be use `[&]` ?


================
Comment at: test/Transforms/GlobalOpt/evaluate-bitcast-2.ll:6
+
+; CHECK: @l = dso_local local_unnamed_addr global i64 12345, align 8
+
----------------
You should also check value of `@u`, I think


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60793/new/

https://reviews.llvm.org/D60793





More information about the llvm-commits mailing list