[PATCH] D29316: Add predicateinfo intrinsic, analysis pass, and basic NewGVN support

Piotr Padlewski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 16:35:15 PST 2017


Prazek added inline comments.


================
Comment at: include/llvm/Transforms/Utils/PredicateInfo.h:244
+  struct Result {
+    Result(std::unique_ptr<PredicateInfo> &&PredInfo)
+        : PredInfo(std::move(PredInfo)) {}
----------------
dberlin wrote:
> Prazek wrote:
> > take unique_ptr by value. This ensures that the pointer value sinks (and it is also less characters to read, and it is easier for the optimizer to optimize it) 
> This does not actually work, afaict.
> If you try it, it does not compile no matter what because unique ptrs can't be copied by value, only moved.
> 
> If you want me to do something here, exact code appreciated.
> 
> This is also a direct copy of the idiom we are using in other analysis passes :)
> 
I am not sure if the code dissapeard, but code like this:

  void take(std::unique_ptr<int> p) {
  }


  void push() {
    std::unique_ptr<int> a;

    take(std::move(a));
  }

Compiles fine, so I would guess it should work, but I will check it with your next reviews.


https://reviews.llvm.org/D29316





More information about the llvm-commits mailing list