[PATCH] D63036: [RFC] LLVM IR constant expressions never trap.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 19:26:46 PDT 2019


hfinkel added a comment.

Overall, I think that this makes sense. Thanks for proposing this.



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:3224
+  } else {
+    auto &TLI = DAG.getTargetLoweringInfo();
+    EVT CCVT =
----------------
Please add a comment here explaining that you're guarding against both x/0 and INT_MIN/-1.


================
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
----------------
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.


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