[PATCH] D104569: [SimplifyCFG] Fix SimplifyBranchOnICmpChain to be undef/poison safe.

Hyeongyu Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 26 01:26:24 PDT 2021


hyeongyukim updated this revision to Diff 354650.
hyeongyukim added a comment.

I've changed `isGuaranteedNotToBeUndefOrPoison` to `isGuaranteedNotToBePoison` before, but these two are actually the same function. And I want to enable SimplifyCFG when MSAN is on, so I reverted my code to `isGuaranteedNotToBeUndefOrPoison.`

As I mentioned earlier, an unnecessary freeze is being added.
However, I think it is better to solve the only miscompilation problem in this PR and deal with an unnecessary freeze in a separate PR.
When I check the compiled assembly of LLVM testsuite, I think that the performance degradation caused by this patch is slight. I have attached the diff files, so please check them.

I'm done writing the code, so I'd appreciate it if you could review it.

  {F17604949}


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

https://reviews.llvm.org/D104569

Files:
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4268,7 +4268,7 @@
     if (DTU && DTU->hasDomTree())
       DT = &DTU->getDomTree();
 
-    if (!isGuaranteedNotToBePoison(ExtraCase, AC, BI, DT))
+    if (!isGuaranteedNotToBeUndefOrPoison(ExtraCase, AC, BI, DT))
       ExtraCase = Builder.CreateFreeze(ExtraCase);
 
     if (TrueWhenEqual)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104569.354650.patch
Type: text/x-patch
Size: 505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210626/b870c5e5/attachment.bin>


More information about the llvm-commits mailing list