[all-commits] [llvm/llvm-project] c79b54: [SEH] Fix assertin when return scalar value from _...

jyu2-git via All-commits all-commits at lists.llvm.org
Tue Nov 7 20:43:54 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c79b544d2b988e26f35db829088e0e5088c57498
      https://github.com/llvm/llvm-project/commit/c79b544d2b988e26f35db829088e0e5088c57498
  Author: jyu2-git <jennifer.yu at intel.com>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/test/CodeGen/windows-seh-EHa-TryInFinally.cpp

  Log Message:
  -----------
  [SEH] Fix assertin when return scalar value from __try block. (#71488)

Current compler assert with `!SI->isAtomic() && !SI->isVolatile()'
failed

This due to following rule:
First, no exception can move in or out of _try region., i.e., no
"potential faulty instruction can be moved across _try boundary. Second,
the order of exceptions for instructions 'directly' under a _try must be
preserved (not applied to those in callees). Finally, global states
(local/global/heap variables) that can be read outside of _try region
must be updated in memory (not just in register) before the subsequent
exception occurs.

All memory instructions inside a _try are considered as 'volatile' to
assure 2nd and 3rd rules for C-code above. This is a little
sub-optimized. But it's acceptable as the amount of code directly under
_try is very small. However during findDominatingStoreToReturnValue:
those are not allowed.

To fix just skip the assertion when current function has seh try.




More information about the All-commits mailing list