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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to