[PATCH] D50465: [InstCombine] Optimize redundant 'signed truncation check pattern'.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 9 07:12:27 PDT 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1404
+  return Builder.CreateICmpULT(X, ConstantInt::get(X->getType(), HighestBit),
+                               I.getName() + ".simplified");
+}
----------------
lebedev.ri wrote:
> @RKSimon: if i don't set a name here, the `utils/update_test_checks.py` goes mad,
> and produces strange (wrong) check-lines:
> ```
> $ ninja check-llvm-transforms-instcombine -v
> [0/1] cd /build/llvm-build-GCC-release/test && /usr/bin/python2.7 /build/llvm-build-GCC-release/./bin/llvm-lit -sv /build/llvm/test/Transforms/InstCombine
> FAIL: LLVM :: Transforms/InstCombine/signed-truncation-check.ll (696 of 824)
> ******************** TEST 'LLVM :: Transforms/InstCombine/signed-truncation-check.ll' FAILED ********************
> Script:
> --
> : 'RUN: at line 2';   /build/llvm-build-GCC-release/bin/opt < /build/llvm/test/Transforms/InstCombine/signed-truncation-check.ll -instcombine -S | /build/llvm-build-GCC-release/bin/FileCheck /build/llvm/test/Transforms/InstCombine/signed-truncation-check.ll
> --
> Exit Code: 1
> 
> Command Output (stderr):
> --
> /build/llvm/test/Transforms/InstCombine/signed-truncation-check.ll:281:15: error: CHECK-NEXT: expected string not found in input
> ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult i16 [[TMP1]], 128
>               ^
> <stdin>:114:2: note: scanning from here
>  %1 = icmp ult i16 %tmp1, 128
>  ^
> 
> --
> 
> ********************
> Testing Time: 5.48s
> ********************
> Failing Tests (1):
>     LLVM :: Transforms/InstCombine/signed-truncation-check.ll
> 
>   Expected Passes    : 808
>   Unsupported Tests  : 15
>   Unexpected Failures: 1
> FAILED: test/CMakeFiles/check-llvm-transforms-instcombine 
> cd /build/llvm-build-GCC-release/test && /usr/bin/python2.7 /build/llvm-build-GCC-release/./bin/llvm-lit -sv /build/llvm/test/Transforms/InstCombine
> ninja: build stopped: subcommand failed.
> ```
```
Independent of this patch: the script uses "TMP###" as the substitute for unnamed (%###) values. So if a test already has values named "%tmp###", things will likely go wrong. The quick fix is to replace all of the "%tmp###" names in these tests with "%t###" (or anything other than "%tmp###").


```


Repository:
  rL LLVM

https://reviews.llvm.org/D50465





More information about the llvm-commits mailing list