This code was already creating HandleSDNodes to handle the case where a node gets replaced with an equivalent node. However, the code before the handles are created also performs RAUW operations, which can end up CSEing and deleting nodes. Fix this issue by moving the handle creation earlier. Fixes https://github.com/llvm/llvm-project/issues/160040.
25 lines
802 B
LLVM
25 lines
802 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
|
|
|
|
; Make sure this does not crash.
|
|
define i32 @test(i32 %arg) {
|
|
; CHECK-LABEL: test:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: rlwinm 4, 3, 13, 19, 19
|
|
; CHECK-NEXT: rlwinm 3, 3, 2, 30, 30
|
|
; CHECK-NEXT: xori 4, 4, 4096
|
|
; CHECK-NEXT: xori 3, 3, 2
|
|
; CHECK-NEXT: rlwimi 3, 4, 0, 31, 29
|
|
; CHECK-NEXT: blr
|
|
%icmp = icmp sgt i32 %arg, -1
|
|
%select = select i1 %icmp, i16 1, i16 0
|
|
%select1 = select i1 %icmp, i16 16384, i16 0
|
|
%lshr = lshr i16 %select1, 1
|
|
%zext = zext i16 %lshr to i32
|
|
%lshr2 = lshr i32 %zext, 1
|
|
%shl = shl i16 %select, 1
|
|
%zext3 = zext i16 %shl to i32
|
|
%or = or i32 %lshr2, %zext3
|
|
ret i32 %or
|
|
}
|