tentzen added a comment.

In D77936#1976938 <https://reviews.llvm.org/D77936#1976938>, @efriedma wrote:

> Instead of asserting there are less than 256 cleanup destinations, can you 
> emit an icmp against zero, or something like that?


I did consider that. but it splits the block and induces one compare and one 
branch in _try exit sequence for something that will not happen in RWC.  And 
it's hard for Optimizer to deal with it.  Optimizer can probably can 
tail-duplicate each path at the expense of code size which I don't think LLVM 
would do today.  Do you really think it's worth to split the block here? thanks



================
Comment at: clang/lib/CodeGen/CGException.cpp:1651
+      llvm::Value* Load = CGF.Builder.CreateLoad(Addr, "cleanup.dest");
+      IsForEH = CGF.Builder.CreateTrunc(Load, CGM.Int8Ty);
+    }
----------------
efriedma wrote:
> Is just truncating the value really correct?  What's the possible range of 
> values stored in getNormalCleanupDestSlot()?
Good question! 
Usually the number in NormalCleanupDestSlot is single digit (or at most 
double-digit) , the totoal number of Jump Destinations 
(return/goto/break/continue/..)  in the function.  
I thought about widening 1st arg from CHAR to unsigned, but dropped the idea as 
it seems unnecessary.  Yes, someone can write a code to make more than 255 
Jumps in a function,  but it’s unlikely to happen in real world code.  What do 
you think?
I can go either way..
For sure, we can add an assert to catch it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77936



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

Reply via email to