yaxunl created this revision.
yaxunl added a reviewer: rjmccall.

ActiveFlag is a temporary variable emitted for clean up. It is defined as 
AllocaInst* type and there is
a cast to AlllocaInst in SetActiveFlag. An alloca casted to generic pointer 
causes assertion in
SetActiveFlag.

Since there is only load/store of ActiveFlag, it is safe to use the original 
alloca, therefore disable
the cast.


https://reviews.llvm.org/D47099

Files:
  lib/CodeGen/CGCleanup.cpp
  test/CodeGenCXX/conditional-temporaries.cpp


Index: test/CodeGenCXX/conditional-temporaries.cpp
===================================================================
--- test/CodeGenCXX/conditional-temporaries.cpp
+++ test/CodeGenCXX/conditional-temporaries.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O3 | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=amdgcn-amd-amdhsa -O3 | 
FileCheck %s
 
 namespace {
 
Index: lib/CodeGen/CGCleanup.cpp
===================================================================
--- lib/CodeGen/CGCleanup.cpp
+++ lib/CodeGen/CGCleanup.cpp
@@ -284,7 +284,8 @@
 void CodeGenFunction::initFullExprCleanup() {
   // Create a variable to decide whether the cleanup needs to be run.
   Address active = CreateTempAlloca(Builder.getInt1Ty(), CharUnits::One(),
-                                    "cleanup.cond");
+                                    "cleanup.cond", /*ArraySize=*/nullptr,
+                                    /*Alloca=*/nullptr, /*Cast=*/false);
 
   // Initialize it to false at a site that's guaranteed to be run
   // before each evaluation.


Index: test/CodeGenCXX/conditional-temporaries.cpp
===================================================================
--- test/CodeGenCXX/conditional-temporaries.cpp
+++ test/CodeGenCXX/conditional-temporaries.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O3 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=amdgcn-amd-amdhsa -O3 | FileCheck %s
 
 namespace {
 
Index: lib/CodeGen/CGCleanup.cpp
===================================================================
--- lib/CodeGen/CGCleanup.cpp
+++ lib/CodeGen/CGCleanup.cpp
@@ -284,7 +284,8 @@
 void CodeGenFunction::initFullExprCleanup() {
   // Create a variable to decide whether the cleanup needs to be run.
   Address active = CreateTempAlloca(Builder.getInt1Ty(), CharUnits::One(),
-                                    "cleanup.cond");
+                                    "cleanup.cond", /*ArraySize=*/nullptr,
+                                    /*Alloca=*/nullptr, /*Cast=*/false);
 
   // Initialize it to false at a site that's guaranteed to be run
   // before each evaluation.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to