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
[PowerPC] Infinite loop in PeepholeCROps #48853
Comments
DAG: Optimized legalized selection DAG: %bb.4 'test:bb66' Start of the peephole combine loop: ===== Instruction selection ends: New: t50: i32 = SELECT_I4 t49, t34, t34 CR Peephole replacing: New: t64: i1 = CRNOR t29, t20 CR Peephole replacing: New: t50: i32 = SELECT_I4 t64, t34, t34 CR Peephole replacing: New: t49: i1 = CROR t29, t20 Creating new machine node: t65: i1 = CRNOR t29, t20 New: t50: i32 = SELECT_I4 t49, t34, t34 CR Peephole replacing: New: t65: i1 = CRNOR t29, t20 CR Peephole replacing: New: t50: i32 = SELECT_I4 t65, t34, t34 CR Peephole replacing: New: t49: i1 = CROR t29, t20 |
Here's the DAG when entering PeepholeCROps: SelectionDAG has 38 nodes: With the problematic part being: t34: i32 = LI TargetConstant:i32<0> The transform converts select x, y, y into select !x, y, y swapping the select operands, but of course that doesn't actually do anything if they're equal. And then we can convert that back to select x, y, y etc. |
Candidate patch: https://reviews.llvm.org/D98340 |
Fixed by 2489cba on main. |
Merged: 8ca5690 |
Extended Description
; RUN: llc -O2 < %s
target datalayout = "E-m:e-p:32:32-i64:64-n32"
target triple = "powerpc-unknown-linux-gnu"
define void @test() {
bb:
br i1 undef, label %bb2, label %bb1
bb2: ; preds = %bb
%i = select i1 undef, i64 0, i64 72057594037927936
store i64 %i, i64* undef, align 8
ret void
bb1: ; preds = %bb
%i50 = load i8, i8* undef, align 8
%i52 = load i128, i128* null, align 8
%i62 = icmp eq i8 %i50, 0
br i1 undef, label %bb66, label %bb64
bb64: ; preds = %bb63
ret void
bb66: ; preds = %bb63
%i67 = lshr i128 -1, 0
%i68 = xor i128 %i52, -1
%i69 = add i128 0, %i68
%i70 = and i128 %i67, %i69
%i71 = icmp eq i128 %i70, 0
%i74 = select i1 %i62, i64 0, i64 72057594037927936
%i75 = select i1 %i71, i64 144115188075855872, i64 %i74
store i64 %i75, i64* undef, align 8
ret void
}
This enters an infinite combine loop inside PPCDAGToDAGISel::PeepholeCROps().
The text was updated successfully, but these errors were encountered: