[PATCH] D63036: [RFC] LLVM IR constant expressions never trap.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 14:06:57 PDT 2019
efriedma marked 2 inline comments as done.
efriedma added inline comments.
================
Comment at: lib/Analysis/ValueTracking.cpp:489
+ if (V == I || !isa<Instruction>(V) ||
+ isSafeToSpeculativelyExecute(cast<Instruction>(V))) {
EphValues.insert(V);
----------------
jdoerfert wrote:
> `V == I` implies `isa<Instruction>(V)` and you can use `isSafeToSpeculativelyExecute(I)`
I think you're reading this backwards; isSafeToSpeculativelyExecute only executes if `V != I`
================
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
----------------
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.
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