steakhal wrote:

I wanted to come back with another example:
```c++
int ternary_in_assume(int a, int b) {
  [[assume(a > 10 ? b == 4 : b == 10)]];
  if (a > 20)
    return b + 100; // expecting 104
  if (a > 10)
    return b + 200; // expecting 204
  return b + 300; // expecting 310
}
```

Actually, neither gcc, clang, msvc, or icc optimizes the return paths to 
constants - even though I think they would be allowed to. 
https://compiler-explorer.com/z/1ajvcvG9h

I'd need to think about of the implications for us though. I think it should be 
safe to eval these subexpressions and do state splits if and only if none of 
those expressions have sideeffects. In that case, they wouldn't be emitted into 
the CFG, so they shouldn't be a problem.

https://github.com/llvm/llvm-project/pull/116462
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to