Index: llvm/trunk/include/llvm/Analysis/ObjCARCAnalysisUtils.h =================================================================== --- llvm/trunk/include/llvm/Analysis/ObjCARCAnalysisUtils.h +++ llvm/trunk/include/llvm/Analysis/ObjCARCAnalysisUtils.h @@ -34,6 +34,7 @@ #include "llvm/IR/InstIterator.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" +#include "llvm/IR/ValueHandle.h" #include "llvm/Pass.h" namespace llvm { @@ -89,11 +90,13 @@ /// A wrapper for GetUnderlyingObjCPtr used for results memoization. inline const Value * GetUnderlyingObjCPtrCached(const Value *V, const DataLayout &DL, - DenseMap &Cache) { + DenseMap &Cache) { if (auto InCache = Cache.lookup(V)) return InCache; - return Cache[V] = GetUnderlyingObjCPtr(V, DL); + const Value *Computed = GetUnderlyingObjCPtr(V, DL); + Cache[V] = const_cast(Computed); + return Computed; } /// The RCIdentity root of a value \p V is a dominating value U for which Index: llvm/trunk/lib/Transforms/ObjCARC/ProvenanceAnalysis.h =================================================================== --- llvm/trunk/lib/Transforms/ObjCARC/ProvenanceAnalysis.h +++ llvm/trunk/lib/Transforms/ObjCARC/ProvenanceAnalysis.h @@ -28,6 +28,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/IR/ValueHandle.h" #include namespace llvm { @@ -56,7 +57,7 @@ CachedResultsTy CachedResults; - DenseMap UnderlyingObjCPtrCache; + DenseMap UnderlyingObjCPtrCache; bool relatedCheck(const Value *A, const Value *B, const DataLayout &DL); bool relatedSelect(const SelectInst *A, const Value *B);