Skip to content

Commit

Permalink
[opaque pointer type] Add textual IR support for explicit type parame…
Browse files Browse the repository at this point in the history
…ter to getelementptr instruction

One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.

This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.

* This doesn't modify gep operators, only instructions (operators will be
  handled separately)

* Textual IR changes only. Bitcode (including upgrade) and changing the
  in-memory representation will be in separate changes.

* geps of vectors are transformed as:
    getelementptr <4 x float*> %x, ...
  ->getelementptr float, <4 x float*> %x, ...
  Then, once the opaque pointer type is introduced, this will ultimately look
  like:
    getelementptr float, <4 x ptr> %x
  with the unambiguous interpretation that it is a vector of pointers to float.

* address spaces remain on the pointer, not the type:
    getelementptr float addrspace(1)* %x
  ->getelementptr float, float addrspace(1)* %x
  Then, eventually:
    getelementptr float, ptr addrspace(1) %x

Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.

update.py:
import fileinput
import sys
import re

ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile(       r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")

def conv(match, line):
  if not match:
    return line
  line = match.groups()[0]
  if len(match.groups()[5]) == 0:
    line += match.groups()[2]
  line += match.groups()[3]
  line += ", "
  line += match.groups()[1]
  line += "\n"
  return line

for line in sys.stdin:
  if line.find("getelementptr ") == line.find("getelementptr inbounds"):
    if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
      line = conv(re.match(ibrep, line), line)
  elif line.find("getelementptr ") != line.find("getelementptr ("):
    line = conv(re.match(normrep, line), line)
  sys.stdout.write(line)

apply.sh:
for name in "$@"
do
  python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
  rm -f "$name.tmp"
done

The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh

After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).

The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7636

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dwblaikie committed Feb 27, 2015
1 parent 56f3b7f commit 198d8ba
Show file tree
Hide file tree
Showing 2,277 changed files with 41,849 additions and 41,819 deletions.
14 changes: 13 additions & 1 deletion lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5440,7 +5440,19 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {

bool InBounds = EatIfPresent(lltok::kw_inbounds);

if (ParseTypeAndValue(Ptr, Loc, PFS)) return true;
Type *Ty = nullptr;
LocTy ExplicitTypeLoc = Lex.getLoc();
if (ParseType(Ty) ||
ParseToken(lltok::comma, "expected comma after getelementptr's type") ||
ParseTypeAndValue(Ptr, Loc, PFS))
return true;

Type *PtrTy = Ptr->getType();
if (VectorType *VT = dyn_cast<VectorType>(PtrTy))
PtrTy = VT->getElementType();
if (Ty != cast<SequentialType>(PtrTy)->getElementType())
return Error(ExplicitTypeLoc,
"explicit pointee type doesn't match operand's pointee type");

Type *BaseType = Ptr->getType();
PointerType *BasePointerType = dyn_cast<PointerType>(BaseType->getScalarType());
Expand Down
5 changes: 5 additions & 0 deletions lib/IR/AsmWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,11 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
Out << ", ";
TypePrinter.print(I.getType(), Out);
} else if (Operand) { // Print the normal way.
if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(&I)) {
Out << ' ';
TypePrinter.print(GEP->getSourceElementType(), Out);
Out << ',';
}

