[PATCH] D38201: Use a BumpPtrAllocator for Loop objects

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 11:49:31 PDT 2017


sanjoy added a comment.

There is a problem with this patch -- the legacy pass manager checks if a loop is valid or not by querying `isInvalid`, which is incorrect; since we call the destructor for loop objects to mark them as "invalid" calling `isInvalid` for possibly invalid loop objects has UB.  We already have this UB in `User::operator delete` though, and so given that and that the legacy pass manager is going away at some point, perhaps this is okay?  Alternatively, I could add a mechanism on the legacy loop pass manager that lets passes denote loop objects to have been deleted (by remembering the pointers in a set) and use that to decide if a Loop object is valid or not (and with that, I can guard `isInvalid` with `#ifndef NDEBUG`).

The asserts are using `isInvalid` correctly, as far as I can tell; they should never have UB in an execution that uses the loop objects correctly.


https://reviews.llvm.org/D38201





More information about the llvm-commits mailing list