[PATCH] D63036: [RFC] LLVM IR constant expressions never trap.
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 14:30:41 PDT 2019
hfinkel added inline comments.
================
Comment at: test/CodeGen/X86/divide-constant.ll:301
+cond.end.i:
+ %r = phi i32 [ urem (i32 ptrtoint (i32* @g1 to i32), i32 ptrtoint (i32* @g2 to i32)), %entry ], [ 1, %cond.false.i ]
+ ret i32 %r
----------------
efriedma wrote:
> hfinkel wrote:
> > Can you check known bits? I feel like we should somehow know that `ptrtoint(@g)` isn't zero.
> >
> > For a test case, we can always do `ptrtoint(@g1)/(ptrtoint(@g2)-123456)` or similar.
> I don't think there's any way to prove the value is non-zero here; it's extern_weak.
Indeed. I missed that. I did mean the comment more generally - it seems like we should know that non-weak globals aren't zero. That having been said, looking at the implementation of SelectionDAG::isKnownNeverZero and SelectionDAG::computeKnownBits, etc. they don't seem to know anything about globals, so I suppose that enhancement there would also be needed in order to have an impact on this lowering.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63036/new/
https://reviews.llvm.org/D63036
More information about the llvm-commits
mailing list