示例#1
0
void branch(int x) {
// CHECK-LABEL: define void @branch(

// CHECK-NOT: builtin_unpredictable
// CHECK: !unpredictable [[METADATA:.+]]

// CHECK_O0-NOT: builtin_unpredictable
// CHECK_O0-NOT: !unpredictable 

  if (__builtin_unpredictable(x > 0))
    foo ();
}
// TODO: Add metadata for unpredictable switches.
int unpredictable_switch(int x) {
  switch(__builtin_unpredictable(x)) {
  default:
    return 0;
  case 0:
  case 1:
  case 2:
    return 1;
  case 5:
    return 5;
  };

  return 0;
}
示例#3
0
int unpredictable_switch(int x) {
// CHECK-LABEL: @unpredictable_switch(

// CHECK-NOT: builtin_unpredictable
// CHECK: !unpredictable [[METADATA:.+]]

// CHECK_O0-NOT: builtin_unpredictable
// CHECK_O0-NOT: !unpredictable 

  switch(__builtin_unpredictable(x)) {
  default:
    return 0;
  case 0:
  case 1:
  case 2:
    return 1;
  case 5:
    return 5;
  };

  return 0;
}