llvm.org GIT mirror llvm / 05006e2
re-commit r109220, the compile error has already been fixed Simplifying use_iterators by dereferencing is not a good idea. The codebase does not depend in this any more, and it may introduce hidden runtime cost. If you get compile errors, please dereference your iterator before passing to cast<> (and friends). Also: please consider caching the result of operator* and reusing that instead of dereferencing many times. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109425 91177308-0d34-0410-b5e6-96231b3b80d8 Gabor Greif 9 years ago
2 changed file(s) with 5 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
316316 and CallInst.
317317 To be portable across releases, resort to CallSite and the
318318 high-level accessors, such as getCalledValue and setUnwindDest.
319
320
  • 321 You can no longer pass use_iterators directly to cast<> (and similar), because
    322 these routines tend to perform costly dereference operations more than once. You
    323 have to dereference the iterators yourself and pass them in.
    319324
    320325
    321326
    209209 unsigned getOperandNo() const;
    210210 };
    211211
    212
    213 template<> struct simplify_type > {
    214 typedef User* SimpleType;
    215
    216 static SimpleType getSimplifiedValue(const value_use_iterator &Val) {
    217 return *Val;
    218 }
    219 };
    220
    221 template<> struct simplify_type >
    222 : public simplify_type > {};
    223
    224 template<> struct simplify_type > {
    225 typedef const User* SimpleType;
    226
    227 static SimpleType getSimplifiedValue(const
    228 value_use_iterator &Val) {
    229 return *Val;
    230 }
    231 };
    232
    233 template<> struct simplify_type >
    234 : public simplify_type > {};
    235
    236212 } // End llvm namespace
    237213
    238214 #endif