[PATCH] D115410: [llvm][test] rewrite callbr to use i rather than X constraint NFC

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 13 15:13:22 PST 2021


jyknight added inline comments.


================
Comment at: llvm/test/Verifier/callbr.ll:42
+  callbr void asm sideeffect "${0:l} ${1:l} ${2:l}", "i,X,i"(i8* blockaddress(@test3, %4), i8* blockaddress(@test3, %2), i8* blockaddress(@test3, %3))
   to label %1 [label %3, label %4]
 1:
----------------
pengfei wrote:
> Does it mean we are able to pass blockaddress out of current function? For that case, we can't put it in the indirect labels list, right?
In general, you may pass whatever blockaddress you like to an asm -- it's just a value. You just cannot jump to a location that's not it's listed in the indirect labels list.


================
Comment at: llvm/test/tools/llvm-diff/callbr.ll:28-29
 entry:
-  callbr void asm sideeffect "", "X,X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %t_no), i8* blockaddress(@foo, %return))
+  callbr void asm sideeffect "", "i,i,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %t_no), i8* blockaddress(@foo, %return))
           to label %asm.fallthrough [label %return, label %t_no]
 
----------------
pengfei wrote:
> If my above assumption is true, I think we can't replace the `X` with `i` here.
> Besides, I'm confused on the indirect labels list. Are they the labels of `bar` or `foo`?
I don't see a a problem with using "i" everywhere -- all blockaddress are going to be immediate values no matter whether they're an indirect target or not.

The indirect labels list is only referring to labels in the current function.

This test is confusing, but, it is a test for llvm-diff, so that's okay or maybe even intended. (It can't actually possibly jump to @bar:%return or @bar:%t_no, because nothing ever gets the address of those labels. It does get the similarly-named labels in @foo, but it can't jump to those either, since they're in a different function.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115410/new/

https://reviews.llvm.org/D115410



More information about the cfe-commits mailing list