Skip to content

[SimplifyCFG] produces incorrect callbr's #42567

@nickdesaulniers

Description

@nickdesaulniers
Bugzilla Link 43222
Resolution FIXED
Resolved on Sep 09, 2019 02:01
Version trunk
OS Linux
Blocks #4440 #41819
Attachments z.ll, z2.ll
CC @topperc,@zmodem,@nathanchance,@stephenhines

Extended Description

With the attached test case, and new verifier check from (https://reviews.llvm.org/D67196) I observe a failure in SimplifyCFG:

$ opt --simplifycfg z.ll -o /dev/null
Indirect label missing from arglist.
callbr void asm sideeffect "// XXX: ${0:l}", "X"(i8* blockaddress(@andy_test, %if.then))
to label %land.rhs.i [label %if.end]
in function andy_test
LLVM ERROR: Broken function found, compilation aborted!

the indirect label list [label %if.end].

Attaching z2.ll, which is the post-simplyifycfg-ed version that violates the invariant.

Looks like a simple phi is being replaced:

branch_test.exit: ; preds = %entry, %land.rhs.i
%0 = phi i1 [ true, %entry ], [ false, %land.rhs.i ]
br i1 %0, label %if.end, label %if.then

where the blockaddress of %if.then is being updated correctly, but the indirect label list is not.

Metadata

Metadata

Labels

bugzillaIssues migrated from bugzilla

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions