[llvm-bugs] [Bug 44419] New: LLVM 10 regression in comparison of gep inbounds difference

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 31 09:04:07 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44419

            Bug ID: 44419
           Summary: LLVM 10 regression in comparison of gep inbounds
                    difference
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at lists.llvm.org

define i1 @test([0 x i32]* nonnull %arg, i64 %arg1, i64 %arg2) {
  %tmp = getelementptr inbounds [0 x i32], [0 x i32]* %arg, i64 0, i64 0
  %tmp3 = getelementptr inbounds [0 x i32], [0 x i32]* %arg, i64 0, i64 %arg1
  %tmp6 = ptrtoint i32* %tmp3 to i64
  %tmp7 = ptrtoint i32* %tmp to i64
  %tmp8 = sub nuw i64 %tmp6, %tmp7
  %tmp9 = lshr exact i64 %tmp8, 2
  %tmp24 = icmp ugt i64 %tmp9, %arg2
  ret i1 %tmp24
}

opt -instcombine on LLVM 9:

define i1 @test([0 x i32]* nonnull %arg, i64 %arg1, i64 %arg2) {
  %tmp24 = icmp ugt i64 %arg1, %arg2
  ret i1 %tmp24
}

opt -instcombine on LLVM 10:

define i1 @test([0 x i32]* nonnull %arg, i64 %arg1, i64 %arg2) {
  %tmp3.idx = and i64 %arg1, 4611686018427387903
  %tmp24 = icmp ugt i64 %tmp3.idx, %arg2
  ret i1 %tmp24
}

Am I missing some subtlety here that prevents inbounds from implying that the
masking is unnecessary?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191231/8e7fbf26/attachment.html>


More information about the llvm-bugs mailing list