[PATCH] D13354: Assign correct edge weights to unwind destinations when lowering invoke statement.
Cong Hou via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 15:42:13 PDT 2015
congh added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1203
@@ +1202,3 @@
+ BranchProbabilityInfo *BPI = FuncInfo.BPI;
+ // A lambda that updates the weight of the edge to the new EHPadBB.
+ auto GetUnwindDest = [BPI, &Weight](const BasicBlock *EHPadBB,
----------------
rnk wrote:
> This is just code that runs on every iteration of the while loop. We don't need a lambda, just put it before the end of the loop. You'll have to create a `NewEHPadBB` local variable and assign it to EHPadBB, but that seems OK to me.
I have removed the lambda by putting it to the end of the loop (the else case should escape from this part).
================
Comment at: test/CodeGen/X86/catchpad-weight.ll:1
@@ +1,2 @@
+; RUN: llc -march=x86-64 -print-machineinstrs=expand-isel-pseudos %s -o /dev/null 2>&1 | FileCheck %s
+
----------------
rnk wrote:
> I think the IR for this C++ code would make a better test case:
> struct A {};
> struct B {};
> struct C {};
> struct HasDtor {
> ~HasDtor();
> };
> void may_throw();
> int main() {
> HasDtor o;
> try {
> may_throw();
> } catch (A) {
> } catch (B) {
> } catch (C) {
> }
> }
> Then the invoke for `may_throw` has five total successors: the normal edge, the three catchpads, and the cleanup.
>
> You can get the catchpad IR like this:
> $ clang -c --target=x86_64-windows-msvc t.cpp -S -emit-llvm -o - -fexceptions -O2
Yes, this test case is more complete. I have replaced the old test case with this one. Thanks!
http://reviews.llvm.org/D13354
More information about the llvm-commits
mailing list