llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

Looks like we can handle more of them these days.

---
Full diff: https://github.com/llvm/llvm-project/pull/206056.diff


3 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+1-26) 
- (modified) clang/test/AST/ByteCode/codegen.cpp (+1-1) 
- (modified) clang/test/CodeGen/cfi-unchecked-callee-attribute.cpp (+1) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 20b110b38ff78..020b2fc0143c5 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -3486,33 +3486,8 @@ bool Compiler<Emitter>::VisitCXXReinterpretCastExpr(
     return this->emitInvalidCast(CastKind::Reinterpret, /*Fatal=*/true, E);
 
   if (FromT == PT_Ptr || ToT == PT_Ptr) {
-    // Both types could be PT_Ptr because their expressions are glvalues.
-    OptPrimType PointeeFromT;
-    if (SubExpr->getType()->isPointerOrReferenceType())
-      PointeeFromT = classify(SubExpr->getType()->getPointeeType());
-    else
-      PointeeFromT = classify(SubExpr->getType());
-
-    OptPrimType PointeeToT;
-    if (E->getType()->isPointerOrReferenceType())
-      PointeeToT = classify(E->getType()->getPointeeType());
-    else
-      PointeeToT = classify(E->getType());
-
-    bool Fatal = true;
-    if (PointeeToT && PointeeFromT) {
-      if (isIntegerOrBoolType(*PointeeFromT) &&
-          isIntegerOrBoolType(*PointeeToT))
-        Fatal = false;
-      else if (E->getCastKind() == CK_LValueBitCast)
-        Fatal = false;
-    } else {
-      Fatal = SubExpr->getType().getTypePtr() != E->getType().getTypePtr();
-    }
-
-    if (!this->emitInvalidCast(CastKind::Reinterpret, Fatal, E))
+    if (!this->emitInvalidCast(CastKind::Reinterpret, /*Fatal=*/false, E))
       return false;
-
     if (E->getCastKind() == CK_LValueBitCast)
       return this->delegate(SubExpr);
     return this->VisitCastExpr(E);
diff --git a/clang/test/AST/ByteCode/codegen.cpp 
b/clang/test/AST/ByteCode/codegen.cpp
index 1b846baadc7b4..53698f13a17a2 100644
--- a/clang/test/AST/ByteCode/codegen.cpp
+++ b/clang/test/AST/ByteCode/codegen.cpp
@@ -118,7 +118,7 @@ int notdead() {
 // CHECK: _ZZ7notdeadvEN3$_0clEv
 // CHECK: ret i32 %cond
 
-/// The conmparison of those two parameters should NOT work.
+/// The comparison of those two parameters should NOT work.
 bool paramcmp(const int& lhs, const int& rhs) {
   if (&lhs == &rhs)
     return true;
diff --git a/clang/test/CodeGen/cfi-unchecked-callee-attribute.cpp 
b/clang/test/CodeGen/cfi-unchecked-callee-attribute.cpp
index feb7c9c30a219..b71111b057e9f 100644
--- a/clang/test/CodeGen/cfi-unchecked-callee-attribute.cpp
+++ b/clang/test/CodeGen/cfi-unchecked-callee-attribute.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm 
-fsanitize=cfi-icall -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm 
-fsanitize=cfi-icall -o - %s -fexperimental-new-constant-interpreter | 
FileCheck %s
 
 #define CFI_UNCHECKED_CALLEE __attribute__((cfi_unchecked_callee))
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/206056
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to