[PATCH] D39695: [IPO/LowerTypesTest] Skip blockaddress when replacing uses

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 15:06:58 PST 2017


pcc added inline comments.


================
Comment at: lib/IR/Value.cpp:464
+    auto *Usr = dyn_cast<User>(U.getUser());
+    if (Usr && isa<BlockAddress>(Usr))
+      continue;
----------------
Can this line just be
`if (isa<BlockAddress>(U.getUser()))`
?


================
Comment at: test/Transforms/LowerTypeTests/blockaddress.ll:16
+; CHECK: p:
+; CHECK-NEXT:   call void @fq(i8* blockaddress(@fo.cfi, %p))
+; CHECK-NEXT:   ret void
----------------
I think this test case is more complicated than it needs to be. This seems to be enough to trigger the bug:
```
target triple = "x86_64-unknown-linux"

define void @f1() {
entry:
  %0 = call i1 @llvm.type.test(i8* bitcast (i8* ()* @f2 to i8*), metadata !"_ZTSFvP3bioE")
  ret void
}

declare i1 @llvm.type.test(i8*, metadata)

define i8* @f2() !type !5 {
  br label %b

b:
  ret i8* blockaddress(@f2, %b)
}

!5 = !{i64 0, !"_ZTSFvP3bioE"}
```
The only important part of the output is the body of `f2`, so I would only have `CHECK` lines for that.


https://reviews.llvm.org/D39695





More information about the llvm-commits mailing list