Skip to content

Commit

Permalink
[InstCombine] Thwart complexity-based canonicalization in shl-add tes…
Browse files Browse the repository at this point in the history
…t (NFC) (#91413)

Fixed test for #88193
  • Loading branch information
AZero13 authored May 9, 2024
1 parent 409ff97 commit ba5170f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions llvm/test/Transforms/InstCombine/lshr.ll
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,14 @@ define i32 @shl_add_lshr(i32 %x, i32 %c, i32 %y) {

define i32 @shl_add_lshr_comm(i32 %x, i32 %c, i32 %y) {
; CHECK-LABEL: @shl_add_lshr_comm(
; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[Y:%.*]], [[C:%.*]]
; CHECK-NEXT: [[Y2:%.*]] = mul i32 [[Y:%.*]], [[Y]]
; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[Y2]], [[C:%.*]]
; CHECK-NEXT: [[LSHR:%.*]] = add nuw i32 [[TMP1]], [[X:%.*]]
; CHECK-NEXT: ret i32 [[LSHR]]
;
%shl = shl nuw i32 %x, %c
%add = add nuw i32 %y, %shl
%y2 = mul i32 %y, %y ; thwart complexity-based canonicalization
%add = add nuw i32 %y2, %shl
%lshr = lshr i32 %add, %c
ret i32 %lshr
}
Expand Down

0 comments on commit ba5170f

Please sign in to comment.