[PATCH] D41944: [LLVM][IR][LIT] support of 'no-overflow' flag for sdiv\udiv instructions

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 10:56:24 PST 2018


efriedma added a comment.

> Or change the logic so the new poison generating form requires a flag instead of the other way round.

>From the perspective of transformation passes, we want the flag be consistent with other flags like nsw.  So we want the representation in memory and textual IR to work like it does in this patch.

That said, we don't have to use the same representation in bitcode; the bitcode reader/writer can invert the bit so divides in old bitcode files get deserialized to "sdiv nof".



================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:574
+/// replace the upsupported division with a scalar safe code
+bool CodeGenPrepare::fixMayOverflowIntegerDiv(Instruction &I, bool isSigned) {
+  assert((I.getOpcode() == Instruction::SDiv ||
----------------
CodeGenPrepare doesn't run at -O0; you'll have to put this code somewhere else.


https://reviews.llvm.org/D41944





More information about the llvm-commits mailing list