IR: Alloca clones should remember inalloca state
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 30 Apr 2014 16:12:21 +0000 (16:12 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 30 Apr 2014 16:12:21 +0000 (16:12 +0000)
Pretty straightforward, we weren't propagating whether or not an
AllocaInst had 'inalloca' marked on it when it came time to clone it.

The inliner exposed this bug.  A reduced testcase is forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207665 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Instructions.cpp

index 5b93c5323abcfe0407e82a612ea9fc5149a4dba6..e8bcddbd9921a8deed4f11a8275ed67566f5f2b2 100644 (file)
@@ -3587,9 +3587,10 @@ InsertValueInst *InsertValueInst::clone_impl() const {
 }
 
 AllocaInst *AllocaInst::clone_impl() const {
-  return new AllocaInst(getAllocatedType(),
-                        (Value*)getOperand(0),
-                        getAlignment());
+  AllocaInst *Result = new AllocaInst(getAllocatedType(),
+                                      (Value *)getOperand(0), getAlignment());
+  Result->setUsedWithInAlloca(isUsedWithInAlloca());
+  return Result;
 }
 
 LoadInst *LoadInst::clone_impl() const {