Setting up internal oscillator PIC12F1822
On an 8 bit PIC most machine code instructions take 4 clocks to execute. But your program is written in C, not machine code. A single C statement may compile into anything from zero instructions up to the entire available memory space, depending on what machine code the compiler decides is required to implement it.

The code in your while(1) loop compiles to this (XC8 V1.37, 'free' mode):-    

42:                    while (1)
   7FD    2FE0     GOTO 0x7e0
43:                    {
44:                        i++;//increment counter
   7E0    3001     MOVLW 0x1
   7E1    07F4     ADDWF 0x74, F
   7E2    3000     MOVLW 0
   7E3    3DF5     ADDWFC 0x75, F
   7E4    3000     MOVLW 0
   7E5    3DF6     ADDWFC 0x76, F
   7E6    3000     MOVLW 0
   7E7    3DF7     ADDWFC 0x77, F
45:                        if (i&gt;4000000) //is time to toggle?
   7E8    0877     MOVF 0x77, W
   7E9    1D03     BTFSS 0x3, 0x2
   7EA    2FF3     GOTO 0x7f3
   7EB    3001     MOVLW 0x1
   7EC    0274     SUBWF 0x74, W
   7ED    3009     MOVLW 0x9
   7EE    3B75     SUBWFB 0x75, W
   7EF    303D     MOVLW 0x3d
   7F0    3B76     SUBWFB 0x76, W
   7F1    1C03     BTFSS 0x3, 0
   7F2    2FE0     GOTO 0x7e0
46:                        {
47:                            i=0; //reset counter
   7F3    3000     MOVLW 0
   7F4    00F7     MOVWF 0x77
   7F5    3000     MOVLW 0
   7F6    00F6     MOVWF 0x76
   7F7    3000     MOVLW 0
   7F8    00F5     MOVWF 0x75
   7F9    3000     MOVLW 0
   7FA    00F4     MOVWF 0x74
48:                            PORTA=~PORTA; //toggle LED
   7FB    0020     MOVLB 0


So the single i++ statement resulted in 8 machine code instructions. With i redefined as char instead of long only 4 instructions are generated. The same operation in assembler might only require 1 instruction.

A few machine code instructions take more than 1 CPU cycle (4 clocks) to execute. BTFSS (bit test file, skip if set) always takes 2 cycles, even when skipping the next instruction. GOTO also takes 2 cycles, but BTFSS followed by GOTO only take 3 cycles.

PICs only have a 1 instruction pipeline so the timing is very predictable. Even so, calculating the precise execution time of a complex machine code program is not easy. Doing it from high level source is practically impossible.  

If you want precise timing then your choices are:-


'tweak' the delay loop (and realize that any change may break it) 
Write in assembler 
Use a hardware timer  


Option 3 is the best choice if you want reliable, scalable, maintainable code.