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: unassignedb...@nondot.org
          Reporter: nikita....@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to