radeonsi: optimization barriers to work around LLVM deficiencies
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 31 Mar 2017 16:42:51 +0000 (18:42 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 5 Apr 2017 13:29:44 +0000 (15:29 +0200)
commit8b13b11f11ccb540831999a24701d2c4bd8dfe1c
tree424b90d7b3f32d5a9d98458a0daa7e96ffc5da1b
parent24d4fbe226c1f5b9a216d05c25737b4b14391975
radeonsi: optimization barriers to work around LLVM deficiencies

Notably, llvm.amdgcn.readfirstlane and llvm.amdgcn.icmp may be hoisted
out of loops or if/else branches in cases like

  if (cond) {
    v = readFirstInvocationARB(x);
    ... use v ...
  } else {
    v = readFirstInvocationARB(x);
    ... use v ...
  }
===>
  v = readFirstInvocationARB(x);
  if (cond) {
    ... use v ...
  } else {
    ... use v ...
  }

The optimization barrier is a heavy hammer to stop that until LLVM
is taught the semantics of the intrinsic properly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c