[PATCH] D13305: [InstCombine] Remove trivially empty lifetime start/end ranges.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 21:37:49 PDT 2015


chandlerc added a subscriber: chandlerc.
chandlerc accepted this revision.
chandlerc added a reviewer: chandlerc.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM with the fixes suggested inline.

I wonder if we should do something more aggressive to kill pointless lifetime ranges though. This handles the trivial case but non-trivial cases might be very interesting.

For example, even non-strictly-nested ranges won't be caught by this.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1398
@@ +1397,3 @@
+    // immediately followed by an end (ignoring debuginfo in between).
+    BasicBlock::iterator BI = II, BE = II->getParent()->end();
+    for (++BI; BI != BE; ++BI) {
----------------
These should be loop variables.

================
Comment at: test/Transforms/InstCombine/lifetime.ll:2
@@ +1,3 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt < %s -instcombine -S | grep lifetime | count 6
+
----------------
manmanren wrote:
> It is probably better to just check the 6 occurrences with a single RUN command.
This already is checked by the FileCheck line. I think this can just be deleted.


http://reviews.llvm.org/D13305





More information about the llvm-commits mailing list