// PrintAllTypes - Instructions who have operands of all the same type
// omit the type from all but the first operand. If the instruction has
Expand Down
2 changes: 1 addition & 1 deletion test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define i32 @test() {
store i32 0, i32* %A
%X = load i32* %A
%B = bitcast i32* %A to i8*
%C = getelementptr i8* %B, i64 1
%C = getelementptr i8, i8* %B, i64 1
store i8 1, i8* %C ; Aliases %A
%Y.DONOTREMOVE = load i32* %A
%Z = sub i32 %X, %Y.DONOTREMOVE
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2003-03-04-GEPCrash.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt < %s -basicaa -aa-eval -disable-output 2>/dev/null
; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
define void @test({[2 x i32],[2 x i32]}* %A, i64 %X, i64 %Y) {
%P1 = getelementptr {[2 x i32],[2 x i32]}* %A, i64 0, i32 0, i64 %X
%P2 = getelementptr {[2 x i32],[2 x i32]}* %A, i64 0, i32 1, i64 %Y
%P1 = getelementptr {[2 x i32],[2 x i32]}, {[2 x i32],[2 x i32]}* %A, i64 0, i32 0, i64 %X
%P2 = getelementptr {[2 x i32],[2 x i32]}, {[2 x i32],[2 x i32]}* %A, i64 0, i32 1, i64 %Y
ret void
}
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2003-04-22-GEPProblem.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

define i32 @test(i32 *%Ptr, i64 %V) {
; CHECK: sub i32 %X, %Y
%P2 = getelementptr i32* %Ptr, i64 1
%P1 = getelementptr i32* %Ptr, i64 %V
%P2 = getelementptr i32, i32* %Ptr, i64 1
%P1 = getelementptr i32, i32* %Ptr, i64 %V
%X = load i32* %P1
store i32 5, i32* %P2
%Y = load i32* %P1
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2003-04-25-GEPCrash.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt < %s -basicaa -aa-eval -disable-output 2>/dev/null
; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
define void @test([17 x i16]* %mask_bits) {
%P1 = getelementptr [17 x i16]* %mask_bits, i64 0, i64 0
%P2 = getelementptr [17 x i16]* %mask_bits, i64 252645134, i64 0
%P1 = getelementptr [17 x i16], [17 x i16]* %mask_bits, i64 0, i64 0
%P2 = getelementptr [17 x i16], [17 x i16]* %mask_bits, i64 252645134, i64 0
ret void
}
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ define void @table_reindex(%struct..apr_table_t* %t.1) { ; No predecessors!
br label %loopentry

loopentry: ; preds = %0, %no_exit
%tmp.101 = getelementptr %struct..apr_table_t* %t.1, i64 0, i32 0, i32 2
%tmp.101 = getelementptr %struct..apr_table_t, %struct..apr_table_t* %t.1, i64 0, i32 0, i32 2
%tmp.11 = load i32* %tmp.101 ; <i32> [#uses=0]
br i1 false, label %no_exit, label %UnifiedExitNode

no_exit: ; preds = %loopentry
%tmp.25 = sext i32 0 to i64 ; <i64> [#uses=1]
%tmp.261 = getelementptr %struct..apr_table_t* %t.1, i64 0, i32 3, i64 %tmp.25 ; <i32*> [#uses=1]
%tmp.261 = getelementptr %struct..apr_table_t, %struct..apr_table_t* %t.1, i64 0, i32 3, i64 %tmp.25 ; <i32*> [#uses=1]
store i32 0, i32* %tmp.261
br label %loopentry

Expand Down
6 changes: 3 additions & 3 deletions test/Analysis/BasicAA/2003-06-01-AliasCrash.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
; RUN: opt < %s -basicaa -aa-eval -disable-output 2>/dev/null

define i32 @MTConcat([3 x i32]* %a.1) {
%tmp.961 = getelementptr [3 x i32]* %a.1, i64 0, i64 4
%tmp.961 = getelementptr [3 x i32], [3 x i32]* %a.1, i64 0, i64 4
%tmp.97 = load i32* %tmp.961
%tmp.119 = getelementptr [3 x i32]* %a.1, i64 1, i64 0
%tmp.119 = getelementptr [3 x i32], [3 x i32]* %a.1, i64 1, i64 0
%tmp.120 = load i32* %tmp.119
%tmp.1541 = getelementptr [3 x i32]* %a.1, i64 0, i64 4
%tmp.1541 = getelementptr [3 x i32], [3 x i32]* %a.1, i64 0, i64 4
%tmp.155 = load i32* %tmp.1541
ret i32 0
}
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2003-07-03-BasicAACrash.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%struct..RefRect = type { %struct..RefPoint, %struct..RefPoint }

define i32 @BMT_CommitPartDrawObj() {
%tmp.19111 = getelementptr %struct..RefRect* null, i64 0, i32 0, i32 1, i32 2
%tmp.20311 = getelementptr %struct..RefRect* null, i64 0, i32 1, i32 1, i32 2
%tmp.19111 = getelementptr %struct..RefRect, %struct..RefRect* null, i64 0, i32 0, i32 1, i32 2
%tmp.20311 = getelementptr %struct..RefRect, %struct..RefRect* null, i64 0, i32 1, i32 1, i32 2
ret i32 0
}
10 changes: 5 additions & 5 deletions test/Analysis/BasicAA/2003-11-04-SimpleCases.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; CHECK-NOT: MayAlias:

define void @test(%T* %P) {
%A = getelementptr %T* %P, i64 0
%B = getelementptr %T* %P, i64 0, i32 0
%C = getelementptr %T* %P, i64 0, i32 1
%D = getelementptr %T* %P, i64 0, i32 1, i64 0
%E = getelementptr %T* %P, i64 0, i32 1, i64 5
%A = getelementptr %T, %T* %P, i64 0
%B = getelementptr %T, %T* %P, i64 0, i32 0
%C = getelementptr %T, %T* %P, i64 0, i32 1
%D = getelementptr %T, %T* %P, i64 0, i32 1, i64 0
%E = getelementptr %T, %T* %P, i64 0, i32 1, i64 5
ret void
}
8 changes: 4 additions & 4 deletions test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; CHECK-NOT: MayAlias:

define void @test() {
%D = getelementptr %T* @G, i64 0, i32 0
%E = getelementptr %T* @G, i64 0, i32 1, i64 5
%F = getelementptr i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
%X = getelementptr [10 x i8]* getelementptr (%T* @G, i64 0, i32 1), i64 0, i64 5
%D = getelementptr %T, %T* @G, i64 0, i32 0
%E = getelementptr %T, %T* @G, i64 0, i32 1, i64 5
%F = getelementptr i32, i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
%X = getelementptr [10 x i8], [10 x i8]* getelementptr (%T* @G, i64 0, i32 1), i64 0, i64 5

ret void
}
6 changes: 3 additions & 3 deletions test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

define void @test({i32,i32 }* %P) {
; CHECK: store i32 0, i32* %X
%Q = getelementptr {i32,i32}* %P, i32 1
%X = getelementptr {i32,i32}* %Q, i32 0, i32 1
%Y = getelementptr {i32,i32}* %Q, i32 1, i32 1
%Q = getelementptr {i32,i32}, {i32,i32}* %P, i32 1
%X = getelementptr {i32,i32}, {i32,i32}* %Q, i32 0, i32 1
%Y = getelementptr {i32,i32}, {i32,i32}* %Q, i32 1, i32 1
store i32 0, i32* %X
store i32 1, i32* %Y
ret void
Expand Down
8 changes: 4 additions & 4 deletions test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ entry:

no_exit: ; preds = %no_exit, %entry
%i.0.0 = phi i32 [ 0, %entry ], [ %inc, %no_exit ] ; <i32> [#uses=2]
%tmp.6 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
%tmp.6 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
store i32 1, i32* %tmp.6
%tmp.8 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp.8 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp.9 = load i32* %tmp.8 ; <i32> [#uses=1]
%tmp.11 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
%tmp.11 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
%tmp.12 = load i32* %tmp.11 ; <i32> [#uses=1]
%tmp.13 = add i32 %tmp.12, %tmp.9 ; <i32> [#uses=1]
%inc = add i32 %i.0.0, 1 ; <i32> [#uses=2]
Expand All @@ -25,7 +25,7 @@ no_exit: ; preds = %no_exit, %entry

loopexit: ; preds = %no_exit, %entry
%Y.0.1 = phi i32 [ 0, %entry ], [ %tmp.13, %no_exit ] ; <i32> [#uses=1]
%tmp.4 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0 ; <[3 x i32]*> [#uses=1]
%tmp.4 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0 ; <[3 x i32]*> [#uses=1]
%tmp.15 = call i32 (...)* @foo( [3 x i32]* %tmp.4, i32 %Y.0.1 ) ; <i32> [#uses=0]
ret void
}
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cond_true264.i: ; preds = %bb239.i
ret void

cond_false277.i: ; preds = %bb239.i
%tmp1062.i = getelementptr [2 x <4 x i32>]* null, i32 0, i32 1 ; <<4 x i32>*> [#uses=1]
%tmp1062.i = getelementptr [2 x <4 x i32>], [2 x <4 x i32>]* null, i32 0, i32 1 ; <<4 x i32>*> [#uses=1]
store <4 x i32> zeroinitializer, <4 x i32>* %tmp1062.i
br i1 false, label %cond_true1032.i, label %cond_false1063.i85

Expand All @@ -33,7 +33,7 @@ bb1013.i: ; preds = %bb205.i
ret void

cond_true1032.i: ; preds = %cond_false277.i
%tmp1187.i = getelementptr [2 x <4 x i32>]* null, i32 0, i32 0, i32 7 ; <i32*> [#uses=1]
%tmp1187.i = getelementptr [2 x <4 x i32>], [2 x <4 x i32>]* null, i32 0, i32 0, i32 7 ; <i32*> [#uses=1]
store i32 0, i32* %tmp1187.i
br label %bb2037.i

Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ target triple = "i686-apple-darwin8"
; CHECK: ret i32 %Z

define i32 @test(%struct.closure_type* %tmp18169) {
%tmp18174 = getelementptr %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <i32*> [#uses=2]
%tmp18174 = getelementptr %struct.closure_type, %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <i32*> [#uses=2]
%tmp18269 = bitcast i32* %tmp18174 to %struct.STYLE* ; <%struct.STYLE*> [#uses=1]
%A = load i32* %tmp18174 ; <i32> [#uses=1]

%tmp18272 = getelementptr %struct.STYLE* %tmp18269, i32 0, i32 0, i32 0, i32 2 ; <i16*> [#uses=1]
%tmp18272 = getelementptr %struct.STYLE, %struct.STYLE* %tmp18269, i32 0, i32 0, i32 0, i32 2 ; <i16*> [#uses=1]
store i16 123, i16* %tmp18272

%Q = load i32* %tmp18174 ; <i32> [#uses=1]
Expand Down
8 changes: 4 additions & 4 deletions test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; CHECK: 6 partial alias responses

define void @foo(i32* noalias %p, i32* noalias %q, i32 %i, i32 %j) {
%Ipointer = getelementptr i32* %p, i32 %i
%qi = getelementptr i32* %q, i32 %i
%Jpointer = getelementptr i32* %p, i32 %j
%qj = getelementptr i32* %q, i32 %j
%Ipointer = getelementptr i32, i32* %p, i32 %i
%qi = getelementptr i32, i32* %q, i32 %i
%Jpointer = getelementptr i32, i32* %p, i32 %j
%qj = getelementptr i32, i32* %q, i32 %j
store i32 0, i32* %p
store i32 0, i32* %Ipointer
store i32 0, i32* %Jpointer
Expand Down
2 changes: 1 addition & 1 deletion test/Analysis/BasicAA/2007-10-24-ArgumentsGlobals.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define i32 @_Z3fooP1A(%struct.A* %b) {
; CHECK: ret i32 %tmp7
entry:
store i32 1, i32* getelementptr (%struct.B* @a, i32 0, i32 0, i32 0), align 8
%tmp4 = getelementptr %struct.A* %b, i32 0, i32 0 ;<i32*> [#uses=1]
%tmp4 = getelementptr %struct.A, %struct.A* %b, i32 0, i32 0 ;<i32*> [#uses=1]
store i32 0, i32* %tmp4, align 4
%tmp7 = load i32* getelementptr (%struct.B* @a, i32 0, i32 0, i32 0), align 8 ; <i32> [#uses=1]
ret i32 %tmp7
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2007-11-05-SizeCrash.ll
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ target triple = "x86_64-unknown-linux-gnu"

define i32 @uhci_suspend(%struct.usb_hcd* %hcd) {
entry:
%tmp17 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 2, i64 1
%tmp17 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 2, i64 1
; <i64*> [#uses=1]
%tmp1718 = bitcast i64* %tmp17 to i32* ; <i32*> [#uses=1]
%tmp19 = load i32* %tmp1718, align 4 ; <i32> [#uses=0]
br i1 false, label %cond_true34, label %done_okay

cond_true34: ; preds = %entry
%tmp631 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 2, i64
%tmp631 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 2, i64
2305843009213693950 ; <i64*> [#uses=1]
%tmp70 = bitcast i64* %tmp631 to %struct.device**

Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ target triple = "x86_64-unknown-linux-gnu"

define i32 @ehci_pci_setup(%struct.usb_hcd* %hcd) {
entry:
%tmp14 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 0, i32 0 ; <%struct.device**> [#uses=1]
%tmp14 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 0, i32 0 ; <%struct.device**> [#uses=1]
%tmp15 = load %struct.device** %tmp14, align 8 ; <%struct.device*> [#uses=0]
br i1 false, label %bb25, label %return

bb25: ; preds = %entry
br i1 false, label %cond_true, label %return

cond_true: ; preds = %bb25
%tmp601 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 1, i64 2305843009213693951 ; <i64*> [#uses=1]
%tmp601 = getelementptr %struct.usb_hcd, %struct.usb_hcd* %hcd, i32 0, i32 1, i64 2305843009213693951 ; <i64*> [#uses=1]
%tmp67 = bitcast i64* %tmp601 to %struct.device** ; <%struct.device**> [#uses=1]
%tmp68 = load %struct.device** %tmp67, align 8 ; <%struct.device*> [#uses=0]
ret i32 undef
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2008-04-15-Byval.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ target triple = "i386-apple-darwin8"
define void @foo(%struct.x* byval align 4 %X) nounwind {
; CHECK: store i32 2, i32* %tmp1
entry:
%tmp = getelementptr %struct.x* %X, i32 0, i32 0 ; <[4 x i32]*> [#uses=1]
%tmp1 = getelementptr [4 x i32]* %tmp, i32 0, i32 3 ; <i32*> [#uses=1]
%tmp = getelementptr %struct.x, %struct.x* %X, i32 0, i32 0 ; <[4 x i32]*> [#uses=1]
%tmp1 = getelementptr [4 x i32], [4 x i32]* %tmp, i32 0, i32 3 ; <i32*> [#uses=1]
store i32 2, i32* %tmp1, align 4
%tmp2 = call i32 (...)* @bar( %struct.x* byval align 4 %X ) nounwind ; <i32> [#uses=0]
br label %return
Expand Down
2 changes: 1 addition & 1 deletion test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define i32 @test(i32 %x) {
; CHECK: load i32* %a
%a = call i32* @noalias()
store i32 1, i32* %a
%b = getelementptr i32* %a, i32 %x
%b = getelementptr i32, i32* %a, i32 %x
store i32 2, i32* %b

%c = load i32* %a
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"

define i8 @foo(i8* %ptr) {
%P = getelementptr i8* %ptr, i32 0
%Q = getelementptr i8* %ptr, i32 1
%P = getelementptr i8, i8* %ptr, i32 0
%Q = getelementptr i8, i8* %ptr, i32 1
; CHECK: getelementptr
%X = load i8* %P
%Y = atomicrmw add i8* %Q, i8 1 monotonic
Expand Down
2 changes: 1 addition & 1 deletion test/Analysis/BasicAA/2009-10-13-GEP-BaseNoAlias.ll
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ entry:
br i1 %tmp, label %bb, label %bb1

bb:
%b = getelementptr i32* %a, i32 0
%b = getelementptr i32, i32* %a, i32 0
br label %bb2

bb1:
Expand Down
2 changes: 1 addition & 1 deletion test/Analysis/BasicAA/2010-09-15-GEP-SignedArithmetic.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target datalayout = "e-p:32:32:32"
define i32 @test(i32* %tab, i32 %indvar) nounwind {
%tmp31 = mul i32 %indvar, -2
%tmp32 = add i32 %tmp31, 30
%t.5 = getelementptr i32* %tab, i32 %tmp32
%t.5 = getelementptr i32, i32* %tab, i32 %tmp32
%loada = load i32* %tab
store i32 0, i32* %t.5
%loadb = load i32* %tab
Expand Down
20 changes: 10 additions & 10 deletions test/Analysis/BasicAA/2014-03-18-Maxlookup-reached.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ target datalayout = "e"

define i32 @main() {
%t = alloca %struct.foo, align 4
%1 = getelementptr inbounds %struct.foo* %t, i32 0, i32 0
%1 = getelementptr inbounds %struct.foo, %struct.foo* %t, i32 0, i32 0
store i32 1, i32* %1, align 4
%2 = getelementptr inbounds %struct.foo* %t, i64 1
%2 = getelementptr inbounds %struct.foo, %struct.foo* %t, i64 1
%3 = bitcast %struct.foo* %2 to i8*
%4 = getelementptr inbounds i8* %3, i32 -1
%4 = getelementptr inbounds i8, i8* %3, i32 -1
store i8 0, i8* %4
%5 = getelementptr inbounds i8* %4, i32 -1
%5 = getelementptr inbounds i8, i8* %4, i32 -1
store i8 0, i8* %5
%6 = getelementptr inbounds i8* %5, i32 -1
%6 = getelementptr inbounds i8, i8* %5, i32 -1
store i8 0, i8* %6
%7 = getelementptr inbounds i8* %6, i32 -1
%7 = getelementptr inbounds i8, i8* %6, i32 -1
store i8 0, i8* %7
%8 = getelementptr inbounds i8* %7, i32 -1
%8 = getelementptr inbounds i8, i8* %7, i32 -1
store i8 0, i8* %8
%9 = getelementptr inbounds i8* %8, i32 -1
%9 = getelementptr inbounds i8, i8* %8, i32 -1
store i8 0, i8* %9
%10 = getelementptr inbounds i8* %9, i32 -1
%10 = getelementptr inbounds i8, i8* %9, i32 -1
store i8 0, i8* %10
%11 = getelementptr inbounds i8* %10, i32 -1
%11 = getelementptr inbounds i8, i8* %10, i32 -1
store i8 0, i8* %11
%12 = load i32* %1, align 4
ret i32 %12
Expand Down
2 changes: 1 addition & 1 deletion test/Analysis/BasicAA/byval.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target triple = "i686-apple-darwin8"
define i32 @foo(%struct.x* byval %a) nounwind {
; CHECK: ret i32 1
%tmp1 = tail call i32 (...)* @bar( %struct.x* %a ) nounwind ; <i32> [#uses=0]
%tmp2 = getelementptr %struct.x* %a, i32 0, i32 0 ; <i32*> [#uses=2]
%tmp2 = getelementptr %struct.x, %struct.x* %a, i32 0, i32 0 ; <i32*> [#uses=2]
store i32 1, i32* %tmp2, align 4
store i32 2, i32* @g, align 4
%tmp4 = load i32* %tmp2, align 4 ; <i32> [#uses=1]
Expand Down
4 changes: 2 additions & 2 deletions test/Analysis/BasicAA/constant-over-index.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

define void @foo([3 x [3 x double]]* noalias %p) {
entry:
%p3 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
%p3 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
br label %loop

loop:
%i = phi i64 [ 0, %entry ], [ %i.next, %loop ]

%p.0.i.0 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0
%p.0.i.0 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0

store volatile double 0.0, double* %p3
store volatile double 0.1, double* %p.0.i.0
Expand Down
Loading

0 comments on commit 198d8ba

Please sign in to comment.