LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 27756 - Instcombine failure introduced by r269426
Summary: Instcombine failure introduced by r269426
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Scalar Optimizations (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-16 09:42 PDT by James Molloy
Modified: 2016-05-17 17:45 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Molloy 2016-05-16 09:42:11 PDT
The following testcase causes an assertion failure when run with opt -instcombine. This is a regression introduced in r269426:

[InstCombine] canonicalize* LE/GE vector integer comparisons to LT/GT (PR26701, PR26819)

*We don't currently handle the edge case constants (min/max values), so it's not a complete
canonicalization.

To fully solve the motivating bugs, we need to enhance this to recognize a zero vector
too because that's a ConstantAggregateZero which is a ConstantData, not a ConstantVector
or a ConstantDataVector.

Differential Revision: http://reviews.llvm.org/D17859


; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "bugpoint-output-f90b06d.bc"
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"

; Function Attrs: nounwind readnone
declare <16 x i8> @llvm.aarch64.neon.srshl.v16i8(<16 x i8>, <16 x i8>) #0

; Function Attrs: nounwind
define fastcc void @dotests_268() unnamed_addr #1 {
entry:
  %vrshr_n = call <16 x i8> @llvm.aarch64.neon.srshl.v16i8(<16 x i8> undef, <16 x i8> <i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6, i8 -6>)
  %0 = add <16 x i8> zeroinitializer, %vrshr_n
  %vset_lane = shufflevector <8 x i16> <i16 -20871, i16 -1, i16 32767, i16 -1, i16 32639, i16 -22537, i16 -1, i16 -4866>, <8 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 13, i32 7>
  %1 = bitcast <8 x i16> %vset_lane to <16 x i8>
  %shuffle336 = shufflevector <16 x i8> %1, <16 x i8> undef, <16 x i32> <i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15>
  %cmp.i = icmp sle <16 x i8> %0, %shuffle336
  %sext.i = sext <16 x i1> %cmp.i to <16 x i8>
  %and.i = and <16 x i8> %sext.i, <i8 113, i8 45, i8 0, i8 -128, i8 -1, i8 -1, i8 -1, i8 127, i8 55, i8 92, i8 -1, i8 -1, i8 -1, i8 -1, i8 0, i8 0>
  ret void
}

attributes #0 = { nounwind readnone }
attributes #1 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a57" "target-features"="+crc,+crypto,+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.ident = !{!0}

!0 = !{!"clang version 3.9.0 (trunk 269502) (llvm/trunk 269506)"}
Comment 1 Sanjay Patel 2016-05-16 12:04:35 PDT
Patch posted for review:
http://reviews.llvm.org/D20289
Comment 2 Sanjay Patel 2016-05-17 17:45:33 PDT
Should be fixed with:
http://reviews.llvm.org/rL269728

But that commit broke the law of patch minimalism by trying to fix a bug and attempt a refactoring in one shot, so caused numerous bot fails and bug 27792...I won't make that mistake again. :(
 
These commits have hopefully righted the remaining wrongs:
http://reviews.llvm.org/rL269797
http://reviews.llvm.org/rL269831