[PATCH] D29074: Canonicalize guards for AND condition

Artur Pilipenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 09:51:42 PST 2017


apilipenko added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2883-2884
+    // Canonicalize guard(a && b) -> guard(a); guard(b);
+    // Note: New assumption intrinsics created here are registered by
+    // the InstCombineIRInserter object.
+    Value *GuardIntrinsic = II->getCalledValue(), *A, *B;
----------------
New guard ...


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2885
+    // the InstCombineIRInserter object.
+    Value *GuardIntrinsic = II->getCalledValue(), *A, *B;
+    OperandBundleDef DeoptOB(*II->getOperandBundle(LLVMContext::OB_deopt));
----------------
Minor: 
```
Function *GuardIntrinsic = II->getCalledFunction();
```


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2888-2891
+      Builder->CreateCall(GuardIntrinsic, A,
+                          {DeoptOB}, II->getName());
+      Builder->CreateCall(GuardIntrinsic, B,
+                          {DeoptOB}, II->getName());
----------------
We might have a guard with non-standard calling convention. I guess you'll need to set the cc for new guards as well. 


https://reviews.llvm.org/D29074





More information about the llvm-commits mailing list