[all-commits] [llvm/llvm-project] 81522a: [clang][Interp] Optionally cast comparison result ...

Timm Bäder via All-commits all-commits at lists.llvm.org
Wed May 31 04:01:27 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81522a012accfcc6bbf4dfa21a793aea6e4e532a
  Author: Timm Bäder <tbaeder at redhat.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M clang/lib/AST/Interp/ByteCodeExprGen.cpp
    A clang/test/AST/Interp/c.c

  Log Message:
  [clang][Interp] Optionally cast comparison result to non-bool

Our comparison opcodes always produce a Boolean value and push it on the
stack. However, the result of such a comparison in C is int, so the
later code expects an integer value on the stack.

Work around this problem by casting the boolean value to int in those
cases. This is not ideal for C however. The comparison is usually
wrapped in a IntegerToBool cast anyway.

Differential Revision: https://reviews.llvm.org/D149645

More information about the All-commits mailing list