Closed
Description
Given this program:
fn main() {
let x = @3;
let mut a = 0;
for uint::range(1, *x) |_i| {
a += 1;
}
assert(a == 2);
}
compiling with -S -O
yields an assembly file containing this, which is what's left of the uint::range
loop (as output by grep -C2 inc
):
.align 16, 0x90
.LBB2_4:
incq %rcx
cmpq %rcx, %rax
jne .LBB2_4
But compiling with -c -O
and disassembling shows a file where the loop has been entirely removed. However, compiling with -S -Zno-asm-comments -O
is faithful to the -c
output; and with --save-temps
we can see that the bitcode is identical between -c
and -S -Zno-asm-comments
and nontrivially different (more than just the comments) for -S
.
So there's something about the asm comments that makes LLVM think they have effects.