Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicBlock::removePredecessor generates self-referencing instructions #27439

Open
tobiasgrosser opened this issue Mar 25, 2016 · 3 comments
Open
Assignees
Labels
bugzilla Issues migrated from bugzilla llvm Umbrella label for LLVM issues

Comments

@tobiasgrosser
Copy link
Contributor

Bugzilla Link 27065
Version trunk
OS Linux
Attachments Infinitely running test case, A first reduced test case, Second reduced test case (other code path)
CC @dendibakh,@hfinkel,@jdoerfert

Extended Description

BasicBlock::removePredecessor will eliminate PHI nodes entirely if they always evaluate to a single constant value and instead replace all uses of the PHINode with this constant.

This is only correct if we know that the actual constant actually dominates the PHI node, which is not verified in this code. As a result, we may generate self referencing instructions which is not only incorrect but also causes an infinite loop in -load-combine, which does not expect such IR.

This command does not terminate for me, as jump-treading uses removePredecessor
and introduces the incorrect IR that load-combine can not handle:

opt /tmp/infinite.ll -jump-threading -load-combine

@tobiasgrosser
Copy link
Contributor Author

assigned to @dendibakh

@dendibakh
Copy link
Collaborator

@jdoerfert
Copy link
Member

This is not a bug in removePredecessor but in -load-combine for looking at unreachable code.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@Endilll Endilll added the llvm Umbrella label for LLVM issues label Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm Umbrella label for LLVM issues
Projects
None yet
Development

No branches or pull requests

4 participants