[PATCH] D16302: [opaque pointer types] [NFC] Take advantage of get{Source, Result}ElementType when folding GEPs.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 16:24:19 PST 2016


dblaikie added inline comments.

================
Comment at: lib/Analysis/ConstantFolding.cpp:739
@@ +738,3 @@
+
+  if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy, DL, TLI))
+    return C;
----------------
eddyb wrote:
> dblaikie wrote:
> > How/why did this get rolled in here?
> I had two calls to `SymbolicallyEvaluateGEP` at some point and it was easier to have it here than two `CastGEPIndices` at each site.
> 
> IMO `CastGEPIndices` shouldn't bother creating a GEP ConstantExpression but rather change what `Ops` in this function points to (if any indices were cast).
Realize that, to speed throughput, I'm looking at these changes /really/ superficially/mechanically. Anything that's more than a very local change for accessing type information slows me down a fair bit & I may not understand it fully. (case in point here - I haven't looked at what this function is trying to do or how it might best do that - just at whether the behavior seems to be preserved by moving around the type information and how it's accessed) :)

So the more you can help me understand anything more complicated than that (or avoid such complications/separate them into pre or post patches), the better.

================
Comment at: lib/Analysis/ConstantFolding.cpp:860
@@ -859,3 @@
-    } else {
-      // We've reached some non-indexable type.
-      break;
----------------
Was this dead code previously?


Repository:
  rL LLVM

http://reviews.llvm.org/D16302





More information about the llvm-commits mailing list