[PATCH] D50342: Changed how LLVM IR was generated to increase vectorization

Emmett Neyman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 6 13:05:34 PDT 2018


emmettneyman added inline comments.


================
Comment at: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp:125
 std::ostream &operator<<(std::ostream &os, const LoopFunction &x) {
-  return os << "define void @foo(i32* %a, i32* %b, i32* noalias %c, i64 %s) {\n"
-            << "%i = alloca i64\n"
-            << "store i64 0, i64* %i\n"
-            << "br label %loop\n\n"
-            << "loop:\n"
-            << "%ct = load i64, i64* %i\n"
-            << "%comp = icmp eq i64 %ct, %s\n"
-            << "br i1 %comp, label %endloop, label %body\n\n"
-            << "body:\n"
+  return os << "target triple = \"x86_64-pc-linux-gnu\"\n"
+            << "define void @foo(i32*, i32*, i32*, i64) {\n"
----------------
morehouse wrote:
> What does `pc` mean in this triple?  I'm used to seeing `x86_64-unknown-linux-gnu`.
It's probably generating `pc` since I'm using my desktop. I'll change it to `unknown` so it's not platform-specific.


================
Comment at: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp:126
+  return os << "target triple = \"x86_64-pc-linux-gnu\"\n"
+            << "define void @foo(i32*, i32*, i32*, i64) {\n"
+            << "%5 = icmp sgt i64 %3, 0\n"
----------------
morehouse wrote:
> Does removing the variable names really make this easier to vectorize?
It doesn't, I just thought it was cleaner and produced slightly smaller IR. It also more closely mimics the behavior of the `-emit-llvm` flag.


================
Comment at: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp:129
+            << "br i1 %5, label %6, label %8\n"
+            << "; <label>:6:\n"
+            << "br label %9\n"
----------------
morehouse wrote:
> Does removing branch names really make this easier to vectorize?
Same answer as above. Should I change these back?


Repository:
  rC Clang

https://reviews.llvm.org/D50342





More information about the llvm-commits mailing list