I have a problem with the following LLVM code:
%0 = load i64* %u
%1 = load i64* %l
%2 = icmp sgt i64 %1, %1
br i1 %2, label %L1, label %L2
L2:
ret void
br label %L1
L1:
%3 = load i64* %l
%4 = sub i64 %3, 1
store i64 %4, i64* %i
When running llc, I get the following error:
error: instruction expected to be numbered '%4'
%3 = load i64* %l
But I don't understand why it should be %4 after %2. There are no instruction returning a result between the %2 and %4.
I need to understand this because I am writing an LLVM code generator.
So why is it an error to use %3 here?