[PATCH] D19276: folding compares if pointers do not escape

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 15:23:12 PDT 2016


majnemer accepted this revision.
majnemer added a comment.

LGTM with nits.


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1868
@@ +1867,3 @@
+    return true;
+  if (LoadInst *LI = dyn_cast<LoadInst>(V))
+    return isa<GlobalVariable>(LI->getPointerOperand());
----------------
Please use `auto *` on the left hand side if the code makes it easy to figure out what the type is from the right hand side.

================
Comment at: test/Transforms/InstCombine/compared-unescaped.ll:1
@@ +1,2 @@
+; RUN: opt -instcombine -S %s | FileCheck %s
+
----------------
I'd recommend rewriting the pipeline to redirect %s into opt like so:
  opt -instcombine -S < %s | FileCheck %s

Paths make their way into opt's output sometimes and you could get confusing results if folks stick their LLVM checkout in weird places.

================
Comment at: test/Transforms/InstCombine/compared-unescaped.ll:3
@@ +2,3 @@
+
+ at gp= global i32* null, align 8
+
----------------
space before the equals token.

================
Comment at: test/Transforms/InstCombine/compared-unescaped.ll:17
@@ +16,3 @@
+
+define i1 @compare_global_trivialne(){
+  %m = call i8* @malloc(i64 4)
----------------
space before the curly brace.


http://reviews.llvm.org/D19276





More information about the llvm-commits mailing list