[PATCH] D77502: [clang][CodeGen] Handle throw expression in conditional operator constant folding
Raul Tambre via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 6 04:17:50 PDT 2020
tambre added inline comments.
================
Comment at: clang/lib/CodeGen/CGExpr.cpp:4337
+ EmitCXXThrowExpr(ThrowExpr);
+ return EmitLValue(dead);
+ }
----------------
rsmith wrote:
> The IR we emit for the dead operand is unreachable; it's a bit wasteful to generate it here and (hopefully!) leave it to the optimizer to remove it again. Perhaps we could produce an `undef` lvalue instead? See `CodeGenFunction::EmitUnsupportedLValue` for an example of how to build such a value.
Done.
================
Comment at: clang/test/CodeGenCXX/throw-expressions.cpp:84-87
+ void conditional_throw() {
+ int a, b;
+ (true ? throw 0 : a) = 0;
+ }
----------------
rsmith wrote:
> Please add some `CHECK`s in here to make sure we actually emit a call to `__cxa_throw`.
Done.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77502/new/
https://reviews.llvm.org/D77502
More information about the cfe-commits
mailing list