[PATCH] D37933: Prevent InstCombine from miscompiling `operator delete`

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 15:23:49 PDT 2017


davide added a comment.

So, from what I can see no transformation made for free() is valid in case of `operator delete`.
What do you think instead of introducing a predicate `isCallToOperatorDelete()` and bail out at the beginning of `visitFree()` ?
Alternatively, we could add a boolean argument to `isFreeCall()` which doesn't include `operator delete` (still trying to pick a name for the argument).

I'm leaning towards 1), what do you think?



================
Comment at: lib/Analysis/MemoryBuiltins.cpp:351
 
+/// hasSideEffectsFreeCall - Returns true if the call has side effects.
+bool llvm::hasSideEffectsFreeCall(const CallInst *CI,
----------------
rsmith wrote:
> This is a really confusing name. It sounds like it's detecting whether a call is free of side-effects, whereas it's *actually* detecting whether the call is to a `free`-like function that has side-effects.
Not really happy about the name either, have a better proposal?


https://reviews.llvm.org/D37933





More information about the llvm-commits mailing list