[llvm-commits] [llvm] r157261 - in /llvm/trunk: include/llvm/InitializePasses.h include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h include/llvm/Transforms/Utils/Local.h lib/Transforms/InstCombine/InstCombine.h lib/Transforms/InstCombine/InstCombineAddSub.cpp lib/Transforms/InstCombine/InstructionCombining.cpp lib/Transforms/Scalar/BoundsChecking.cpp lib/Transforms/Scalar/Scalar.cpp

John Criswell criswell at illinois.edu
Wed May 23 16:25:31 PDT 2012


etPointerOperand()->stripPointerCasts();
+  }

>>> If I understand this code correctly, you're just checking to see if
>>> the dereferenced pointer (Ptr) is a GEP and, if so, generating code
>>> to calculate it's offset.  What if Ptr is a PHI node derived from a
>>> GEP?  I imagine you'd see that in loops a lot.  Does it handle
>>> non-pointer casts (like inttoptr and ptrtoint, which I think some of
>>> the loop transforms add when modifying GEPs)?  Unless I'm not seeing
>>> something, your code will miss a lot of trivial cases.  Is this
>>> intentional or an oversight?
>> Right now the code doesn't support PHIs nor selects, but support will
>> come soon.
> SAFECode's exactcheck optimization supports most of these; the PHI node
> is the only one that is missing AFAIK, and we'll have that once we
> refactor the optimization to be more efficient.

Just a correction: I double checked the exactcheck optimization code 
today, and it actually does scan up through PHI nodes and select 
instructions, so it handles these cases already.

-- John T.




More information about the llvm-commits mailing list