[PATCH] A new HeapToStack allocation promotion pass
Hal Finkel
hfinkel at anl.gov
Tue Sep 24 05:19:22 PDT 2013
----- Original Message -----
>
>
> ================
> Comment at: lib/Transforms/Scalar/HeapToStack.cpp:275
> @@ +274,3 @@
> +
> + if (VerifiedMallocs.count((Instruction *) FAddr)) {
> + DEBUG(dbgs() << "H2S: malloc " << *FAddr <<
> ----------------
> Seems odd to use c-style casts?
FAddr might not be an instruction, but it probably is. I could write:
if (isa<Instruction>(FAddr) && VerifiedMallocs.count(cast<Instruction>(FAddr)))
or even
if (VerifiedMallocs.count(dyn_cast<Instruction>(FAddr)))
but both of those pessimize the common case. Pointers to non-instruction will never be in the map.
It is just a micro-optimization (which happens to lead to fewer source-code characters). I'm fine with removing it for clarity.
Thanks,
Hal
>
>
> http://llvm-reviews.chandlerc.com/D1745
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list