llvm.org GIT mirror llvm / 1bda2d9
We may visit a call that uses an alloca multiple times in callUsesLocalStack, sometimes with IsNocapture true and sometimes with IsNocapture false. We accidentally skipped work we needed to do in the IsNocapture=false case if we were called with IsNocapture=true the first time. Fixes PR20405! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213726 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 5 years ago
2 changed file(s) with 18 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
226226 }
227227
228228 void callUsesLocalStack(CallSite CS, bool IsNocapture) {
229 // Add it to the list of alloca users. If it's already there, skip further
230 // processing.
231 if (!AllocaUsers.insert(CS.getInstruction()))
232 return;
233
234 // If it's nocapture then it can't capture the alloca.
229 // Add it to the list of alloca users.
230 AllocaUsers.insert(CS.getInstruction());
231
232 // If it's nocapture then it can't capture this alloca.
235233 if (IsNocapture)
236234 return;
237235
173173 return:
174174 ret void
175175 }
176
177 declare void @test11_helper1(i8** nocapture, i8*)
178 declare void @test11_helper2(i8*)
179 define void @test11() {
180 ; CHECK-LABEL: @test11
181 ; CHECK-NOT: tail
182 %a = alloca i8*
183 %b = alloca i8
184 call void @test11_helper1(i8** %a, i8* %b) ; a = &b
185 %c = load i8** %a
186 call void @test11_helper2(i8* %c)
187 ; CHECK: call void @test11_helper2
188 ret void
189 }