llvm.org GIT mirror llvm / ca4cac4
Fix a hole in the definition of "dependence" used by trap values. Trap values are also transmitted through branches which cause side effects to be skipped altogether. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129404 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
1 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
23702370 is always executed when control transfers to one of the successors, and
23712371 may not be executed when control is transfered to another.
23722372
2373
  • Additionally, an instruction also control-depends on a terminator
  • 2374 instruction if the set of instructions it otherwise depends on would be
    2375 different if the terminator had transfered control to a different
    2376 successor.
    2377
    23732378
  • Dependence is transitive.
  • 23742379
    23752380
    24122417 ; control-dependent on %cmp, so this
    24132418 ; always results in a trap value.
    24142419
    2415 volatile store i32 0, i32* @g ; %end is control-equivalent to %entry
    2416 ; so this is defined (ignoring earlier
    2420 volatile store i32 0, i32* @g ; This would depend on the store in %true
    2421 ; if %cmp is true, or the store in %entry
    2422 ; otherwise, so this is undefined behavior.
    2423
    2424 %br i1 %cmp, %second_true, %second_end
    2425 ; The same branch again, but this time the
    2426 ; true block doesn't have side effects.
    2427
    2428 second_true:
    2429 ; No side effects!
    2430 br label %end
    2431
    2432 second_end:
    2433 volatile store i32 0, i32* @g ; This time, the instruction always depends
    2434 ; on the store in %end. Also, it is
    2435 ; control-equivalent to %end, so this is
    2436 ; well- defined (again, ignoring earlier
    24172437 ; undefined behavior in this example).
    24182438
    24192439