Fznamznon added inline comments.

================
Comment at: clang/include/clang/Sema/Sema.h:12855
+                        !Condition.get()->isValueDependent() &&
+                        Condition.get()->isIntegerConstantExpr(S.Context)),
           KnownValue(HasKnownValue &&
----------------
aaron.ballman wrote:
> Oof, this adds quite a bit of expense to this constructor -- 
> `isIntegerConstantExpr()` is implemented by evaluating the constant 
> expression and throwing away the computed result... which we then recompute 
> when setting `KnownValue` one line later. It'd be better to only do this 
> computation once and use the computed value to initialize both members.
Oops, now it is evaluated only one time.
It seems clang's codebase have several places with the same mistake I've made 
here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148206/new/

https://reviews.llvm.org/D148206

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to