[PATCH] D50342: Changed how LLVM IR was generated to increase vectorization
    Matt Morehouse via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Aug  6 15:29:41 PDT 2018
    
    
  
morehouse added inline comments.
================
Comment at: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp:127
+            << "define void @foo(i32* %a, i32* %b, i32* %c, i64 %s) {\n"
+            << "%1 = icmp sgt i64 %s, 0\n"
+            << "br i1 %1, label %start, label %end\n"
----------------
Should `%s` be signed?  Do we want unsigned compare here?
================
Comment at: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp:134
+            << "end:\n"
+            << "ret void\n"
             << "loop:\n"
----------------
Seems like the `endloop` label is unnecessary.  Does this help vectorize?  If not, lets get rid of unconditional jumps to the next line.
================
Comment at: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp:138
             << x.statements()
-            << "%z = add i64 1, %ct\n"
-            << "store i64 %z, i64* %i\n"
-            << "br label %loop\n\n"
-            << "endloop:\n"
-            << "ret void\n}\n";
+            << "%ctnew = add nuw nsw i64 %ct, 1\n"
+            << "%j = icmp eq i64 %ctnew, %s\n"
----------------
This will make overflow undefined... Isn't that the opposite of what we want?  That will permit LLVM to assume overflow never happens and modify the code in new ways based on that assumption.
Repository:
  rC Clang
https://reviews.llvm.org/D50342
    
    
More information about the llvm-commits
mailing list