[PATCH] D62101: NewGVN: Handle addrspacecast

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 21:54:19 PDT 2019


fhahn added inline comments.


================
Comment at: lib/Transforms/Scalar/NewGVN.cpp:1171
     Value *V =
-        SimplifyCastInst(BI->getOpcode(), BI->getOperand(0), BI->getType(), SQ);
+        SimplifyCastInst(CI->getOpcode(), CI->getOperand(0), CI->getType(), SQ);
     if (const Expression *SimplifiedE = checkSimplificationResults(E, I, V))
----------------
The code here  should pass in `E->getOperand(0)`, instead of `CI->getOperand(0)`: we want to pass in the leader for the operand, not the operand from the original IR. This way, there should be no need to move the AllConstant condition. If the leader of the CastInst is constant, we should already simplify it here.

Please note that there is a subtle underlying issue with the way simplifications on the original IR and the simplified leaders interact, but that needs to be addressed separately and I do not think CastInst should have any special treatment here. If anything, it may make it a bit harder to trigger the issue.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62101/new/

https://reviews.llvm.org/D62101





More information about the llvm-commits mailing list