whether we can safely lower a conditional operator to select was insufficient. I've left a large comment in place to explaining the sort of problems that this transform can encounter in clang in the hopes of discouraging others from reimplementing it wrongly again in the future. (The test should also help with that, but it's easy to work around any single test I might add and think that your particular implementation doesn't miscompile any code.) llvm-svn: 194289
10 lines
486 B
C++
10 lines
486 B
C++
// RUN: %clang_cc1 -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
|
|
|
|
bool GetOptionalBool(bool *value);
|
|
bool GetBool(bool default_value) {
|
|
// CHECK-LABEL: @_Z7GetBoolb
|
|
// CHECK-NOT: select
|
|
bool value;
|
|
return GetOptionalBool(&value) ? value : default_value;
|
|
}
|