Index: clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp =================================================================== --- clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp +++ clang/tools/clang-fuzzer/proto-to-llvm/loop_proto_to_llvm.cpp @@ -43,17 +43,17 @@ std::string arr; switch(x.arr()) { case VarRef::ARR_A: - arr = "%a"; + arr = "%0"; break; case VarRef::ARR_B: - arr = "%b"; + arr = "%1"; break; case VarRef::ARR_C: - arr = "%c"; + arr = "%2"; break; } std::string ptr_var = get_var(); - os << ptr_var << " = getelementptr i32, i32* " << arr << ", i64 %ct\n"; + os << ptr_var << " = getelementptr inbounds i32, i32* " << arr << ", i64 %ct\n"; return ptr_var; } std::string RvalueToString(std::ostream &os, const Rvalue &x) { @@ -122,21 +122,22 @@ return os; } 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-unknown-linux-gnu\"\n" + << "define void @foo(i32*, i32*, i32*, i64) {\n" + << "%5 = icmp sgt i64 %3, 0\n" + << "br i1 %5, label %6, label %8\n" + << ";