[PATCH] D40569: Use default IR alignment for cleanup.dest.slot.

2018-01-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

r322406


Repository:
  rC Clang

https://reviews.llvm.org/D40569



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


[PATCH] D40569: Use default IR alignment for cleanup.dest.slot.

2018-01-10 Thread Adrien Bertrand via Phabricator via cfe-commits
adriweb added a comment.

@rjmccall any ETA for a commit as requested by @jacobly?


Repository:
  rC Clang

https://reviews.llvm.org/D40569



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


[PATCH] D40569: Use default IR alignment for cleanup.dest.slot.

2017-11-29 Thread Jacob Young via Phabricator via cfe-commits
jacobly added a comment.

Could someone commit this for me? Thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D40569



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


[PATCH] D40569: Use default IR alignment for cleanup.dest.slot.

2017-11-28 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Okay, seems reasonable enough.


Repository:
  rC Clang

https://reviews.llvm.org/D40569



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


[PATCH] D40569: Use default IR alignment for cleanup.dest.slot.

2017-11-28 Thread Jacob Young via Phabricator via cfe-commits
jacobly created this revision.

Forcing the 4 byte alignment caused an issue in my out of tree backend that 
doesn't even have a 4 byte aligned stack.  Using the default target-specific 
alignment for i32 seems more reasonable.


Repository:
  rC Clang

https://reviews.llvm.org/D40569

Files:
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h


Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -433,7 +433,7 @@
   };
 
   /// i32s containing the indexes of the cleanup destinations.
-  llvm::AllocaInst *NormalCleanupDest;
+  Address NormalCleanupDest;
 
   unsigned NextCleanupDestIndex;
 
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -70,7 +70,7 @@
   IsSanitizerScope(false), CurFuncIsThunk(false), AutoreleaseResult(false),
   SawAsmBlock(false), IsOutlinedSEHHelper(false), BlockInfo(nullptr),
   BlockPointer(nullptr), LambdaThisCaptureField(nullptr),
-  NormalCleanupDest(nullptr), NextCleanupDestIndex(1),
+  NormalCleanupDest(Address::invalid()), NextCleanupDestIndex(1),
   FirstBlockInfo(nullptr), EHResumeBlock(nullptr), ExceptionSlot(nullptr),
   EHSelectorSlot(nullptr), DebugInfo(CGM.getModuleDebugInfo()),
   DisableDebugInfo(false), DidCallStackSave(false), 
IndirectBranch(nullptr),
@@ -433,10 +433,11 @@
   // if compiled with no optimizations. We do it for coroutine as the lifetime
   // of CleanupDestSlot alloca make correct coroutine frame building very
   // difficult.
-  if (NormalCleanupDest && isCoroutine()) {
+  if (NormalCleanupDest.isValid() && isCoroutine()) {
 llvm::DominatorTree DT(*CurFn);
-llvm::PromoteMemToReg(NormalCleanupDest, DT);
-NormalCleanupDest = nullptr;
+llvm::PromoteMemToReg(
+cast(NormalCleanupDest.getPointer()), DT);
+NormalCleanupDest = Address::invalid();
   }
 }
 
Index: lib/CodeGen/CGCleanup.cpp
===
--- lib/CodeGen/CGCleanup.cpp
+++ lib/CodeGen/CGCleanup.cpp
@@ -833,7 +833,7 @@
 if (NormalCleanupDestSlot->hasOneUse()) {
   NormalCleanupDestSlot->user_back()->eraseFromParent();
   NormalCleanupDestSlot->eraseFromParent();
-  NormalCleanupDest = nullptr;
+  NormalCleanupDest = Address::invalid();
 }
 
 llvm::BasicBlock *BranchAfter = Scope.getBranchAfterBlock(0);
@@ -1250,10 +1250,10 @@
 }
 
 Address CodeGenFunction::getNormalCleanupDestSlot() {
-  if (!NormalCleanupDest)
+  if (!NormalCleanupDest.isValid())
 NormalCleanupDest =
-  CreateTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot");
-  return Address(NormalCleanupDest, CharUnits::fromQuantity(4));
+  CreateDefaultAlignTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot");
+  return NormalCleanupDest;
 }
 
 /// Emits all the code to cause the given temporary to be cleaned up.


Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -433,7 +433,7 @@
   };
 
   /// i32s containing the indexes of the cleanup destinations.
-  llvm::AllocaInst *NormalCleanupDest;
+  Address NormalCleanupDest;
 
   unsigned NextCleanupDestIndex;
 
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -70,7 +70,7 @@
   IsSanitizerScope(false), CurFuncIsThunk(false), AutoreleaseResult(false),
   SawAsmBlock(false), IsOutlinedSEHHelper(false), BlockInfo(nullptr),
   BlockPointer(nullptr), LambdaThisCaptureField(nullptr),
-  NormalCleanupDest(nullptr), NextCleanupDestIndex(1),
+  NormalCleanupDest(Address::invalid()), NextCleanupDestIndex(1),
   FirstBlockInfo(nullptr), EHResumeBlock(nullptr), ExceptionSlot(nullptr),
   EHSelectorSlot(nullptr), DebugInfo(CGM.getModuleDebugInfo()),
   DisableDebugInfo(false), DidCallStackSave(false), IndirectBranch(nullptr),
@@ -433,10 +433,11 @@
   // if compiled with no optimizations. We do it for coroutine as the lifetime
   // of CleanupDestSlot alloca make correct coroutine frame building very
   // difficult.
-  if (NormalCleanupDest && isCoroutine()) {
+  if (NormalCleanupDest.isValid() && isCoroutine()) {
 llvm::DominatorTree DT(*CurFn);
-llvm::PromoteMemToReg(NormalCleanupDest, DT);
-NormalCleanupDest = nullptr;
+llvm::PromoteMemToReg(
+cast(NormalCleanupDest.getPointer()), DT);
+NormalCleanupDest = Address::invalid();
   }
 }
 
Index: lib/CodeGen/CGCleanup.cpp
===
--- lib/CodeGen/CGCleanup.cpp
+++ lib/CodeGen/CGCleanup.cpp
@@ -833,7 +833,7 @@