llvm.org GIT mirror llvm / 60ecc44
Make nocapture analysis work with addrspacecast git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199246 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 6 years ago
3 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
144144 case Instruction::GetElementPtr:
145145 case Instruction::PHI:
146146 case Instruction::Select:
147 case Instruction::AddrSpaceCast:
147148 // The original value is not captured via this if the new value isn't.
148149 Count = 0;
149150 for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end();
436436 case Instruction::GetElementPtr:
437437 case Instruction::PHI:
438438 case Instruction::Select:
439 case Instruction::AddrSpaceCast:
439440 // The original value is not read/written via this if the new value isn't.
440441 for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end();
441442 UI != UE; ++UI) {
722723 // Extend the analysis by looking upwards.
723724 case Instruction::BitCast:
724725 case Instruction::GetElementPtr:
726 case Instruction::AddrSpaceCast:
725727 FlowsToReturn.insert(RVI->getOperand(0));
726728 continue;
727729 case Instruction::Select: {
8383 %x = phi i32* [ %p, %e ]
8484 %y = phi i32* [ %q, %e ]
8585 %tmp = bitcast i32* %x to i32* ; [#uses=2]
86 %tmp2 = select i1 %b, i32* %tmp, i32* %y
87 %val = load i32* %tmp2 ; [#uses=1]
88 store i32 0, i32* %tmp
89 store i32* %y, i32** @g
90 ret i32 %val
91 }
92
93 ; CHECK: define i32 @nc1_addrspace(i32* %q, i32 addrspace(1)* nocapture %p, i1 %b)
94 define i32 @nc1_addrspace(i32* %q, i32 addrspace(1)* %p, i1 %b) {
95 e:
96 br label %l
97 l:
98 %x = phi i32 addrspace(1)* [ %p, %e ]
99 %y = phi i32* [ %q, %e ]
100 %tmp = addrspacecast i32 addrspace(1)* %x to i32* ; [#uses=2]
86101 %tmp2 = select i1 %b, i32* %tmp, i32* %y
87102 %val = load i32* %tmp2 ; [#uses=1]
88103 store i32 0, i32* %tmp