[NFC] Use opaqueptr in llvm/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll

Use opaqueptr for test case
llvm/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll.

- Adjust variable number accordingly since bitcast between different pointer
  types are not necessary.

Differential Revision: https://reviews.llvm.org/D134159
This commit is contained in:
Mingming Liu 2022-09-18 22:59:24 -07:00
parent a3aab98ef4
commit 34db7c64df
1 changed files with 16 additions and 18 deletions

View File

@ -5,36 +5,35 @@ define void @test1(i32 %n) #0 {
entry:
%n.addr = alloca i32, align 4
%count = alloca i32, align 4
store i32 %n, i32* %n.addr, align 4
%0 = bitcast i32* %count to i8*
store i32 0, i32* %count, align 4
store i32 %n, ptr %n.addr, align 4
store i32 0, ptr %count, align 4
br label %while.cond
while.cond: ; preds = %if.end, %entry
%1 = load i32, i32* %count, align 4
%2 = load i32, i32* %n.addr, align 4
%cmp = icmp ule i32 %1, %2
%0 = load i32, ptr %count, align 4
%1 = load i32, ptr %n.addr, align 4
%cmp = icmp ule i32 %0, %1
br i1 %cmp, label %while.body, label %while.end
while.body: ; preds = %while.cond
%3 = load i32, i32* %count, align 4
%rem = urem i32 %3, 2
%2 = load i32, ptr %count, align 4
%rem = urem i32 %2, 2
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%4 = load i32, i32* %count, align 4
%add = add i32 %4, 1
store i32 %add, i32* %count, align 4
%3 = load i32, ptr %count, align 4
%add = add i32 %3, 1
store i32 %add, ptr %count, align 4
br label %if.end
; CHECK: if.then:
; CHECK: br label %while.cond, !llvm.loop !0
if.else: ; preds = %while.body
%5 = load i32, i32* %count, align 4
%add2 = add i32 %5, 2
store i32 %add2, i32* %count, align 4
%4 = load i32, ptr %count, align 4
%add2 = add i32 %4, 2
store i32 %add2, ptr %count, align 4
br label %if.end
; CHECK: if.else:
@ -44,7 +43,6 @@ if.end: ; preds = %if.else, %if.then
br label %while.cond, !llvm.loop !0
while.end: ; preds = %while.cond
%6 = bitcast i32* %count to i8*
ret void
}
@ -71,7 +69,7 @@ while.end: ; preds = %while.cond
; }
; return sum;
; }
define i32 @test2(i32 %a, i32 %b, i32 %step, i32 %remainder, i32* %input) {
define i32 @test2(i32 %a, i32 %b, i32 %step, i32 %remainder, ptr %input) {
entry:
br label %while.cond
@ -93,8 +91,8 @@ for.body: ; preds = %while.body, %for.bo
%k.07 = phi i32 [ 0, %while.body ], [ %inc, %for.body ]
%add2 = add nsw i32 %k.07, %add
%idxprom = sext i32 %add2 to i64
%arrayidx = getelementptr inbounds i32, i32* %input, i64 %idxprom
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %input, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4
%1 = tail call i32 asm sideeffect "add ${0:w}, ${1:w}\0A", "=r,r,~{cc}"(i32 %0)
%inc = add nuw nsw i32 %k.07, 1
%cmp1 = icmp ult i32 %inc, 5